[clangd] Consume error to avoid assertion failures
authorIlya Biryukov <ibiryukov@google.com>
Wed, 10 Jul 2019 09:18:09 +0000 (09:18 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Wed, 10 Jul 2019 09:18:09 +0000 (09:18 +0000)
When we fail to calculate #include insertion for a completion item.
Note that this change does not add a test, although that would be good.

llvm-svn: 365606

clang-tools-extra/clangd/CodeComplete.cpp

index dc82b5d..b2f537c 100644 (file)
@@ -346,8 +346,9 @@ struct CodeCompletionBuilder {
         Completion.Includes.push_back(std::move(Include));
       } else
         log("Failed to generate include insertion edits for adding header "
-            "(FileURI='{0}', IncludeHeader='{1}') into {2}",
-            C.IndexResult->CanonicalDeclaration.FileURI, Inc, FileName);
+            "(FileURI='{0}', IncludeHeader='{1}') into {2}: {3}",
+            C.IndexResult->CanonicalDeclaration.FileURI, Inc, FileName,
+            ToInclude.takeError());
     }
     // Prefer includes that do not need edits (i.e. already exist).
     std::stable_partition(Completion.Includes.begin(),