[cfe-commits] r59710 - in /cfe/trunk/lib/Sema: Sema.cpp Sema.h SemaDecl.cpp

Chris Lattner sabre at nondot.org
Wed Nov 19 21:45:14 PST 2008


Author: lattner
Date: Wed Nov 19 23:45:14 2008
New Revision: 59710

URL: http://llvm.org/viewvc/llvm-project?rev=59710&view=rev
Log:
compared to the rest of the code in Sema::GetStdNamespace(),
looking up the "std" identifier is trivial.  Just do it, particularly
since this is only done if the namespace hasn't already been looked up.

Modified:
    cfe/trunk/lib/Sema/Sema.cpp
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=59710&r1=59709&r2=59710&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Wed Nov 19 23:45:14 2008
@@ -103,7 +103,6 @@
   KnownFunctionIDs[id_vsnprintf_chk] = &IT.get("__builtin___vsnprintf_chk");
   KnownFunctionIDs[id_vprintf]       = &IT.get("vprintf");
 
-  Ident_StdNs = &IT.get("std");
   Ident_TypeInfo = 0;
   StdNamespace = 0;
 

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=59710&r1=59709&r2=59710&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Wed Nov 19 23:45:14 2008
@@ -193,7 +193,6 @@
   IdentifierInfo* KnownFunctionIDs[id_num_known_functions];
 
   /// Identifiers used by the C++ language
-  IdentifierInfo *Ident_StdNs; // "std"
   IdentifierInfo *Ident_TypeInfo; // "type_info" - lazily created
 
   /// Translation Unit Scope - useful to Objective-C actions that need

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=59710&r1=59709&r2=59710&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Nov 19 23:45:14 2008
@@ -278,8 +278,9 @@
 /// everything from the standard library is defined.
 NamespaceDecl *Sema::GetStdNamespace() {
   if (!StdNamespace) {
+    IdentifierInfo *StdIdent = &PP.getIdentifierTable().get("std");
     DeclContext *Global = Context.getTranslationUnitDecl();
-    Decl *Std = LookupDecl(Ident_StdNs, Decl::IDNS_Tag | Decl::IDNS_Ordinary,
+    Decl *Std = LookupDecl(StdIdent, Decl::IDNS_Tag | Decl::IDNS_Ordinary,
                            0, Global, /*enableLazyBuiltinCreation=*/false);
     StdNamespace = dyn_cast_or_null<NamespaceDecl>(Std);
   }





More information about the cfe-commits mailing list