diff options
author | Eric Liu <ioeric@google.com> | 2018-09-06 09:59:37 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2018-09-06 09:59:37 +0000 |
commit | d25f1214a8c952aa72a37a1bd9f2e68da2a792a0 (patch) | |
tree | 68096f95b389717ee59e50c267e9141ee2606147 /clang-tools-extra/clangd/CodeComplete.cpp | |
parent | 236f6feb8f931e7bd45304e35ec775d4b5da64a6 (diff) | |
download | bcm5719-llvm-d25f1214a8c952aa72a37a1bd9f2e68da2a792a0.tar.gz bcm5719-llvm-d25f1214a8c952aa72a37a1bd9f2e68da2a792a0.zip |
[clangd] Set SymbolID for sema macros so that they can be merged with index macros.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D51688
llvm-svn: 341534
Diffstat (limited to 'clang-tools-extra/clangd/CodeComplete.cpp')
-rw-r--r-- | clang-tools-extra/clangd/CodeComplete.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp index 73357d8db4c..19ebd30272f 100644 --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -505,14 +505,15 @@ private: }; // Determine the symbol ID for a Sema code completion result, if possible. -llvm::Optional<SymbolID> getSymbolID(const CodeCompletionResult &R) { +llvm::Optional<SymbolID> getSymbolID(const CodeCompletionResult &R, + const SourceManager &SM) { switch (R.Kind) { case CodeCompletionResult::RK_Declaration: case CodeCompletionResult::RK_Pattern: { return clang::clangd::getSymbolID(R.Declaration); } case CodeCompletionResult::RK_Macro: - // FIXME: Macros do have USRs, but the CCR doesn't contain enough info. + return clang::clangd::getSymbolID(*R.Macro, R.MacroDefInfo, SM); case CodeCompletionResult::RK_Keyword: return None; } @@ -1435,7 +1436,8 @@ private: llvm::DenseSet<const Symbol *> UsedIndexResults; auto CorrespondingIndexResult = [&](const CodeCompletionResult &SemaResult) -> const Symbol * { - if (auto SymID = getSymbolID(SemaResult)) { + if (auto SymID = + getSymbolID(SemaResult, Recorder->CCSema->getSourceManager())) { auto I = IndexResults.find(*SymID); if (I != IndexResults.end()) { UsedIndexResults.insert(&*I); |