From: Richard Smith Date: Sat, 15 Oct 2011 04:21:46 +0000 (+0000) Subject: Refactor: remove redundant check for 'final' specifier when parsing class/struct... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8b11b5e6ce086fcaa7344bf84cffefcf4b53f9f6;p=clang Refactor: remove redundant check for 'final' specifier when parsing class/struct definition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142054 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index ceb988db9b..b9e2e9e701 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -2072,20 +2072,11 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, // 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(); + assert(isCXX0XFinalKeyword() && "not a class definition"); + FinalLoc = ConsumeToken(); - if (!getLang().CPlusPlus0x) - Diag(FinalLoc, diag::ext_override_control_keyword) << "final"; - } + if (!getLang().CPlusPlus0x) + Diag(FinalLoc, diag::ext_override_control_keyword) << "final"; } if (Tok.is(tok::colon)) {