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

Stephan Bergmann sbergman at redhat.com
Thu Dec 18 08:30:00 PST 2014


 compilerplugins/clang/saloverride.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit a349a4763fd32177be55877a098247959a820c5a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Dec 18 17:29:31 2014 +0100

    loplugin:saloverride does not make sense for external code
    
    ...where SAL_OVERRIDE is not available
    
    Change-Id: I49d447ba90516f4f744c21302607bff97ad3c4d5

diff --git a/compilerplugins/clang/saloverride.cxx b/compilerplugins/clang/saloverride.cxx
index 6b62fb3..bb6766b 100644
--- a/compilerplugins/clang/saloverride.cxx
+++ b/compilerplugins/clang/saloverride.cxx
@@ -25,8 +25,7 @@ class SalOverride:
 public:
     explicit SalOverride(InstantiationData const & data): RewritePlugin(data) {}
 
-    virtual void run() override
-    { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
+    virtual void run() override;
 
     bool VisitCXXMethodDecl(CXXMethodDecl const * decl);
 
@@ -34,6 +33,14 @@ private:
     std::set<SourceLocation> insertions_;
 };
 
+void SalOverride::run() {
+    if (compiler.getLangOpts().CPlusPlus
+        && compiler.getPreprocessor().getIdentifierInfo(
+            "LIBO_INTERNAL_ONLY")->hasMacroDefinition())
+    {
+        TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+    }
+}
 bool SalOverride::VisitCXXMethodDecl(CXXMethodDecl const * decl) {
     // As a heuristic, ignore declarations where the name is spelled out in an
     // ignored location; that e.g. handles uses of the Q_OBJECT macro from


More information about the Libreoffice-commits mailing list