summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseCXXInlineMethods.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-04-10 07:37:23 +0000
committerJohn McCall <rjmccall@apple.com>2010-04-10 07:37:23 +0000
commitbb7b658ab5d0e46a7a5af11bfdba8cac80173307 (patch)
treeb4315412eff1b7650fc0c4e009a1406ee9988be9 /clang/lib/Parse/ParseCXXInlineMethods.cpp
parentd394aec87d92085ca145e0b12ccc7927d8bb7231 (diff)
downloadbcm5719-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/ParseCXXInlineMethods.cpp')
-rw-r--r--clang/lib/Parse/ParseCXXInlineMethods.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp
index 87e22fa9dce..5b5452402b3 100644
--- a/clang/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp
@@ -217,12 +217,17 @@ void Parser::ParseLexedMethodDefs(ParsingClass &Class) {
"ParseFunctionTryBlock left tokens in the token stream!");
continue;
}
- if (Tok.is(tok::colon))
+ if (Tok.is(tok::colon)) {
ParseConstructorInitializer(LM.D);
- else
+
+ // Error recovery.
+ if (!Tok.is(tok::l_brace)) {
+ Actions.ActOnFinishFunctionBody(LM.D, Action::StmtArg(Actions));
+ continue;
+ }
+ } else
Actions.ActOnDefaultCtorInitializers(LM.D);
- // FIXME: What if ParseConstructorInitializer doesn't leave us with a '{'??
ParseFunctionStatementBody(LM.D);
assert(!PP.getSourceManager().isBeforeInTranslationUnit(origLoc,
Tok.getLocation()) &&
OpenPOWER on IntegriCloud