summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/stringconstant.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-12-18 14:13:18 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-12-18 22:43:29 +0100
commit83ff2a4f3824cbca7bc61a954aed840a21be4364 (patch)
tree35fb7a94c64f26dc98c7eadeb0d3b7d8cca6240a /compilerplugins/clang/stringconstant.cxx
parent9ed9ca611a6abfe3096379ba52a56fd53f07d5a1 (diff)
loplugin:stringconstant: Adapt to definition of OSL_THIS_FUNC on Windows
Change-Id: I93a23799ad9a76ed9f4f86d69adb610d0962da20
Diffstat (limited to 'compilerplugins/clang/stringconstant.cxx')
-rw-r--r--compilerplugins/clang/stringconstant.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx
index 354f23587bfd..2afd923147d6 100644
--- a/compilerplugins/clang/stringconstant.cxx
+++ b/compilerplugins/clang/stringconstant.cxx
@@ -687,6 +687,17 @@ bool StringConstant::VisitCXXConstructExpr(CXXConstructExpr const * expr) {
{
return true;
}
+ // OSL_THIS_FUNC may be defined as "" or as something other
+ // than a string literal in include/osl/diagnose.h:
+ auto loc = arg->getLocStart();
+ if (compiler.getSourceManager().isMacroBodyExpansion(loc)
+ && (Lexer::getImmediateMacroName(
+ loc, compiler.getSourceManager(),
+ compiler.getLangOpts())
+ == "OSL_THIS_FUNC"))
+ {
+ return true;
+ }
if (non) {
report(
DiagnosticsEngine::Warning,