[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.

llvm-svn: 172625
This commit is contained in:
Argyrios Kyrtzidis 2013-01-16 17:04:31 +00:00
parent 69987d5415
commit fbd7c2d3b2
1 changed files with 3 additions and 0 deletions

View File

@ -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();