summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/stringconstant.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-06-28 09:06:46 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-06-28 09:07:12 +0200
commit1a6f599e9883eb2c2f51788ebc1de3465e0c31cd (patch)
treecdacd9d1a7f94fb51bc769314163b581d0456953 /compilerplugins/clang/stringconstant.cxx
parent3f9acf02b0a45deb258c96b638c6fddd9af31ff9 (diff)
loplugin:stringconstant: Don't warn about "OUString(OSL_THIS_FUNC)"
Change-Id: Id5f021bd798cb94b7246faed539304dae04b4700
Diffstat (limited to 'compilerplugins/clang/stringconstant.cxx')
-rw-r--r--compilerplugins/clang/stringconstant.cxx15
1 files changed, 15 insertions, 0 deletions
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 "