summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-03-25 14:46:08 +0000
committerAnders Carlsson <andersca@mac.com>2011-03-25 14:46:08 +0000
commitf9eb63beb772809d990d1f9707ae3138bfcaf2f2 (patch)
tree76bca7309bcb2921b34b4bb4b2f9f030e1386132
parent30f29444c0af378a943e5ca59bd511237338aadd (diff)
downloadbcm5719-llvm-f9eb63beb772809d990d1f9707ae3138bfcaf2f2.tar.gz
bcm5719-llvm-f9eb63beb772809d990d1f9707ae3138bfcaf2f2.zip
Replace the call to ParseOptionalCXX0XClassVirtSpecifierSeq with code to only parse an optional 'final' keyword.
llvm-svn: 128278
-rw-r--r--clang/lib/Parse/ParseDeclCXX.cpp23
-rw-r--r--clang/test/CXX/class/p1-0x.cpp4
2 files changed, 18 insertions, 9 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 988ac842235..05253f6734c 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -1758,8 +1758,24 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
if (TagDecl)
Actions.ActOnTagStartDefinition(getCurScope(), TagDecl);
- ClassVirtSpecifiers CVS;
- ParseOptionalCXX0XClassVirtSpecifierSeq(CVS);
+ SourceLocation FinalLoc;
+
+ // Parse the optional 'final' keyword.
+ if (getLang().CPlusPlus && Tok.is(tok::identifier)) {
+ IdentifierInfo *II = Tok.getIdentifierInfo();
+
+ // Initialize the contextual keywords.
+ if (!Ident_final) {
+ Ident_final = &PP.getIdentifierTable().get("final");
+ Ident_override = &PP.getIdentifierTable().get("override");
+ }
+
+ if (II == Ident_final)
+ FinalLoc = ConsumeToken();
+
+ if (!getLang().CPlusPlus0x)
+ Diag(FinalLoc, diag::ext_override_control_keyword) << "final";
+ }
if (Tok.is(tok::colon)) {
ParseBaseClause(TagDecl);
@@ -1777,9 +1793,6 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
SourceLocation LBraceLoc = ConsumeBrace();
- SourceLocation FinalLoc =
- CVS.isFinalSpecified() ? CVS.getFinalLoc() : SourceLocation();
-
if (TagDecl)
Actions.ActOnStartCXXMemberDeclarations(getCurScope(), TagDecl, FinalLoc,
LBraceLoc);
diff --git a/clang/test/CXX/class/p1-0x.cpp b/clang/test/CXX/class/p1-0x.cpp
index 5851de6cc39..e677dec4caf 100644
--- a/clang/test/CXX/class/p1-0x.cpp
+++ b/clang/test/CXX/class/p1-0x.cpp
@@ -2,9 +2,5 @@
namespace Test1 {
class A final { };
-class B explicit { };
-class C final explicit { };
-class D final final { }; // expected-error {{class already marked 'final'}}
-class E explicit explicit { }; // expected-error {{class already marked 'explicit'}}
}
OpenPOWER on IntegriCloud