Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clangd] Don't ignore external HFI in SymbolCollector #88446

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

jansvoboda11
Copy link
Contributor

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.

The `FileEntry` corresponds to a `FileID` containing the `SourceLocation` of a `NamedDecl` which (I think) might've been deserialized from a PCM file. Including external HeaderFileInfo here is most likely the right thing to do here in order to get the correct spelling.
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 11, 2024

@llvm/pr-subscribers-clangd

@llvm/pr-subscribers-clang-tools-extra

Author: Jan Svoboda (jansvoboda11)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/88446.diff

1 Files Affected:

  • (modified) clang-tools-extra/clangd/index/SymbolCollector.cpp (+1-1)
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))

@jansvoboda11 jansvoboda11 merged commit 95fbd8d into llvm:main Apr 11, 2024
6 of 7 checks passed
@jansvoboda11 jansvoboda11 deleted the symbol-collector-external-hfi branch April 11, 2024 22:22
jansvoboda11 added a commit to apple/llvm-project that referenced this pull request Apr 12, 2024
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.

(cherry picked from commit 95fbd8d)
artemcm pushed a commit to apple/llvm-project that referenced this pull request Apr 16, 2024
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.

(cherry picked from commit 95fbd8d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants