[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Tue Jun 28 07:07:39 UTC 2016


 compilerplugins/clang/stringconstant.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 1a6f599e9883eb2c2f51788ebc1de3465e0c31cd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 28 09:06:46 2016 +0200

    loplugin:stringconstant: Don't warn about "OUString(OSL_THIS_FUNC)"
    
    Change-Id: Id5f021bd798cb94b7246faed539304dae04b4700

diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx
index c68d58f..3b16d82 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 "


More information about the Libreoffice-commits mailing list