From a349a4763fd32177be55877a098247959a820c5a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 18 Dec 2014 17:29:31 +0100 Subject: loplugin:saloverride does not make sense for external code ...where SAL_OVERRIDE is not available Change-Id: I49d447ba90516f4f744c21302607bff97ad3c4d5 --- compilerplugins/clang/saloverride.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'compilerplugins/clang') diff --git a/compilerplugins/clang/saloverride.cxx b/compilerplugins/clang/saloverride.cxx index 6b62fb3e0322..bb6766b64823 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 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 -- cgit