[cfe-commits] r123876 - in /cfe/trunk: include/clang/Parse/Parser.h lib/Parse/ParseDeclCXX.cpp lib/Parse/Parser.cpp
Anders Carlsson
andersca at mac.com
Wed Jan 19 19:47:08 PST 2011
Author: andersca
Date: Wed Jan 19 21:47:08 2011
New Revision: 123876
URL: http://llvm.org/viewvc/llvm-project?rev=123876&view=rev
Log:
Lazily initialize the 'final' and 'override' contextual keywords as suggested by Doug.
Modified:
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/lib/Parse/Parser.cpp
Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=123876&r1=123875&r2=123876&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Wed Jan 19 21:47:08 2011
@@ -113,8 +113,8 @@
IdentifierInfo *Ident_pixel;
/// C++0x contextual keywords.
- IdentifierInfo *Ident_final;
- IdentifierInfo *Ident_override;
+ mutable IdentifierInfo *Ident_final;
+ mutable IdentifierInfo *Ident_override;
llvm::OwningPtr<PragmaHandler> AlignHandler;
llvm::OwningPtr<PragmaHandler> GCCVisibilityHandler;
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=123876&r1=123875&r2=123876&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Wed Jan 19 21:47:08 2011
@@ -1275,6 +1275,12 @@
if (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_override)
return VirtSpecifiers::VS_Override;
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=123876&r1=123875&r2=123876&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Wed Jan 19 21:47:08 2011
@@ -387,11 +387,8 @@
ObjCTypeQuals[objc_byref] = &PP.getIdentifierTable().get("byref");
}
- // Initialize C++0x contextual keywords.
- if (getLang().CPlusPlus0x) {
- Ident_final = &PP.getIdentifierTable().get("final");
- Ident_override = &PP.getIdentifierTable().get("override");
- }
+ Ident_final = 0;
+ Ident_override = 0;
Ident_super = &PP.getIdentifierTable().get("super");
More information about the cfe-commits
mailing list