summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/CodeComplete.cpp
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2018-02-09 13:51:57 +0000
committerIlya Biryukov <ibiryukov@google.com>2018-02-09 13:51:57 +0000
commitb6ad25cd4ce8df28a8c0f86386f6e60e44ea5d1c (patch)
tree4855af1a4e8856f199c69823e14f580bcbffedef /clang-tools-extra/clangd/CodeComplete.cpp
parent0c21abd429ce9e8b0f39cb411df20d5986eb5b03 (diff)
downloadbcm5719-llvm-b6ad25cd4ce8df28a8c0f86386f6e60e44ea5d1c.tar.gz
bcm5719-llvm-b6ad25cd4ce8df28a8c0f86386f6e60e44ea5d1c.zip
[clangd] Fix crash when CompilerInvocation can't be created.
Summary: This can happen if the CompileCommand provided by compilation database is malformed. Reviewers: hokein, ioeric, sammccall Reviewed By: sammccall Subscribers: klimek, jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D43122 llvm-svn: 324732
Diffstat (limited to 'clang-tools-extra/clangd/CodeComplete.cpp')
-rw-r--r--clang-tools-extra/clangd/CodeComplete.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index 498c6ca47ac..b418d2b7305 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -650,7 +650,10 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
CompilerInstance::createDiagnostics(new DiagnosticOptions,
&DummyDiagsConsumer, false),
Input.VFS);
- assert(CI && "Couldn't create CompilerInvocation");
+ if (!CI) {
+ log("Couldn't create CompilerInvocation");;
+ return false;
+ }
CI->getFrontendOpts().DisableFree = false;
std::unique_ptr<llvm::MemoryBuffer> ContentsBuffer =
OpenPOWER on IntegriCloud