From: Chris Lattner Date: Thu, 5 Mar 2009 02:25:03 +0000 (+0000) Subject: Include struct context info for parser/sema crashes. This X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27b7f1028255149978356f85c4825522d234a253;p=clang Include struct context info for parser/sema crashes. This gives us: Stack dump: 0. using-directive.cpp:26:16: in compound statement ('{}') 1. using-directive.cpp:26:16: parsing function body 'A::K1::foo' 2. using-directive.cpp:25:3: parsing struct/union/class body 'A::K1' 3. using-directive.cpp:5:1: parsing namespace 'A' 4. clang using-directive.cpp Abort for code like: namespace A { ... class K1 { void foo() { <> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66124 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index b24b80eb71..6e0ffe5e2b 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -1096,6 +1096,10 @@ ParseStructDeclaration(DeclSpec &DS, /// void Parser::ParseStructUnionBody(SourceLocation RecordLoc, unsigned TagType, DeclTy *TagDecl) { + PrettyStackTraceDecl CrashInfo(TagDecl, RecordLoc, Actions, + PP.getSourceManager(), + "parsing struct/union body"); + SourceLocation LBraceLoc = ConsumeBrace(); ParseScope StructScope(this, Scope::ClassScope|Scope::DeclScope); diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 7f0aa8f327..538185abc4 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -793,6 +793,10 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, TagType == DeclSpec::TST_union || TagType == DeclSpec::TST_class) && "Invalid TagType!"); + PrettyStackTraceDecl CrashInfo(TagDecl, RecordLoc, Actions, + PP.getSourceManager(), + "parsing struct/union/class body"); + SourceLocation LBraceLoc = ConsumeBrace(); if (!CurScope->isClassScope() && // Not about to define a nested class.