[cfe-commits] r39089 - in /cfe/cfe/trunk: Lex/HeaderSearch.cpp include/clang/Lex/HeaderSearch.h

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:27:26 PDT 2007


Author: sabre
Date: Wed Jul 11 11:27:26 2007
New Revision: 39089

URL: http://llvm.org/viewvc/llvm-project?rev=39089&view=rev
Log:
Change framework cache map from map to CStringMap.  This speeds up PP user
time on Cocoa.h from 0.078 to 0.077s.

Modified:
    cfe/cfe/trunk/Lex/HeaderSearch.cpp
    cfe/cfe/trunk/include/clang/Lex/HeaderSearch.h

Modified: cfe/cfe/trunk/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/HeaderSearch.cpp?rev=39089&r1=39088&r2=39089&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/HeaderSearch.cpp (original)
+++ cfe/cfe/trunk/Lex/HeaderSearch.cpp Wed Jul 11 11:27:26 2007
@@ -62,7 +62,7 @@
   if (SlashPos == std::string::npos) return 0;
   
   const DirectoryEntry *&CacheLookup =
-    FrameworkMap[std::string(Filename.begin(), Filename.begin()+SlashPos)];
+    FrameworkMap.GetOrCreateValue(&Filename[0], &Filename[0]+SlashPos);
   
   // If it is some other directory, fail.
   if (CacheLookup && CacheLookup != Dir)
@@ -220,7 +220,7 @@
   FrameworkName += ".framework/";
 
   const DirectoryEntry *&CacheLookup =
-    FrameworkMap[std::string(Filename.begin(), Filename.begin()+SlashPos)];
+    FrameworkMap.GetOrCreateValue(&Filename[0], &Filename[0]+SlashPos);
   
   // Some other location?
   if (CacheLookup && strcmp(CacheLookup->getName(), FrameworkName.c_str()) != 0)

Modified: cfe/cfe/trunk/include/clang/Lex/HeaderSearch.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=39089&r1=39088&r2=39089&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
+++ cfe/cfe/trunk/include/clang/Lex/HeaderSearch.h Wed Jul 11 11:27:26 2007
@@ -15,9 +15,9 @@
 #define LLVM_CLANG_LEX_HEADERSEARCH_H
 
 #include "clang/Lex/DirectoryLookup.h"
+#include "llvm/ADT/CStringMap.h"
 #include <vector>
 #include <string>
-#include <map>
 
 namespace llvm {
 namespace clang {
@@ -72,7 +72,7 @@
 
   /// FrameworkMap - This is a collection mapping a framework or subframework
   /// name like "Carbon" to the Carbon.framework directory.
-  std::map<std::string, const DirectoryEntry *> FrameworkMap;
+  CStringMap<const DirectoryEntry *> FrameworkMap;
 
   // Various statistics we track for performance analysis.
   unsigned NumIncluded;





More information about the cfe-commits mailing list