The mysterious bug turns out to be an incredibly bone-headed mistake.

llvm-svn: 70160
This commit is contained in:
Sebastian Redl 2009-04-26 21:08:36 +00:00
parent 0d0d3e56dd
commit d98ecd615f
3 changed files with 4 additions and 6 deletions

View 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);

View 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));

View 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 ','}}