summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/weakbase.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/weakbase.cxx')
-rw-r--r--compilerplugins/clang/weakbase.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/compilerplugins/clang/weakbase.cxx b/compilerplugins/clang/weakbase.cxx
index fbd72955c0ba..a0040dd37c30 100644
--- a/compilerplugins/clang/weakbase.cxx
+++ b/compilerplugins/clang/weakbase.cxx
@@ -7,6 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#ifndef LO_CLANG_SHARED_PLUGINS
+
#include <string>
#include <iostream>
#include <map>
@@ -28,7 +30,15 @@ public:
{
}
- virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
+ bool preRun() override { return compiler.getLangOpts().CPlusPlus; }
+
+ void run() override
+ {
+ if (preRun())
+ {
+ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+ }
+ }
bool VisitCXXRecordDecl(CXXRecordDecl const*);
};
@@ -104,7 +114,10 @@ bool WeakBase::VisitCXXRecordDecl(CXXRecordDecl const* recordDecl)
return true;
}
-loplugin::Plugin::Registration<WeakBase> WeakBase("weakbase", true);
-}
+loplugin::Plugin::Registration<WeakBase> weakbase("weakbase");
+
+} // namespace
+
+#endif // LO_CLANG_SHARED_PLUGINS
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */