[cfe-commits] r70160 - in /cfe/trunk: lib/Parse/ParseCXXInlineMethods.cpp lib/Parse/ParseStmt.cpp test/Parser/cxx-try.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Sun Apr 26 14:08:36 PDT 2009


Author: cornedbee
Date: Sun Apr 26 16:08:36 2009
New Revision: 70160

URL: http://llvm.org/viewvc/llvm-project?rev=70160&view=rev
Log:
The mysterious bug turns out to be an incredibly bone-headed mistake.

Modified:
    cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
    cfe/trunk/lib/Parse/ParseStmt.cpp
    cfe/trunk/test/Parser/cxx-try.cpp

Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=70160&r1=70159&r2=70160&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Sun Apr 26 16:08:36 2009
@@ -145,7 +145,7 @@
 
     if (Tok.is(tok::kw_try)) {
       ParseFunctionTryBlock(LM.D);
-      return;
+      continue;
     }
     if (Tok.is(tok::colon))
       ParseConstructorInitializer(LM.D);

Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=70160&r1=70159&r2=70160&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Sun Apr 26 16:08:36 2009
@@ -1324,11 +1324,12 @@
   if (Tok.is(tok::colon))
     ParseConstructorInitializer(Decl);
 
+  SourceLocation LBraceLoc = Tok.getLocation();
   OwningStmtResult FnBody(ParseCXXTryBlockCommon(TryLoc));
   // If we failed to parse the try-catch, we just give the function an empty
   // compound statement as the body.
   if (FnBody.isInvalid())
-    FnBody = Actions.ActOnCompoundStmt(TryLoc, TryLoc,
+    FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc,
                                        MultiStmtArg(Actions), false);
 
   return Actions.ActOnFinishFunctionBody(Decl, move(FnBody));

Modified: cfe/trunk/test/Parser/cxx-try.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-try.cpp?rev=70160&r1=70159&r2=70160&view=diff

==============================================================================
--- cfe/trunk/test/Parser/cxx-try.cpp (original)
+++ cfe/trunk/test/Parser/cxx-try.cpp Sun Apr 26 16:08:36 2009
@@ -30,14 +30,11 @@
 
 struct A {
   int i;
-  A(float) : i(0) try {} // expected-error {{expected '{' or ','}}
   A(int);
   A(char);
-  // FIXME: There's something very strange going on here. After the first
-  // inline function-try-block, subsequent inline bodies aren't parsed anymore.
-  // Valgrind is silent, though, and I can't even debug this properly.
   A() try : i(0) {} catch(...) {}
   void f() try {} catch(...) {}
+  A(float) : i(0) try {} // expected-error {{expected '{' or ','}}
 };
 
 A::A(char) : i(0) try {} // expected-error {{expected '{' or ','}}





More information about the cfe-commits mailing list