From 1a6f599e9883eb2c2f51788ebc1de3465e0c31cd Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 28 Jun 2016 09:06:46 +0200 Subject: loplugin:stringconstant: Don't warn about "OUString(OSL_THIS_FUNC)" Change-Id: Id5f021bd798cb94b7246faed539304dae04b4700 --- compilerplugins/clang/stringconstant.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx index c68d58f9b6b0..3b16d8203e10 100644 --- a/compilerplugins/clang/stringconstant.cxx +++ b/compilerplugins/clang/stringconstant.cxx @@ -775,6 +775,21 @@ bool StringConstant::VisitCXXConstructExpr(CXXConstructExpr const * expr) { return true; } } + auto loc = expr->getArg(0)->getLocStart(); + while (compiler.getSourceManager() + .isMacroArgExpansion(loc)) + { + loc = compiler.getSourceManager() + .getImmediateMacroCallerLoc(loc); + } + if (compat::isMacroBodyExpansion(compiler, loc) + && (Lexer::getImmediateMacroName( + loc, compiler.getSourceManager(), + compiler.getLangOpts()) + == "OSL_THIS_FUNC")) + { + return true; + } report( DiagnosticsEngine::Warning, ("elide construction of " + qname + " with " -- cgit