]> granicus.if.org Git - clang/commitdiff
Include struct context info for parser/sema crashes. This
authorChris Lattner <sabre@nondot.org>
Thu, 5 Mar 2009 02:25:03 +0000 (02:25 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 5 Mar 2009 02:25:03 +0000 (02:25 +0000)
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

lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp

index b24b80eb7114a296671d4638c6f8588944f5771c..6e0ffe5e2b68858daf5fa4d9874979c3b6e52127 100644 (file)
@@ -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);
index 7f0aa8f32795f2b89048af5918cea17a4da82e95..538185abc4e78ec5d37ade1c10215ad445826b04 100644 (file)
@@ -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.