diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2014-03-23 15:31:04 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2014-03-23 16:26:53 +0100 |
commit | f7859e52829a44e04692653079aea3a5df4579da (patch) | |
tree | 8ca064ee56051b91a49f76a5b6d54027e80f5d39 | |
parent | 59698a4797101a286c177069c41d43762de6a4d5 (diff) |
fix filename detection in clang plugins
SourceManager::getFilename() returns "<stdin>" whenever icecream is used.
Change-Id: I4e3e1b90880c5fd2b53f20e4ce3e38e3a0486973
-rw-r--r-- | compilerplugins/clang/literaltoboolconversion.cxx | 4 | ||||
-rw-r--r-- | compilerplugins/clang/store/referencecasting.cxx | 2 |
2 files changed, 3 insertions, 3 deletions
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<T>(x,UNO_something) constructor |