summaryrefslogtreecommitdiffstats
path: root/compilerplugins/clang/mergeclasses.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/mergeclasses.cxx')
-rw-r--r--compilerplugins/clang/mergeclasses.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/compilerplugins/clang/mergeclasses.cxx b/compilerplugins/clang/mergeclasses.cxx
index 017f66680ffb..0c023a9bd15a 100644
--- a/compilerplugins/clang/mergeclasses.cxx
+++ b/compilerplugins/clang/mergeclasses.cxx
@@ -11,6 +11,8 @@
#include <set>
#include <string>
#include <iostream>
+#include "config_clang.h"
+#include "compat.hxx"
#include "plugin.hxx"
#include <fstream>
@@ -55,6 +57,8 @@ public:
virtual void run() override
{
+ handler.enableTreeWideAnalysisMode();
+
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
// dump all our output in one write call - this is to try and limit IO "crosstalk" between multiple processes
@@ -83,14 +87,15 @@ public:
bool ignoreClass(StringRef s)
{
// ignore stuff in the standard library, and UNO stuff we can't touch.
- if (s.startswith("rtl::") || s.startswith("sal::") || s.startswith("com::sun::")
- || s.startswith("std::") || s.startswith("boost::")
+ if (compat::starts_with(s, "rtl::") || compat::starts_with(s, "sal::")
+ || compat::starts_with(s, "com::sun::") || compat::starts_with(s, "std::")
+ || compat::starts_with(s, "boost::")
|| s == "OString" || s == "OUString" || s == "bad_alloc")
{
return true;
}
// ignore instantiations of pointers and arrays
- if (s.endswith("*") || s.endswith("]")) {
+ if (compat::ends_with(s, "*") || compat::ends_with(s, "]")) {
return true;
}
return false;
@@ -126,7 +131,7 @@ bool MergeClasses::VisitCXXConstructExpr( const CXXConstructExpr* pCXXConstructE
return true;
}
// ignore calls when a sub-class is constructing its superclass
- if (pCXXConstructExpr->getConstructionKind() != CXXConstructExpr::ConstructionKind::CK_Complete) {
+ if (pCXXConstructExpr->getConstructionKind() != compat::CXXConstructionKind::Complete) {
return true;
}
const CXXConstructorDecl* pCXXConstructorDecl = pCXXConstructExpr->getConstructor();
@@ -144,7 +149,7 @@ bool MergeClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
}
if (decl->isThisDeclarationADefinition())
{
- SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(decl));
+ SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(decl->getBeginLoc());
auto filename = getFilenameOfLocation(spellingLocation);
filename = filename.substr(strlen(SRCDIR));
std::string s = decl->getQualifiedNameAsString();