Kaydet (Commit) 78ad5ecd authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Clean up isMacroBodyExpansion

Change-Id: I745b320dd5f44d54371d8a0b961c49793e3e0ad6
üst c1434d68
......@@ -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
......
......@@ -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") {
......
......@@ -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"
......
......@@ -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") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment