[cfe-commits] r128278 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/CXX/class/p1-0x.cpp
Anders Carlsson
andersca at mac.com
Fri Mar 25 07:46:08 PDT 2011
Author: andersca
Date: Fri Mar 25 09:46:08 2011
New Revision: 128278
URL: http://llvm.org/viewvc/llvm-project?rev=128278&view=rev
Log:
Replace the call to ParseOptionalCXX0XClassVirtSpecifierSeq with code to only parse an optional 'final' keyword.
Modified:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/CXX/class/p1-0x.cpp
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=128278&r1=128277&r2=128278&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri Mar 25 09:46:08 2011
@@ -1758,8 +1758,24 @@
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 @@
SourceLocation LBraceLoc = ConsumeBrace();
- SourceLocation FinalLoc =
- CVS.isFinalSpecified() ? CVS.getFinalLoc() : SourceLocation();
-
if (TagDecl)
Actions.ActOnStartCXXMemberDeclarations(getCurScope(), TagDecl, FinalLoc,
LBraceLoc);
Modified: cfe/trunk/test/CXX/class/p1-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/p1-0x.cpp?rev=128278&r1=128277&r2=128278&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class/p1-0x.cpp (original)
+++ cfe/trunk/test/CXX/class/p1-0x.cpp Fri Mar 25 09:46:08 2011
@@ -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'}}
}
More information about the cfe-commits
mailing list