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() { <<crash>>
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 b24b80e..6e0ffe5 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -1096,6 +1096,10 @@
///
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 7f0aa8f..538185a 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -793,6 +793,10 @@
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.