[llvm-branch-commits] [clang-tools-extra] 0999408 - [clangd] Add error handling (elog) in code completion.

Adam Czachorowski via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Dec 28 06:27:43 PST 2020


Author: Adam Czachorowski
Date: 2020-12-28T15:22:54+01:00
New Revision: 0999408aea79dd69f182cfcb618006f6cf2b6d4e

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

LOG: [clangd] Add error handling (elog) in code completion.

Differential Revision: https://reviews.llvm.org/D93220

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 cc6b5dbc9904..ebdbd56c286a 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -182,12 +182,18 @@ struct CompletionCandidate {
     // strings (literal or URI) mapping to the same file. We still want to
     // bundle those, so we must resolve the header to be included here.
     std::string HeaderForHash;
-    if (Inserter)
-      if (auto Header = headerToInsertIfAllowed(Opts))
-        if (auto HeaderFile = toHeaderFile(*Header, FileName))
+    if (Inserter) {
+      if (auto Header = headerToInsertIfAllowed(Opts)) {
+        if (auto HeaderFile = toHeaderFile(*Header, FileName)) {
           if (auto Spelled =
                   Inserter->calculateIncludePath(*HeaderFile, FileName))
             HeaderForHash = *Spelled;
+        } else {
+          vlog("Code completion header path manipulation failed {0}",
+               HeaderFile.takeError());
+        }
+      }
+    }
 
     llvm::SmallString<256> Scratch;
     if (IndexResult) {


        


More information about the llvm-branch-commits mailing list