convert some plugins to use the sharedplugin infrastructure

Change-Id: I690d9df436abdadc51a6d3f7df686a2e37f79f73
Reviewed-on: https://gerrit.libreoffice.org/75624
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-07-15 12:14:34 +02:00
parent fd55c09eba
commit fc1b213d15
16 changed files with 540 additions and 53 deletions

View File

@@ -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: */