[clang-tools-extra] 95fbd8d - [clangd] Don't ignore external HFI in `SymbolCollector` (#88446)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 11 15:22:38 PDT 2024


Author: Jan Svoboda
Date: 2024-04-11T15:22:35-07:00
New Revision: 95fbd8d19dff10b5a734e3db1b29cba2da7a983f

URL: https://github.com/llvm/llvm-project/commit/95fbd8d19dff10b5a734e3db1b29cba2da7a983f
DIFF: https://github.com/llvm/llvm-project/commit/95fbd8d19dff10b5a734e3db1b29cba2da7a983f.diff

LOG: [clangd] Don't ignore external HFI in `SymbolCollector` (#88446)

The `FileEntry` corresponds to a `FileID` containing the
`SourceLocation` of a `NamedDecl` which (I think) might've been
deserialized from a PCM file. Considering external `HeaderFileInfo` here
is most likely the right thing to do here in order to get the correct
spelling in case the current compiler instance has not register this
file as a header yet.

Added: 
    

Modified: 
    clang-tools-extra/clangd/index/SymbolCollector.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp
index 969f27af6fb1d8..5c4e2150cf3123 100644
--- a/clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -409,7 +409,7 @@ class SymbolCollector::HeaderFileURICache {
     // Framework headers are spelled as <FrameworkName/Foo.h>, not
     // "path/FrameworkName.framework/Headers/Foo.h".
     auto &HS = PP->getHeaderSearchInfo();
-    if (const auto *HFI = HS.getExistingLocalFileInfo(*FE))
+    if (const auto *HFI = HS.getExistingFileInfo(*FE))
       if (!HFI->Framework.empty())
         if (auto Spelling =
                 getFrameworkHeaderIncludeSpelling(*FE, HFI->Framework, HS))


        


More information about the cfe-commits mailing list