[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:
parent
69987d5415
commit
fbd7c2d3b2
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue