summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-12-18 17:29:31 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-12-18 17:29:31 +0100
commita349a4763fd32177be55877a098247959a820c5a (patch)
treea5402f6fa350bdd42d3fd56ffabfb2da2581f958 /compilerplugins
parentdf35af41685630b70fb460a90ec47f481895ad7f (diff)
loplugin:saloverride does not make sense for external code
...where SAL_OVERRIDE is not available Change-Id: I49d447ba90516f4f744c21302607bff97ad3c4d5
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/saloverride.cxx11
1 files changed, 9 insertions, 2 deletions
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<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