[PATCH] D123031: [clangd] Use consistent header paths in CanonicalIncludes mappings
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 4 07:24:09 PDT 2022
kbobyrev updated this revision to Diff 420175.
kbobyrev added a comment.
Fix the behavior: get Real Path instead.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123031/new/
https://reviews.llvm.org/D123031
Files:
clang-tools-extra/clangd/index/CanonicalIncludes.cpp
Index: clang-tools-extra/clangd/index/CanonicalIncludes.cpp
===================================================================
--- clang-tools-extra/clangd/index/CanonicalIncludes.cpp
+++ clang-tools-extra/clangd/index/CanonicalIncludes.cpp
@@ -68,9 +68,12 @@
return false;
// FIXME(ioeric): resolve the header and store actual file path. For now,
// we simply assume the written header is suitable to be #included.
- Includes->addMapping(PP.getSourceManager().getFilename(Range.getBegin()),
- isLiteralInclude(Text) ? Text.str()
- : ("\"" + Text + "\"").str());
+ auto &SM = PP.getSourceManager();
+ auto Filename = SM.getFileEntryForID(SM.getFileID(Range.getBegin()))
+ ->tryGetRealPathName();
+ Includes->addMapping(Filename, isLiteralInclude(Text)
+ ? Text.str()
+ : ("\"" + Text + "\"").str());
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123031.420175.patch
Type: text/x-patch
Size: 1054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220404/4ee1d033/attachment-0001.bin>
More information about the cfe-commits
mailing list