aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-04-26 21:08:36 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-04-26 21:08:36 +0000
commitde1b60a9868f80f0872ed05d78df3b40a10ba5ca (patch)
treec2c08ef516f19e1833eb717cb80a424f7e3fad6c
parentb9fa917e90d5d70d2d84c8cb7e7470b3828f957d (diff)
The mysterious bug turns out to be an incredibly bone-headed mistake.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70160 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseCXXInlineMethods.cpp2
-rw-r--r--lib/Parse/ParseStmt.cpp3
-rw-r--r--test/Parser/cxx-try.cpp5
3 files changed, 4 insertions, 6 deletions
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp
index a2f93b46ca..525b088714 100644
--- a/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/lib/Parse/ParseCXXInlineMethods.cpp
@@ -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);
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index ce88728736..35348d5852 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -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));
diff --git a/test/Parser/cxx-try.cpp b/test/Parser/cxx-try.cpp
index 8deed35559..535f40d780 100644
--- a/test/Parser/cxx-try.cpp
+++ b/test/Parser/cxx-try.cpp
@@ -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 ','}}