diff options
Diffstat (limited to 'compilerplugins/clang/stringconstant.cxx')
-rw-r--r-- | compilerplugins/clang/stringconstant.cxx | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx index 29ff508e8c7c..05cfa03ff711 100644 --- a/compilerplugins/clang/stringconstant.cxx +++ b/compilerplugins/clang/stringconstant.cxx @@ -7,8 +7,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef LO_CLANG_SHARED_PLUGINS - #include <algorithm> #include <cassert> #include <cstdint> @@ -110,8 +108,6 @@ public: explicit StringConstant(loplugin::InstantiationData const & data): FilteringRewritePlugin(data) {} - bool preRun() override; - void run() override; bool TraverseCallExpr(CallExpr * expr); @@ -190,15 +186,14 @@ private: std::stack<Expr const *> calls_; }; -bool StringConstant::preRun() { - return compiler.getLangOpts().CPlusPlus +void StringConstant::run() { + if (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) { @@ -2092,10 +2087,8 @@ void StringConstant::handleFunArgOstring( } } -loplugin::Plugin::Registration< StringConstant > stringconstant("stringconstant"); +loplugin::Plugin::Registration< StringConstant > X("stringconstant", true); -} // namespace - -#endif // LO_CLANG_SHARED_PLUGINS +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |