summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/plugin.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-06-24 12:47:28 +0200
committerNoel Grandin <noel@peralex.com>2014-06-24 12:48:17 +0200
commita74193306a10a98902d192b8f7cecb92b4817c23 (patch)
tree6747a708a603ae9cdb53bd4dd3224bad9d08a41b /compilerplugins/clang/plugin.cxx
parent5406e237ea2ec534988da31104f10188b001ad75 (diff)
compilerplugins: move isUnoIncludeFile to base class
to reduce copy-pasted code Change-Id: I7728d85dea7d0161998c326d6648ca681a8250d0
Diffstat (limited to 'compilerplugins/clang/plugin.cxx')
-rw-r--r--compilerplugins/clang/plugin.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index f319e6038d32..4a391823bced 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -17,6 +17,7 @@
#include <clang/Lex/Lexer.h>
#include "pluginhandler.hxx"
+#include "compat.hxx"
/*
Base classes for plugin actions.
@@ -73,6 +74,28 @@ Stmt* Plugin::parentStmt( Stmt* stmt )
return const_cast< Stmt* >( parents[ stmt ] );
}
+
+bool Plugin::isInUnoIncludeFile(SourceLocation spellingLocation) const {
+ StringRef name {
+ compiler.getSourceManager().getFilename(spellingLocation) };
+ return compat::isInMainFile(compiler.getSourceManager(), spellingLocation)
+ ? (name == SRCDIR "/cppu/source/cppu/compat.cxx"
+ || name == SRCDIR "/cppuhelper/source/compat.cxx"
+ || name == SRCDIR "/sal/osl/all/compat.cxx")
+ : (name.startswith(SRCDIR "/include/com/")
+ || name.startswith(SRCDIR "/include/cppu/")
+ || name.startswith(SRCDIR "/include/cppuhelper/")
+ || name.startswith(SRCDIR "/include/osl/")
+ || name.startswith(SRCDIR "/include/rtl/")
+ || name.startswith(SRCDIR "/include/sal/")
+ || name.startswith(SRCDIR "/include/salhelper/")
+ || name.startswith(SRCDIR "/include/systools/")
+ || name.startswith(SRCDIR "/include/typelib/")
+ || name.startswith(SRCDIR "/include/uno/")
+ || name.startswith(SRCDIR "/workdir/")
+ || name == SRCDIR "/include/comphelper/implbase_var.hxx");
+}
+
namespace
{
class ParentBuilder