summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/salunicodeliteral.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-15 12:14:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-15 15:48:48 +0200
commitfc1b213d157afa57704cec5a0fb65ae8c11d7822 (patch)
tree11fbfeed38a93ee33535449c85964492e60256c9 /compilerplugins/clang/salunicodeliteral.cxx
parentfd55c09ebab3827847d69112a8786a3413d42db2 (diff)
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>
Diffstat (limited to 'compilerplugins/clang/salunicodeliteral.cxx')
-rw-r--r--compilerplugins/clang/salunicodeliteral.cxx21
1 files changed, 13 insertions, 8 deletions
diff --git a/compilerplugins/clang/salunicodeliteral.cxx b/compilerplugins/clang/salunicodeliteral.cxx
index bdf83694b77e..cfa37396b02b 100644
--- a/compilerplugins/clang/salunicodeliteral.cxx
+++ b/compilerplugins/clang/salunicodeliteral.cxx
@@ -6,6 +6,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#ifndef LO_CLANG_SHARED_PLUGINS
#include "check.hxx"
#include "plugin.hxx"
@@ -41,16 +42,18 @@ public:
return true;
}
-private:
- void run() override {
- if (compiler.getLangOpts().CPlusPlus
+ bool preRun() override {
+ return compiler.getLangOpts().CPlusPlus
&& compiler.getPreprocessor().getIdentifierInfo(
- "LIBO_INTERNAL_ONLY")->hasMacroDefinition())
- {
+ "LIBO_INTERNAL_ONLY")->hasMacroDefinition();
+ }
+
+ void run() override {
+ if (preRun())
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
- }
}
+private:
void check(ExplicitCastExpr const * expr) {
if (ignoreLocation(expr)
|| isInUnoIncludeFile(expr->getExprLoc()))
@@ -90,9 +93,11 @@ private:
}
};
-static loplugin::Plugin::Registration<SalUnicodeLiteral> reg(
+static loplugin::Plugin::Registration<SalUnicodeLiteral> salunicodeliteral(
"salunicodeliteral");
-}
+} // namespace
+
+#endif // LO_CLANG_SHARED_PLUGINS
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */