From f7859e52829a44e04692653079aea3a5df4579da Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Sun, 23 Mar 2014 15:31:04 +0100 Subject: fix filename detection in clang plugins SourceManager::getFilename() returns "" whenever icecream is used. Change-Id: I4e3e1b90880c5fd2b53f20e4ce3e38e3a0486973 --- compilerplugins/clang/literaltoboolconversion.cxx | 4 ++-- compilerplugins/clang/store/referencecasting.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'compilerplugins/clang') diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx index 5c87f474ec23..c94e0d1b014b 100644 --- a/compilerplugins/clang/literaltoboolconversion.cxx +++ b/compilerplugins/clang/literaltoboolconversion.cxx @@ -160,8 +160,8 @@ bool LiteralToBoolConversion::isFromCIncludeFile( return false; } #endif - return compiler.getSourceManager().getFilename(spellingLocation).endswith( - ".h"); + return StringRef(compiler.getSourceManager().getPresumedLoc(spellingLocation) + .getFilename()).endswith(".h"); } bool LiteralToBoolConversion::isMacroBodyExpansion(SourceLocation location) diff --git a/compilerplugins/clang/store/referencecasting.cxx b/compilerplugins/clang/store/referencecasting.cxx index 113002cf22eb..e6a1391c9040 100644 --- a/compilerplugins/clang/store/referencecasting.cxx +++ b/compilerplugins/clang/store/referencecasting.cxx @@ -97,7 +97,7 @@ static const Type* extractTemplateType(Expr* cce); bool ReferenceCasting::VisitCXXConstructExpr( CXXConstructExpr* cce ) { // don't bother processing anything in the Reference.h file. Makes my life easier when debugging this. - if( compiler.getSourceManager().getFilename( cce->getSourceRange().getBegin() ).find( "Reference.h" ) != StringRef::npos ) + if( StringRef(compiler.getSourceManager().getPresumedLoc( cce->getSourceRange().getBegin() )).find( "Reference.h" ) != StringRef::npos ) return true; // look for calls to the Reference(x,UNO_something) constructor -- cgit