diff options
author | John McCall <rjmccall@apple.com> | 2010-04-10 07:37:23 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-04-10 07:37:23 +0000 |
commit | bb7b658ab5d0e46a7a5af11bfdba8cac80173307 (patch) | |
tree | b4315412eff1b7650fc0c4e009a1406ee9988be9 /clang/lib/Parse/Parser.cpp | |
parent | d394aec87d92085ca145e0b12ccc7927d8bb7231 (diff) | |
download | bcm5719-llvm-bb7b658ab5d0e46a7a5af11bfdba8cac80173307.tar.gz bcm5719-llvm-bb7b658ab5d0e46a7a5af11bfdba8cac80173307.zip |
Diagnose misordered initializers in constructor templates immediately instead of
when they're instantiated. Merge the note into the -Wreorder warning; it
doesn't really contribute much, and it was splitting a thought across diagnostics
anyway. Don't crash in the parser when a constructor's initializers end in a
comma and there's no body; the recovery here is still terrible, but anything's
better than a crash.
llvm-svn: 100922
Diffstat (limited to 'clang/lib/Parse/Parser.cpp')
-rw-r--r-- | clang/lib/Parse/Parser.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 5c31c1d9a3d..6dbb99e395f 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -668,9 +668,15 @@ Parser::DeclPtrTy Parser::ParseFunctionDefinition(ParsingDeclarator &D, // If we have a colon, then we're probably parsing a C++ // ctor-initializer. - if (Tok.is(tok::colon)) + if (Tok.is(tok::colon)) { ParseConstructorInitializer(Res); - else + + // Recover from error. + if (!Tok.is(tok::l_brace)) { + Actions.ActOnFinishFunctionBody(Res, Action::StmtArg(Actions)); + return Res; + } + } else Actions.ActOnDefaultCtorInitializers(Res); return ParseFunctionStatementBody(Res); |