[llvm-branch-commits] [clang-tools-extra] c909512 - [clangd] Cleanup a remaining Optional<SymbolID> usage, NFC.

Haojian Wu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 8 04:51:09 PST 2021


Author: Haojian Wu
Date: 2021-01-08T13:44:20+01:00
New Revision: c909512fdb9ed63081b0578410430117811b86e8

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

LOG: [clangd] Cleanup a remaining Optional<SymbolID> usage, NFC.

Added: 
    

Modified: 
    clang-tools-extra/clangd/CodeComplete.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index ebdbd56c286a..1a8474f6c53d 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -828,9 +828,9 @@ struct CompletionRecorder : public CodeCompleteConsumer {
 };
 
 struct ScoredSignature {
-  // When set, requires documentation to be requested from the index with this
-  // ID.
-  llvm::Optional<SymbolID> IDForDoc;
+  // When not null, requires documentation to be requested from the index with
+  // this ID.
+  SymbolID IDForDoc;
   SignatureInformation Signature;
   SignatureQualitySignals Quality;
 };
@@ -894,7 +894,7 @@ class SignatureHelpCollector final : public CodeCompleteConsumer {
       for (const auto &S : ScoredSignatures) {
         if (!S.IDForDoc)
           continue;
-        IndexRequest.IDs.insert(*S.IDForDoc);
+        IndexRequest.IDs.insert(S.IDForDoc);
       }
       Index->lookup(IndexRequest, [&](const Symbol &S) {
         if (!S.Documentation.empty())
@@ -939,7 +939,7 @@ class SignatureHelpCollector final : public CodeCompleteConsumer {
 
     for (auto &SS : ScoredSignatures) {
       auto IndexDocIt =
-          SS.IDForDoc ? FetchedDocs.find(*SS.IDForDoc) : FetchedDocs.end();
+          SS.IDForDoc ? FetchedDocs.find(SS.IDForDoc) : FetchedDocs.end();
       if (IndexDocIt != FetchedDocs.end())
         SS.Signature.documentation = IndexDocIt->second;
 


        


More information about the llvm-branch-commits mailing list