summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/staticconstfield.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/staticconstfield.cxx')
-rw-r--r--compilerplugins/clang/staticconstfield.cxx22
1 files changed, 18 insertions, 4 deletions
diff --git a/compilerplugins/clang/staticconstfield.cxx b/compilerplugins/clang/staticconstfield.cxx
index 91a798daa5bd..3d9d4c6411ae 100644
--- a/compilerplugins/clang/staticconstfield.cxx
+++ b/compilerplugins/clang/staticconstfield.cxx
@@ -7,6 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#ifndef LO_CLANG_SHARED_PLUGINS
+
#include "plugin.hxx"
#include "check.hxx"
#include "compat.hxx"
@@ -28,6 +30,7 @@ public:
{
}
+ bool preRun() override;
void run() override;
bool TraverseConstructorInitializer(CXXCtorInitializer* init);
@@ -44,15 +47,23 @@ private:
CXXConstructorDecl* m_currentConstructor = nullptr;
};
-void StaticConstField::run()
+bool StaticConstField::preRun()
{
std::string fn = handler.getMainFileName();
loplugin::normalizeDotDotInFilePath(fn);
// unusual case where a user constructor sets a field to one value, and a copy constructor sets it to a different value
if (fn == SRCDIR "/sw/source/core/attr/hints.cxx")
- return;
+ return false;
if (fn == SRCDIR "/oox/source/core/contexthandler2.cxx")
+ return false;
+
+ return true;
+}
+
+void StaticConstField::run()
+{
+ if (!preRun())
return;
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
@@ -168,7 +179,10 @@ bool StaticConstField::TraverseConstructorInitializer(CXXCtorInitializer* init)
return true;
}
-loplugin::Plugin::Registration<StaticConstField> X("staticconstfield", true);
-}
+loplugin::Plugin::Registration<StaticConstField> staticconstfield("staticconstfield");
+
+} // namespace
+
+#endif // LO_CLANG_SHARED_PLUGINS
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */