summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-03-08 18:16:58 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-03-08 18:16:58 +0100
commit1316543eb89a8c30edf547c76852f3e0f8ae848e (patch)
tree3bd9c1c462738e12378d91a10fec5d8dea54a2a9 /compilerplugins
parentc94f5b026010de00504b19015d0454ca19966da2 (diff)
TODO: Work around loplugin:salbool in cppu/source/uno/data.cxx for now
Change-Id: I1730c09669426e049aba941ef27341581ce31887
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/salbool.cxx19
1 files changed, 14 insertions, 5 deletions
diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx
index dfead3576e82..77120332d2ff 100644
--- a/compilerplugins/clang/salbool.cxx
+++ b/compilerplugins/clang/salbool.cxx
@@ -293,7 +293,10 @@ bool SalBool::VisitCXXStaticCastExpr(CXXStaticCastExpr * expr) {
if (ignoreLocation(expr)) {
return true;
}
- if (isSalBool(expr->getType())) {
+ if (isSalBool(expr->getType())
+ && !isInSpecialMainFile(
+ compiler.getSourceManager().getSpellingLoc(expr->getLocStart())))
+ {
report(
DiagnosticsEngine::Warning,
"CXXStaticCastExpr, suspicious cast from %0 to %1",
@@ -440,7 +443,10 @@ bool SalBool::VisitFieldDecl(FieldDecl const * decl) {
if (ignoreLocation(decl)) {
return true;
}
- if (isSalBool(decl->getType())) {
+ if (isSalBool(decl->getType())
+ && !isInSpecialMainFile(
+ compiler.getSourceManager().getSpellingLoc(decl->getLocStart())))
+ {
TagDecl const * td = dyn_cast<TagDecl>(decl->getDeclContext());
assert(td != nullptr);
if (!(((td->isStruct() || td->isUnion())
@@ -573,9 +579,12 @@ bool SalBool::VisitValueDecl(ValueDecl const * decl) {
}
bool SalBool::isInSpecialMainFile(SourceLocation spellingLocation) const {
- return compat::isInMainFile(compiler.getSourceManager(), spellingLocation)
- && (compiler.getSourceManager().getFilename(spellingLocation)
- == SRCDIR "/cppu/qa/test_any.cxx");
+ if (!compat::isInMainFile(compiler.getSourceManager(), spellingLocation)) {
+ return false;
+ }
+ auto f = compiler.getSourceManager().getFilename(spellingLocation);
+ return f == SRCDIR "/cppu/qa/test_any.cxx"
+ || f == SRCDIR "/cppu/source/uno/data.cxx"; // TODO: the offset checks
}
bool SalBool::rewrite(SourceLocation location) {