loplugin:stringconstant: Don't warn about "OUString(OSL_THIS_FUNC)"

Change-Id: Id5f021bd798cb94b7246faed539304dae04b4700
This commit is contained in:
Stephan Bergmann
2016-06-28 09:06:46 +02:00
parent 3f9acf02b0
commit 1a6f599e98

View File

@@ -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 "