summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/weakobject.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/weakobject.cxx')
-rw-r--r--compilerplugins/clang/weakobject.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/compilerplugins/clang/weakobject.cxx b/compilerplugins/clang/weakobject.cxx
index 1f801d6acdd2..afa652befc1a 100644
--- a/compilerplugins/clang/weakobject.cxx
+++ b/compilerplugins/clang/weakobject.cxx
@@ -7,6 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#ifndef LO_CLANG_SHARED_PLUGINS
+
#include "check.hxx"
#include "plugin.hxx"
@@ -26,8 +28,11 @@ public:
explicit WeakObject(loplugin::InstantiationData const& rData): FilteringPlugin(rData)
{}
+ virtual bool preRun() override {
+ return compiler.getLangOpts().CPlusPlus; // no OWeakObject in C
+ }
void run() override {
- if (compiler.getLangOpts().CPlusPlus) { // no OWeakObject in C
+ if( preRun()) {
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}
}
@@ -153,8 +158,10 @@ public:
};
-loplugin::Plugin::Registration<WeakObject> X("weakobject");
+loplugin::Plugin::Registration<WeakObject> weakobject("weakobject");
} // namespace
+#endif // LO_CLANG_SHARED_PLUGINS
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */