Skip to content
Commit 23c12ca9 authored by Greg Clayton's avatar Greg Clayton
Browse files

Make sure that we succeed in starting a definition before we complete it and...

Make sure that we succeed in starting a definition before we complete it and emit an error if we fail to start the definition.

ClangASTContext::StartTagDeclarationDefinition(...) was starting definitions for any TagType instances that have TagDecl, but ClangASTContext::CompleteTagDeclarationDefinition(...) was getting the type to a CXXRecordDecl with:

    clang::CXXRecordDecl *cxx_record_decl = qual_type->getAsCXXRecordDecl();
    
The problem is that getAsCXXRecordDecl() might dig a bit deeper into a type and dig out a different decl, which means we might call ClangASTContext::StartTagDeclarationDefinition(...), but it might not do anything, and then we might call ClangASTContext::CompleteTagDeclarationDefinition(...) and it might try to complete something that didn't have its definition started and this will crash.

This change fixes that, and also makes sure that starting a definition succeeds before any calls to ClangASTContext::CompleteTagDeclarationDefinition().
                                                    
<rdar://problem/24091798>

llvm-svn: 270891
parent 7ba9baef
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment