]> granicus.if.org Git - clang/commitdiff
The mysterious bug turns out to be an incredibly bone-headed mistake.
authorSebastian Redl <sebastian.redl@getdesigned.at>
Sun, 26 Apr 2009 21:08:36 +0000 (21:08 +0000)
committerSebastian Redl <sebastian.redl@getdesigned.at>
Sun, 26 Apr 2009 21:08:36 +0000 (21:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70160 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseCXXInlineMethods.cpp
lib/Parse/ParseStmt.cpp
test/Parser/cxx-try.cpp

index a2f93b46cabd40ba1feca1c7b54607c5530101fa..525b088714d19707f628b75d9f07c02e3416f59f 100644 (file)
@@ -145,7 +145,7 @@ void Parser::ParseLexedMethodDefs() {
 
     if (Tok.is(tok::kw_try)) {
       ParseFunctionTryBlock(LM.D);
-      return;
+      continue;
     }
     if (Tok.is(tok::colon))
       ParseConstructorInitializer(LM.D);
index ce88728736012995905186b23c93bfbb281b3cad..35348d585204c5d3abed32f54da392321ec6d29e 100644 (file)
@@ -1324,11 +1324,12 @@ Parser::DeclPtrTy Parser::ParseFunctionTryBlock(DeclPtrTy Decl) {
   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));
index 8deed35559ce4dfba6f2814db2b6b0762ecb4cad..535f40d7805720a3cf7cb2b9276e58398c7b20e8 100644 (file)
@@ -30,14 +30,11 @@ void h() try {
 
 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 ','}}