[Libreoffice-commits] core.git: compilerplugins/clang
Stephan Bergmann
sbergman at redhat.com
Sat Mar 28 11:17:12 PDT 2015
compilerplugins/clang/compat.hxx | 11 -----------
compilerplugins/clang/literaltoboolconversion.cxx | 2 +-
compilerplugins/clang/salbool.cxx | 13 +------------
compilerplugins/clang/staticmethods.cxx | 2 +-
4 files changed, 3 insertions(+), 25 deletions(-)
New commits:
commit 78ad5ecd988270f3308fe98cc128ddf832c0c00b
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Sat Mar 28 19:16:29 2015 +0100
Clean up isMacroBodyExpansion
Change-Id: I745b320dd5f44d54371d8a0b961c49793e3e0ad6
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 64e0b04..08787e8 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -221,17 +221,6 @@ inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::Sourc
#endif
}
-
-}
-
-inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::SourceLocation location)
-{
-#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3
- return compiler.getSourceManager().isMacroBodyExpansion(location);
-#else
- return location.isMacroID()
- && !compiler.getSourceManager().isMacroArgExpansion(location);
-#endif
}
#endif
diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx
index 00ecdd8..c6d6381 100644
--- a/compilerplugins/clang/literaltoboolconversion.cxx
+++ b/compilerplugins/clang/literaltoboolconversion.cxx
@@ -62,7 +62,7 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr(
while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
}
- if (isMacroBodyExpansion(compiler, loc)) {
+ if (compat::isMacroBodyExpansion(compiler, loc)) {
StringRef name { Lexer::getImmediateMacroName(
loc, compiler.getSourceManager(), compiler.getLangOpts()) };
if (name == "sal_False" || name == "sal_True") {
diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx
index f5ee945..933f80f 100644
--- a/compilerplugins/clang/salbool.cxx
+++ b/compilerplugins/clang/salbool.cxx
@@ -153,8 +153,6 @@ public:
private:
bool isInSpecialMainFile(SourceLocation spellingLocation) const;
- bool isMacroBodyExpansion(SourceLocation location) const;
-
bool rewrite(SourceLocation location);
std::set<VarDecl const *> varDecls_;
@@ -274,7 +272,7 @@ bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
}
- if (isMacroBodyExpansion(loc)) {
+ if (compat::isMacroBodyExpansion(compiler, loc)) {
StringRef name { Lexer::getImmediateMacroName(
loc, compiler.getSourceManager(), compiler.getLangOpts()) };
if (name == "sal_False" || name == "sal_True") {
@@ -580,15 +578,6 @@ bool SalBool::isInSpecialMainFile(SourceLocation spellingLocation) const {
== SRCDIR "/cppu/qa/test_any.cxx");
}
-bool SalBool::isMacroBodyExpansion(SourceLocation location) const {
-#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3
- return compiler.getSourceManager().isMacroBodyExpansion(location);
-#else
- return location.isMacroID()
- && !compiler.getSourceManager().isMacroArgExpansion(location);
-#endif
-}
-
bool SalBool::rewrite(SourceLocation location) {
if (rewriter != nullptr) {
//TODO: "::sal_Bool" -> "bool", not "::bool"
diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx
index b5b2a9d..b3f1b58 100644
--- a/compilerplugins/clang/staticmethods.cxx
+++ b/compilerplugins/clang/staticmethods.cxx
@@ -84,7 +84,7 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl)
// leave these alone for now, it is possible to fix them, but I don't understand how
SourceLocation canonicalLoc = pCXXMethodDecl->getCanonicalDecl()->getLocStart();
- if (isMacroBodyExpansion(compiler, canonicalLoc) ) {
+ if (compat::isMacroBodyExpansion(compiler, canonicalLoc) ) {
StringRef name { Lexer::getImmediateMacroName(
canonicalLoc, compiler.getSourceManager(), compiler.getLangOpts()) };
if (name == "DECL_LINK") {
More information about the Libreoffice-commits
mailing list