diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2010-04-08 16:38:48 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2010-04-08 16:38:48 +0000 |
commit | c76498d4095874895ae91dd404264f10549d94d8 (patch) | |
tree | b27b23c632ccf8497a20d2935d7ea14dafa2448d /clang/lib/Parse/ParseDecl.cpp | |
parent | af2a317e05a94b7277114dfef90446a5b1f91b56 (diff) | |
download | bcm5719-llvm-c76498d4095874895ae91dd404264f10549d94d8.tar.gz bcm5719-llvm-c76498d4095874895ae91dd404264f10549d94d8.zip |
Make CXXScopeSpec invalid when incomplete, and propagate that into any
Declarator that depends on it. This fixes several redundant errors and bad
recoveries.
llvm-svn: 100779
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 73a5704878e..da4a0028447 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -2583,20 +2583,18 @@ void Parser::ParseDirectDeclarator(Declarator &D) { if (getLang().CPlusPlus && D.mayHaveIdentifier()) { // ParseDeclaratorInternal might already have parsed the scope. - bool afterCXXScope = D.getCXXScopeSpec().isSet(); - if (!afterCXXScope) { + if (D.getCXXScopeSpec().isEmpty()) { ParseOptionalCXXScopeSpecifier(D.getCXXScopeSpec(), /*ObjectType=*/0, true); - afterCXXScope = D.getCXXScopeSpec().isSet(); } - if (afterCXXScope) { + if (D.getCXXScopeSpec().isValid()) { if (Actions.ShouldEnterDeclaratorScope(CurScope, D.getCXXScopeSpec())) // Change the declaration context for name lookup, until this function // is exited (and the declarator has been parsed). DeclScopeObj.EnterDeclaratorScope(); - } - + } + if (Tok.is(tok::identifier) || Tok.is(tok::kw_operator) || Tok.is(tok::annot_template_id) || Tok.is(tok::tilde)) { // We found something that indicates the start of an unqualified-id. @@ -2612,7 +2610,10 @@ void Parser::ParseDirectDeclarator(Declarator &D) { /*AllowDestructorName=*/true, AllowConstructorName, /*ObjectType=*/0, - D.getName())) { + D.getName()) || + // Once we're past the identifier, if the scope was bad, mark the + // whole declarator bad. + D.getCXXScopeSpec().isInvalid()) { D.SetIdentifier(0, Tok.getLocation()); D.setInvalidType(true); } else { |