瀏覽代碼

ENH: change all maps of string to be maps of cmStdString, to reduce symbol length in object files.

Bill Hoffman 24 年之前
父節點
當前提交
ddd5a7d729

+ 1 - 1
Source/cmCableClassSet.h

@@ -90,7 +90,7 @@ public:
    * The set is stored internally as a map from class name to cmCableClass
    * instance.
    */
-  typedef std::map<std::string, cmCableClass*> CableClassMap;
+  typedef std::map<cmStdString, cmCableClass*> CableClassMap;
   
   void AddClass(const char*, cmCableClass*);
   void AddSource(const char* name);

+ 2 - 2
Source/cmCableWrapTclCommand.cxx

@@ -119,7 +119,7 @@ void cmCableWrapTclCommand::GenerateCableFiles() const
   // use the tags to make easy-to-read, unique file names for each
   // class's wrapper.  Count the number of times each tag is used.
   // Warn if a tag is used more than once.
-  std::map<std::string, unsigned int> tagCounts;
+  std::map<cmStdString, unsigned int> tagCounts;
   for(cmCableClassSet::CableClassMap::const_iterator
         c = m_CableClassSet->Begin(); c != m_CableClassSet->End(); ++c)
     {
@@ -146,7 +146,7 @@ void cmCableWrapTclCommand::GenerateCableFiles() const
   // Write out the cable configuration files with one class per group.
   // Try to name the groups based on their class's tag, but use an
   // index to disambiguate tag repeats (mostly used for empty tags).
-  std::map<std::string, unsigned int> tagIndexes;
+  std::map<cmStdString, unsigned int> tagIndexes;
   for(cmCableClassSet::CableClassMap::const_iterator
         c = m_CableClassSet->Begin(); c != m_CableClassSet->End(); ++c)
     {

+ 4 - 4
Source/cmCacheManager.cxx

@@ -239,7 +239,7 @@ void cmCacheManager::DefineCache(cmMakefile *mf)
     }
   
   // add definition to the makefile
-  for( std::map<std::string, CacheEntry>::const_iterator i = m_Cache.begin();
+  for( std::map<cmStdString, CacheEntry>::const_iterator i = m_Cache.begin();
        i != m_Cache.end(); ++i)
     {
     const CacheEntry& ce = (*i).second;
@@ -293,7 +293,7 @@ bool cmCacheManager::SaveCache(const char* path)
   fout << "########################\n";
   fout << "\n";
 
-  for( std::map<std::string, CacheEntry>::const_iterator i = m_Cache.begin();
+  for( std::map<cmStdString, CacheEntry>::const_iterator i = m_Cache.begin();
        i != m_Cache.end(); ++i)
     {
     const CacheEntry& ce = (*i).second; 
@@ -326,7 +326,7 @@ bool cmCacheManager::SaveCache(const char* path)
   fout << "########################\n";
   fout << "\n";
 
-  for( std::map<std::string, CacheEntry>::const_iterator i = m_Cache.begin();
+  for( std::map<cmStdString, CacheEntry>::const_iterator i = m_Cache.begin();
        i != m_Cache.end(); ++i)
     {
     const CacheEntry& ce = (*i).second;
@@ -423,7 +423,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
 {
   out << "=================================================" << std::endl;
   out << "CMakeCache Contents:" << std::endl;
-  for(std::map<std::string, CacheEntry>::const_iterator i = m_Cache.begin();
+  for(std::map<cmStdString, CacheEntry>::const_iterator i = m_Cache.begin();
       i != m_Cache.end(); ++i)
     {
     if((*i).second.m_Type != INTERNAL)

+ 1 - 1
Source/cmCacheManager.h

@@ -61,7 +61,7 @@ public:
     CacheEntryType m_Type;
   };
 public:
-  typedef  std::map<std::string, CacheEntry> CacheEntryMap;
+  typedef  std::map<cmStdString, CacheEntry> CacheEntryMap;
   /**
    * Types for the cache entries.  These are useful as
    * hints for a cache editor program.  Path should bring

+ 1 - 1
Source/cmMakeDepend.h

@@ -177,7 +177,7 @@ protected:
   cmRegularExpression m_IncludeFileRegularExpression;
   cmRegularExpression m_ComplainFileRegularExpression;
   std::vector<std::string> m_IncludeDirectories;
-  typedef std::map<std::string, cmDependInformation*> DependInformationMap;
+  typedef std::map<cmStdString, cmDependInformation*> DependInformationMap;
   DependInformationMap m_DependInformationMap;
 };
 

+ 8 - 7
Source/cmMakefile.h

@@ -397,7 +397,7 @@ public:
   /**
    * Get the subdirectory dependencies for the given subdirectory.
    */
-  const std::set<std::string>& GetSubdirDepends(const char* subdir)
+  const std::set<cmStdString>& GetSubdirDepends(const char* subdir)
     { 
     return m_SubdirDepends[subdir];
     }
@@ -425,7 +425,7 @@ public:
   /**
    * Return a list of source files in this makefile.
    */
-  typedef std::map<std::string,std::vector<cmSourceFile> > SourceMap;
+  typedef std::map<cmStdString,std::vector<cmSourceFile> > SourceMap;
   const SourceMap &GetSources() const {return  m_Sources;}
   SourceMap &GetSources() {return  m_Sources;}
   cmSourceFile *GetSource(const char *srclist, const char *sourceName);
@@ -552,10 +552,11 @@ protected:
   SourceMap m_Sources; 
 
   std::vector<std::string> m_SubDirectories; // list of sub directories
-  struct StringSet : public std::set<std::string>
+  struct StringSet : public std::set<cmStdString>
   {
   };
-  std::map<std::string, StringSet >  m_SubdirDepends;
+  
+  std::map<cmStdString, StringSet >  m_SubdirDepends;
   
   // The include and link-library paths.  These may have order
   // dependency, so they must be vectors (not set).
@@ -573,8 +574,8 @@ protected:
   std::vector<std::string> m_HeaderFileExtensions;
   std::string m_DefineFlags;
   std::vector<cmSourceGroup> m_SourceGroups;
-  typedef std::map<std::string, cmCommand*> RegisteredCommandsMap;
-  typedef std::map<std::string, std::string> DefinitionMap;
+  typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap;
+  typedef std::map<cmStdString, cmStdString> DefinitionMap;
   DefinitionMap m_Definitions;
   RegisteredCommandsMap m_Commands;
   std::vector<cmCommand*> m_UsedCommands;
@@ -596,7 +597,7 @@ private:
   void AddDefaultDefinitions();
   std::set<cmFunctionBlocker *> m_FunctionBlockers;
   
-  typedef std::map<std::string, cmData*> DataMap;
+  typedef std::map<cmStdString, cmData*> DataMap;
   DataMap m_DataMap;
   bool m_Inheriting;
 };

+ 2 - 2
Source/cmSourceGroup.h

@@ -74,12 +74,12 @@ public:
   /**
    * Map from command to its output/depends sets.
    */
-  typedef std::map<std::string, CommandFiles> Commands;
+  typedef std::map<cmStdString, CommandFiles> Commands;
 
   /**
    * Map from source to command map.
    */
-  typedef std::map<std::string, Commands>  BuildRules;
+  typedef std::map<cmStdString, Commands>  BuildRules;
 
   bool Matches(const char* name);
   void SetGroupRegex(const char* regex)

+ 12 - 0
Source/cmStandardIncludes.h

@@ -131,4 +131,16 @@ inline bool operator==(std::string const& a, const char* b)
 { return (a==std::string(b)); }
 # endif  // end CM_SGI_CC_720
 
+
+struct cmStdString : public std::string
+{
+  typedef std::string Parent;
+  cmStdString(const char* s) : Parent(s)
+    {
+    }
+  cmStdString(std::string const&s) : Parent(s)
+    {
+    }
+};
+  
 #endif

+ 1 - 1
Source/cmTarget.h

@@ -139,6 +139,6 @@ private:
   std::set<std::string> m_Utilities;
 };
 
-typedef std::map<std::string,cmTarget> cmTargets;
+typedef std::map<cmStdString,cmTarget> cmTargets;
 
 #endif

+ 7 - 7
Source/cmUnixMakefileGenerator.cxx

@@ -730,8 +730,8 @@ OutputSubDirectoryVars(std::ostream& fout,
     {
     std::string subdir = FixDirectoryName(SubDirectories[i].c_str());
     fout << target << "_" << subdir.c_str() << ":";
-    const std::set<std::string>& subdirDepends = m_Makefile->GetSubdirDepends(SubDirectories[i].c_str());
-    for(std::set<std::string>::const_iterator d = subdirDepends.begin();
+    const std::set<cmStdString>& subdirDepends = m_Makefile->GetSubdirDepends(SubDirectories[i].c_str());
+    for(std::set<cmStdString>::const_iterator d = subdirDepends.begin();
         d != subdirDepends.end(); ++d)
       {
       std::string fixed_d = FixDirectoryName(d->c_str());
@@ -792,8 +792,8 @@ void cmUnixMakefileGenerator::OutputSubDirectoryRules(std::ostream& fout)
 void cmUnixMakefileGenerator::OutputObjectDepends(std::ostream& fout)
 {
   // Iterate over every target.
-  std::map<std::string, cmTarget>& targets = m_Makefile->GetTargets();
-  for(std::map<std::string, cmTarget>::const_iterator target = targets.begin(); 
+  std::map<cmStdString, cmTarget>& targets = m_Makefile->GetTargets();
+  for(std::map<cmStdString, cmTarget>::const_iterator target = targets.begin(); 
       target != targets.end(); ++target)
     {
     // Iterate over every source for this target.
@@ -1196,7 +1196,7 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
   // see if there is already a target for a cmake executable in this
   // makefile
   bool buildingCMake = false;
-  std::map<std::string, cmTarget>& targets = m_Makefile->GetTargets();
+  std::map<cmStdString, cmTarget>& targets = m_Makefile->GetTargets();
   for(cmTargets::const_iterator l = targets.begin(); 
       l != targets.end(); l++)
     {
@@ -1229,8 +1229,8 @@ void cmUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fout)
   std::set<std::string> rules;
   
   // Iterate over every target.
-  std::map<std::string, cmTarget>& targets = m_Makefile->GetTargets();
-  for(std::map<std::string, cmTarget>::const_iterator target = targets.begin(); 
+  std::map<cmStdString, cmTarget>& targets = m_Makefile->GetTargets();
+  for(std::map<cmStdString, cmTarget>::const_iterator target = targets.begin(); 
       target != targets.end(); ++target)
     {
     bool shared = (target->second.GetType() == cmTarget::SHARED_LIBRARY);