From c8bf651fb9b97eca6af7d1d26c62681cc5c7ec0f Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Sun, 6 Oct 2019 20:44:39 +0200 Subject: do not use compiler.getSourceManager().getFilename() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a continuation of ff002524c12471668e63837a804b6006f9136a34. When compiling with icecream, its -frewrite-includes merges all #include's into one .cxx file and marks them with with line markers. But SourceManager::getFilename() doesn't take those into account and so it reports all of those as . So use getFileNameOfSpellingLoc(), which explicitly handles this case. And we should probably never ever use SourceManager::getFilename(). Change-Id: Ia194c2e041578e1e199aee2df2f885922ef7e31a Reviewed-on: https://gerrit.libreoffice.org/80326 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- compilerplugins/clang/virtualdown.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compilerplugins/clang/virtualdown.cxx') diff --git a/compilerplugins/clang/virtualdown.cxx b/compilerplugins/clang/virtualdown.cxx index 9e59c842f49f..48df7934bc04 100644 --- a/compilerplugins/clang/virtualdown.cxx +++ b/compilerplugins/clang/virtualdown.cxx @@ -204,7 +204,7 @@ std::string VirtualDown::niceName(const CXXMethodDecl* cxxMethodDecl) std::string VirtualDown::toString(SourceLocation loc) { SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc(loc); - StringRef name = compiler.getSourceManager().getFilename(expansionLoc); + StringRef name = getFileNameOfSpellingLoc(expansionLoc); std::string sourceLocation = std::string(name.substr(strlen(SRCDIR) + 1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc)); -- cgit