From 1316543eb89a8c30edf547c76852f3e0f8ae848e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 8 Mar 2016 18:16:58 +0100 Subject: TODO: Work around loplugin:salbool in cppu/source/uno/data.cxx for now Change-Id: I1730c09669426e049aba941ef27341581ce31887 --- compilerplugins/clang/salbool.cxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'compilerplugins/clang') 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(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) { -- cgit