forked from OSchip/llvm-project
[libclang] Make sure we don't try to handle a CXCursor_NoDeclFound
passed to clang_findReferencesInFile. llvm-svn: 146211
This commit is contained in:
parent
c5dbeeadc1
commit
fa469d0efd
|
@ -344,6 +344,11 @@ void clang_findReferencesInFile(CXCursor cursor, CXFile file,
|
|||
llvm::errs() << "clang_findReferencesInFile: Null cursor\n";
|
||||
return;
|
||||
}
|
||||
if (cursor.kind == CXCursor_NoDeclFound) {
|
||||
if (Logging)
|
||||
llvm::errs() << "clang_findReferencesInFile: Got CXCursor_NoDeclFound\n";
|
||||
return;
|
||||
}
|
||||
if (!file) {
|
||||
if (Logging)
|
||||
llvm::errs() << "clang_findReferencesInFile: Null file\n";
|
||||
|
|
|
@ -746,8 +746,10 @@ ASTContext &cxcursor::getCursorContext(CXCursor Cursor) {
|
|||
}
|
||||
|
||||
ASTUnit *cxcursor::getCursorASTUnit(CXCursor Cursor) {
|
||||
return static_cast<ASTUnit *>(static_cast<CXTranslationUnit>(Cursor.data[2])
|
||||
->TUData);
|
||||
CXTranslationUnit TU = static_cast<CXTranslationUnit>(Cursor.data[2]);
|
||||
if (!TU)
|
||||
return 0;
|
||||
return static_cast<ASTUnit *>(TU->TUData);
|
||||
}
|
||||
|
||||
CXTranslationUnit cxcursor::getCursorTU(CXCursor Cursor) {
|
||||
|
|
Loading…
Reference in New Issue