summaryrefslogtreecommitdiffstats
path: root/tools/libclang/CIndexCodeCompletion.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2014-02-11 14:34:14 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2014-02-11 14:34:14 +0000
commitf9db0e03400cc37d75790e6e4ab4b5fefd10d7ce (patch)
tree062457486aa1da6faa9f4da280e9071706557229 /tools/libclang/CIndexCodeCompletion.cpp
parent8d47c722dfe23bb270fe25f79b93f24ccc03e25a (diff)
libclang: audit all APIs that accept a CXTranslationUnit to make sure that
checks for invalid translation unit are in place. Also, while there, add log output for this case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201155 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndexCodeCompletion.cpp')
-rw-r--r--tools/libclang/CIndexCodeCompletion.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp
index 04adb59049..0a978566f9 100644
--- a/tools/libclang/CIndexCodeCompletion.cpp
+++ b/tools/libclang/CIndexCodeCompletion.cpp
@@ -680,7 +680,12 @@ void clang_codeCompleteAt_Impl(void *UserData) {
#endif
bool EnableLogging = getenv("LIBCLANG_CODE_COMPLETION_LOGGING") != 0;
-
+
+ if (cxtu::isNotUseableTU(TU)) {
+ LOG_BAD_TU(TU);
+ return;
+ }
+
ASTUnit *AST = cxtu::getASTUnit(TU);
if (!AST)
return;