diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-16 17:04:31 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-16 17:04:31 +0000 |
commit | 93cf969df9afb22028aa8b4d575fa55681d1ec56 (patch) | |
tree | 7acb41ef7c03ec945b37602689311ba8e17800db | |
parent | 16618240a8a28d84de6d950f89145a78645e26e7 (diff) |
[libclang] In clang_getCursorType, don't crash if the translation unit is not
set on the cursor; return a null type in such a case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172625 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/libclang/CXType.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/libclang/CXType.cpp b/tools/libclang/CXType.cpp index 88c0e51181..d7751d2071 100644 --- a/tools/libclang/CXType.cpp +++ b/tools/libclang/CXType.cpp @@ -131,6 +131,9 @@ CXType clang_getCursorType(CXCursor C) { using namespace cxcursor; CXTranslationUnit TU = cxcursor::getCursorTU(C); + if (!TU) + return MakeCXType(QualType(), TU); + ASTContext &Context = static_cast<ASTUnit *>(TU->TUData)->getASTContext(); if (clang_isExpression(C.kind)) { QualType T = cxcursor::getCursorExpr(C)->getType(); |