diff --git a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp --- a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp +++ b/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; }