diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-10-06 20:44:39 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-10-07 15:21:50 +0200 |
commit | c8bf651fb9b97eca6af7d1d26c62681cc5c7ec0f (patch) | |
tree | 8c78c377aa4dc4876d5ee691772ff0342c36d4fe /compilerplugins/clang/singlevalfields.cxx | |
parent | dc8b44bd1d695eb8686fdddbbc7d70cd597fd78b (diff) |
do not use compiler.getSourceManager().getFilename()
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 <stdin>.
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 <l.lunak@collabora.com>
Diffstat (limited to 'compilerplugins/clang/singlevalfields.cxx')
-rw-r--r-- | compilerplugins/clang/singlevalfields.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compilerplugins/clang/singlevalfields.cxx b/compilerplugins/clang/singlevalfields.cxx index e1a159a8387e..52631dabaa10 100644 --- a/compilerplugins/clang/singlevalfields.cxx +++ b/compilerplugins/clang/singlevalfields.cxx @@ -154,7 +154,7 @@ void SingleValFields::niceName(const DeclaratorDecl* fieldOrVarDecl, MyFieldInfo aInfo.fieldType = fieldOrVarDecl->getType().getAsString(); SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( fieldOrVarDecl->getLocation() ); - StringRef name = compiler.getSourceManager().getFilename(expansionLoc); + StringRef name = getFileNameOfSpellingLoc(expansionLoc); aInfo.sourceLocation = std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc)); loplugin::normalizeDotDotInFilePath(aInfo.sourceLocation); } |