summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/stringconstant.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/stringconstant.cxx')
-rw-r--r--compilerplugins/clang/stringconstant.cxx21
1 files changed, 14 insertions, 7 deletions
diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx
index 05cfa03ff711..29ff508e8c7c 100644
--- a/compilerplugins/clang/stringconstant.cxx
+++ b/compilerplugins/clang/stringconstant.cxx
@@ -7,6 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#ifndef LO_CLANG_SHARED_PLUGINS
+
#include <algorithm>
#include <cassert>
#include <cstdint>
@@ -108,6 +110,8 @@ public:
explicit StringConstant(loplugin::InstantiationData const & data):
FilteringRewritePlugin(data) {}
+ bool preRun() override;
+
void run() override;
bool TraverseCallExpr(CallExpr * expr);
@@ -186,14 +190,15 @@ private:
std::stack<Expr const *> calls_;
};
-void StringConstant::run() {
- if (compiler.getLangOpts().CPlusPlus
+bool StringConstant::preRun() {
+ return compiler.getLangOpts().CPlusPlus
&& compiler.getPreprocessor().getIdentifierInfo(
- "LIBO_INTERNAL_ONLY")->hasMacroDefinition())
+ "LIBO_INTERNAL_ONLY")->hasMacroDefinition();
//TODO: some parts of it are useful for external code, too
- {
+}
+void StringConstant::run() {
+ if (preRun())
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
- }
}
bool StringConstant::TraverseCallExpr(CallExpr * expr) {
@@ -2087,8 +2092,10 @@ void StringConstant::handleFunArgOstring(
}
}
-loplugin::Plugin::Registration< StringConstant > X("stringconstant", true);
+loplugin::Plugin::Registration< StringConstant > stringconstant("stringconstant");
-}
+} // namespace
+
+#endif // LO_CLANG_SHARED_PLUGINS
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */