summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/stringbuffer.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-08-26 11:19:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-08-26 13:48:13 +0200
commite87761688dd831ff3d8ba1a2a38220053f900f62 (patch)
treee9cc9eed1c684188043c3c45f5671874e896fae2 /compilerplugins/clang/stringbuffer.cxx
parent761e6dd25782420bf06e4a2ff3205a79b6cbb136 (diff)
use shared-plugin infra for some recent plugins
Change-Id: Ia9cba59718de91fed2045ffd7e0ec06d28bf37dc Reviewed-on: https://gerrit.libreoffice.org/78118 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/stringbuffer.cxx')
-rw-r--r--compilerplugins/clang/stringbuffer.cxx28
1 files changed, 18 insertions, 10 deletions
diff --git a/compilerplugins/clang/stringbuffer.cxx b/compilerplugins/clang/stringbuffer.cxx
index 154a460a0007..ad8b2eb792a0 100644
--- a/compilerplugins/clang/stringbuffer.cxx
+++ b/compilerplugins/clang/stringbuffer.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"
@@ -23,18 +24,23 @@ public:
{
}
- void run() override;
+ bool preRun() override
+ {
+ StringRef fn(handler.getMainFileName());
+ return !loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/");
+ }
+
+ void run() override
+ {
+ if (preRun())
+ {
+ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+ }
+ }
+
bool VisitCXXMemberCallExpr(CXXMemberCallExpr const*);
};
-void StringBuffer::run()
-{
- StringRef fn(handler.getMainFileName());
- if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/"))
- return;
- TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
-}
-
bool StringBuffer::VisitCXXMemberCallExpr(CXXMemberCallExpr const* memberCallExpr)
{
if (ignoreLocation(memberCallExpr))
@@ -60,8 +66,10 @@ bool StringBuffer::VisitCXXMemberCallExpr(CXXMemberCallExpr const* memberCallExp
return true;
}
-loplugin::Plugin::Registration<StringBuffer> X("stringbuffer");
+loplugin::Plugin::Registration<StringBuffer> stringbuffer("stringbuffer");
} // namespace
+#endif // LO_CLANG_SHARED_PLUGINS
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */