diff options
Diffstat (limited to 'compilerplugins/clang/sallogareas.cxx')
-rw-r--r-- | compilerplugins/clang/sallogareas.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compilerplugins/clang/sallogareas.cxx b/compilerplugins/clang/sallogareas.cxx index 1dd99b9b727a..1a4a8b25c3c2 100644 --- a/compilerplugins/clang/sallogareas.cxx +++ b/compilerplugins/clang/sallogareas.cxx @@ -31,6 +31,7 @@ SalLogAreas::SalLogAreas( ASTContext& context ) void SalLogAreas::run() { inFunction = NULL; + lastSalDetailLogStreamMacro = SourceLocation(); TraverseDecl( context.getTranslationUnitDecl()); } @@ -55,6 +56,13 @@ bool SalLogAreas::VisitCallExpr( CallExpr* call ) { if( const StringLiteral* area = dyn_cast< StringLiteral >( call->getArg( 1 )->IgnoreParenImpCasts())) { + // The SAL_DETAIL_LOG_STREAM macro expands to two calls to sal::detail::log(), + // so do not warn repeatedly about the same macro (the area->getLocStart() of all the calls + // from the same macro should be the same). + SourceLocation expansionLocation = context.getSourceManager().getExpansionLoc(area->getLocStart()); + if( expansionLocation == lastSalDetailLogStreamMacro ) + return true; + lastSalDetailLogStreamMacro = expansionLocation; if( area->getKind() == StringLiteral::Ascii ) checkArea( area->getBytes(), area->getExprLoc()); else |