[Cmake-commits] CMake branch, next, updated. v3.3.0-2121-g225e2d5

Brad King brad.king at kitware.com
Mon Aug 10 10:01:46 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  225e2d5bacae40956e489d8232f150607cc7b75a (commit)
       via  cc3f200789ad997065b195d01c137c0470551eff (commit)
      from  dde71b8431a75dcbe91d302779f15abaa9471c3d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=225e2d5bacae40956e489d8232f150607cc7b75a
commit 225e2d5bacae40956e489d8232f150607cc7b75a
Merge: dde71b8 cc3f200
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 10 10:01:45 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Aug 10 10:01:45 2015 -0400

    Merge topic 'cmState-definitions' into next
    
    cc3f2007 Revert topic 'cmState-definitions'

diff --cc Source/cmGlobalGenerator.cxx
index a19a074,3c818ff..cda26cd
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@@ -1184,40 -1147,11 +1148,11 @@@ void cmGlobalGenerator::Configure(
    // update the cache entry for the number of local generators, this is used
    // for progress
    char num[100];
 -  sprintf(num,"%d",static_cast<int>(this->LocalGenerators.size()));
 +  sprintf(num,"%d",static_cast<int>(this->Makefiles.size()));
    this->GetCMakeInstance()->AddCacheEntry
 -    ("CMAKE_NUMBER_OF_LOCAL_GENERATORS", num,
 +    ("CMAKE_NUMBER_OF_MAKEFILES", num,
       "number of local generators", cmState::INTERNAL);
  
-   {
-   std::ostringstream str;
-   str << this->GetCMakeInstance()->GetState()->DefinitionsSize();
-   this->GetCMakeInstance()->AddCacheEntry
-     ("CMAKE_NUMBER_OF_DEFINITION_STATES", str.str().c_str(),
-      "number of definition states", cmState::INTERNAL);
-   }
-   {
-   std::ostringstream str;
-   str << this->GetCMakeInstance()->GetState()->SnapshotsSize();
-   this->GetCMakeInstance()->AddCacheEntry
-     ("CMAKE_NUMBER_OF_SNAPSHOT_STATES", str.str().c_str(),
-      "number of snapshot states", cmState::INTERNAL);
-   }
-   {
-   std::ostringstream str;
-   str << this->GetCMakeInstance()->GetState()->ListFilesSize();
-   this->GetCMakeInstance()->AddCacheEntry
-     ("CMAKE_NUMBER_OF_LISTFILE_STATES", str.str().c_str(),
-      "number of listfile states", cmState::INTERNAL);
-   }
-   {
-   std::ostringstream str;
-   str << this->GetCMakeInstance()->GetState()->PoliciesSize();
-   this->GetCMakeInstance()->AddCacheEntry
-     ("CMAKE_NUMBER_OF_POLICY_STATES", str.str().c_str(),
-      "number of policy states", cmState::INTERNAL);
-   }
- 
    // check for link libraries and include directories containing "NOTFOUND"
    // and for infinite loops
    this->CheckLocalGenerators();

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cc3f200789ad997065b195d01c137c0470551eff
commit cc3f200789ad997065b195d01c137c0470551eff
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 10 10:01:26 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Aug 10 10:01:26 2015 -0400

    Revert topic 'cmState-definitions'
    
    A performance regression needs to be addressed.

diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index b06fb5c..2dab169 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -56,9 +56,9 @@ void cmDefinitions::Raise(const std::string& key,
 }
 
 bool cmDefinitions::HasKey(const std::string& key,
-                           StackIter begin, StackIter end)
+                           StackConstIter begin, StackConstIter end)
 {
-  for (StackIter it = begin; it != end; ++it)
+  for (StackConstIter it = begin; it != end; ++it)
     {
     MapType::const_iterator i = it->Map.find(key);
     if (i != it->Map.end())
@@ -94,12 +94,12 @@ std::vector<std::string> cmDefinitions::UnusedKeys() const
 }
 
 //----------------------------------------------------------------------------
-cmDefinitions cmDefinitions::MakeClosure(StackIter begin,
-                                         StackIter end)
+cmDefinitions cmDefinitions::MakeClosure(StackConstIter begin,
+                                         StackConstIter end)
 {
   cmDefinitions closure;
   std::set<std::string> undefined;
-  for (StackIter it = begin; it != end; ++it)
+  for (StackConstIter it = begin; it != end; ++it)
     {
     // Consider local definitions.
     for(MapType::const_iterator mi = it->Map.begin();
@@ -125,12 +125,12 @@ cmDefinitions cmDefinitions::MakeClosure(StackIter begin,
 
 //----------------------------------------------------------------------------
 std::vector<std::string>
-cmDefinitions::ClosureKeys(StackIter begin, StackIter end)
+cmDefinitions::ClosureKeys(StackConstIter begin, StackConstIter end)
 {
   std::set<std::string> bound;
   std::vector<std::string> defined;
 
-  for (StackIter it = begin; it != end; ++it)
+  for (StackConstIter it = begin; it != end; ++it)
     {
     defined.reserve(defined.size() + it->Map.size());
     for(MapType::const_iterator mi = it->Map.begin();
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 411867c..5fdcaab 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -13,9 +13,6 @@
 #define cmDefinitions_h
 
 #include "cmStandardIncludes.h"
-
-#include "cmLinkedTree.h"
-
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #ifdef CMake_HAVE_CXX11_UNORDERED_MAP
 #include <unordered_map>
@@ -35,26 +32,26 @@
  */
 class cmDefinitions
 {
-  typedef cmLinkedTree<cmDefinitions>::iterator StackIter;
+  typedef std::list<cmDefinitions>::reverse_iterator StackIter;
+  typedef std::list<cmDefinitions>::const_reverse_iterator StackConstIter;
 public:
   static const char* Get(const std::string& key,
                          StackIter begin, StackIter end);
 
-  static void Raise(const std::string& key,
-                    StackIter begin, StackIter end);
+  static void Raise(const std::string& key, StackIter begin, StackIter end);
 
   static bool HasKey(const std::string& key,
-                     StackIter begin, StackIter end);
+                     StackConstIter begin, StackConstIter end);
 
   /** Set (or unset if null) a value associated with a key.  */
   void Set(const std::string& key, const char* value);
 
   std::vector<std::string> UnusedKeys() const;
 
-  static std::vector<std::string> ClosureKeys(StackIter begin,
-                                              StackIter end);
+  static std::vector<std::string> ClosureKeys(StackConstIter begin,
+                                              StackConstIter end);
 
-  static cmDefinitions MakeClosure(StackIter begin, StackIter end);
+  static cmDefinitions MakeClosure(StackConstIter begin, StackConstIter end);
 
 private:
   // String with existence boolean.
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 6d079cd..3c818ff 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1140,42 +1140,6 @@ void cmGlobalGenerator::Configure()
   this->BinaryDirectories.insert(
       this->CMakeInstance->GetHomeOutputDirectory());
 
-  if (const char *numStr =
-      this->GetCMakeInstance()->GetState()
-          ->GetInitializedCacheValue("CMAKE_NUMBER_OF_DEFINITION_STATES"))
-    {
-    int num = atoi(numStr);
-    this->GetCMakeInstance()->GetState()->ReserveDefinitions(num);
-    }
-  if (const char *numStr =
-      this->GetCMakeInstance()->GetState()
-          ->GetInitializedCacheValue("CMAKE_NUMBER_OF_SNAPSHOT_STATES"))
-    {
-    int num = atoi(numStr);
-    this->GetCMakeInstance()->GetState()->ReserveSnapshots(num);
-    }
-  if (const char *numStr =
-      this->GetCMakeInstance()->GetState()
-          ->GetInitializedCacheValue("CMAKE_NUMBER_OF_LISTFILE_STATES"))
-    {
-    int num = atoi(numStr);
-    this->GetCMakeInstance()->GetState()->ReserveListFiles(num);
-    }
-  if (const char *numStr =
-      this->GetCMakeInstance()->GetState()
-          ->GetInitializedCacheValue("CMAKE_NUMBER_OF_LOCAL_GENERATORS"))
-    {
-    int num = atoi(numStr);
-    this->GetCMakeInstance()->GetState()->ReserveDirectories(num);
-    }
-  if (const char *numStr =
-      this->GetCMakeInstance()->GetState()
-          ->GetInitializedCacheValue("CMAKE_NUMBER_OF_POLICY_STATES"))
-    {
-    int num = atoi(numStr);
-    this->GetCMakeInstance()->GetState()->ReservePolicies(num);
-    }
-
   // now do it
   lg->GetMakefile()->Configure();
   lg->GetMakefile()->EnforceDirectoryLevelRules();
@@ -1188,35 +1152,6 @@ void cmGlobalGenerator::Configure()
     ("CMAKE_NUMBER_OF_LOCAL_GENERATORS", num,
      "number of local generators", cmState::INTERNAL);
 
-  {
-  std::ostringstream str;
-  str << this->GetCMakeInstance()->GetState()->DefinitionsSize();
-  this->GetCMakeInstance()->AddCacheEntry
-    ("CMAKE_NUMBER_OF_DEFINITION_STATES", str.str().c_str(),
-     "number of definition states", cmState::INTERNAL);
-  }
-  {
-  std::ostringstream str;
-  str << this->GetCMakeInstance()->GetState()->SnapshotsSize();
-  this->GetCMakeInstance()->AddCacheEntry
-    ("CMAKE_NUMBER_OF_SNAPSHOT_STATES", str.str().c_str(),
-     "number of snapshot states", cmState::INTERNAL);
-  }
-  {
-  std::ostringstream str;
-  str << this->GetCMakeInstance()->GetState()->ListFilesSize();
-  this->GetCMakeInstance()->AddCacheEntry
-    ("CMAKE_NUMBER_OF_LISTFILE_STATES", str.str().c_str(),
-     "number of listfile states", cmState::INTERNAL);
-  }
-  {
-  std::ostringstream str;
-  str << this->GetCMakeInstance()->GetState()->PoliciesSize();
-  this->GetCMakeInstance()->AddCacheEntry
-    ("CMAKE_NUMBER_OF_POLICY_STATES", str.str().c_str(),
-     "number of policy states", cmState::INTERNAL);
-  }
-
   // check for link libraries and include directories containing "NOTFOUND"
   // and for infinite loops
   this->CheckLocalGenerators();
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
index 385dff2..3bcb940 100644
--- a/Source/cmLinkedTree.h
+++ b/Source/cmLinkedTree.h
@@ -161,17 +161,6 @@ public:
     this->Data.clear();
   }
 
-  size_t Size() const
-  {
-    return this->UpPositions.size();
-  }
-
-  void Reserve(size_t amount)
-  {
-    this->UpPositions.reserve(amount);
-    this->Data.reserve(amount);
-  }
-
 private:
   T& GetReference(PositionType pos)
   {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 15cfd0c..60a11e1 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -31,6 +31,7 @@
 #endif
 #include "cmInstallGenerator.h"
 #include "cmTestGenerator.h"
+#include "cmDefinitions.h"
 #include "cmAlgorithms.h"
 #include "cmake.h"
 #include <stdlib.h> // required for atoi
@@ -46,7 +47,92 @@
 class cmMakefile::Internals
 {
 public:
+  std::list<cmDefinitions> VarStack;
   bool IsSourceFileTryCompile;
+
+  void PushDefinitions()
+  {
+    this->VarStack.push_back(cmDefinitions());
+  }
+
+  void InitializeDefinitions(cmMakefile* parent)
+  {
+    this->VarStack.back() =
+        cmDefinitions::MakeClosure(parent->Internal->VarStack.rbegin(),
+                                   parent->Internal->VarStack.rend());
+  }
+
+  const char* GetDefinition(std::string const& name)
+  {
+    return cmDefinitions::Get(name, this->VarStack.rbegin(),
+                                    this->VarStack.rend());
+  }
+
+  bool IsInitialized(std::string const& name)
+  {
+    return cmDefinitions::HasKey(name, this->VarStack.rbegin(),
+                                 this->VarStack.rend());
+  }
+
+  void SetDefinition(std::string const& name, std::string const& value)
+  {
+    this->VarStack.back().Set(name, value.c_str());
+  }
+
+  void RemoveDefinition(std::string const& name)
+  {
+    this->VarStack.back().Set(name, 0);
+  }
+
+  std::vector<std::string> UnusedKeys() const
+  {
+    return this->VarStack.back().UnusedKeys();
+  }
+
+  std::vector<std::string> ClosureKeys() const
+  {
+    return cmDefinitions::ClosureKeys(this->VarStack.rbegin(),
+                                      this->VarStack.rend());
+  }
+
+  void PopDefinitions()
+  {
+    this->VarStack.pop_back();
+  }
+
+  bool RaiseScope(std::string const& var, const char* varDef, cmMakefile* mf)
+  {
+    std::list<cmDefinitions>::reverse_iterator it = this->VarStack.rbegin();
+    assert(it != this->VarStack.rend());
+    ++it;
+    if(it == this->VarStack.rend())
+      {
+      cmLocalGenerator* plg = mf->LocalGenerator->GetParent();
+      if(!plg)
+        {
+        return false;
+        }
+      // Update the definition in the parent directory top scope.  This
+      // directory's scope was initialized by the closure of the parent
+      // scope, so we do not need to localize the definition first.
+      cmMakefile* parent = plg->GetMakefile();
+      if (varDef)
+        {
+        parent->AddDefinition(var, varDef);
+        }
+      else
+        {
+        parent->RemoveDefinition(var);
+        }
+      return true;
+      }
+    // First localize the definition in the current scope.
+    cmDefinitions::Raise(var, this->VarStack.rbegin(), this->VarStack.rend());
+
+    // Now update the definition in the parent scope.
+    it->Set(var, varDef);
+    return true;
+  }
 };
 
 // default is not to be building executables
@@ -55,6 +141,7 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
     LocalGenerator(localGenerator),
     StateSnapshot(localGenerator->GetStateSnapshot())
 {
+  this->Internal->PushDefinitions();
   this->Internal->IsSourceFileTryCompile = false;
 
   // Initialize these first since AddDefaultDefinitions calls AddDefinition
@@ -1480,6 +1567,9 @@ void cmMakefile::AddLinkLibrary(const std::string& lib)
 
 void cmMakefile::InitializeFromParent(cmMakefile* parent)
 {
+  // Initialize definitions with the closure of the parent scope.
+  this->Internal->InitializeDefinitions(parent);
+
   this->StateSnapshot.InitializeFromParent();
 
   this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
@@ -1544,6 +1634,8 @@ void cmMakefile::PushFunctionScope(std::string const& fileName,
         fileName);
   assert(this->StateSnapshot.IsValid());
 
+  this->Internal->PushDefinitions();
+
   this->PushLoopBlockBarrier();
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -1570,6 +1662,8 @@ void cmMakefile::PopFunctionScope(bool reportError)
   this->PopLoopBlockBarrier();
 
   this->CheckForUnusedVariables();
+
+  this->Internal->PopDefinitions();
 }
 
 void cmMakefile::PushMacroScope(std::string const& fileName,
@@ -1872,7 +1966,7 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value)
     {
     this->LogUnused("changing definition", name);
     }
-  this->StateSnapshot.SetDefinition(name, value);
+  this->Internal->SetDefinition(name, value);
 
 #ifdef CMAKE_BUILD_WITH_CMAKE
   cmVariableWatch* vv = this->GetVariableWatch();
@@ -1935,7 +2029,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
   this->GetState()->AddCacheEntry(name, haveVal ? val.c_str() : 0,
                                           doc, type);
   // if there was a definition then remove it
-  this->StateSnapshot.RemoveDefinition(name);
+  this->Internal->RemoveDefinition(name);
 }
 
 
@@ -1945,9 +2039,7 @@ void cmMakefile::AddDefinition(const std::string& name, bool value)
     {
     this->LogUnused("changing definition", name);
     }
-
-  this->StateSnapshot.SetDefinition(name, value ? "ON" : "OFF");
-
+  this->Internal->SetDefinition(name, value ? "ON" : "OFF");
 #ifdef CMAKE_BUILD_WITH_CMAKE
   cmVariableWatch* vv = this->GetVariableWatch();
   if ( vv )
@@ -1964,7 +2056,7 @@ void cmMakefile::CheckForUnusedVariables() const
     {
     return;
     }
-  const std::vector<std::string>& unused = this->StateSnapshot.UnusedKeys();
+  const std::vector<std::string>& unused = this->Internal->UnusedKeys();
   std::vector<std::string>::const_iterator it = unused.begin();
   for (; it != unused.end(); ++it)
     {
@@ -1974,12 +2066,12 @@ void cmMakefile::CheckForUnusedVariables() const
 
 void cmMakefile::MarkVariableAsUsed(const std::string& var)
 {
-  this->StateSnapshot.GetDefinition(var);
+  this->Internal->GetDefinition(var);
 }
 
 bool cmMakefile::VariableInitialized(const std::string& var) const
 {
-  return this->StateSnapshot.IsInitialized(var);
+  return this->Internal->IsInitialized(var);
 }
 
 void cmMakefile::LogUnused(const char* reason,
@@ -2027,7 +2119,7 @@ void cmMakefile::RemoveDefinition(const std::string& name)
     {
     this->LogUnused("unsetting", name);
     }
-  this->StateSnapshot.RemoveDefinition(name);
+  this->Internal->RemoveDefinition(name);
 #ifdef CMAKE_BUILD_WITH_CMAKE
   cmVariableWatch* vv = this->GetVariableWatch();
   if ( vv )
@@ -2493,7 +2585,7 @@ const char* cmMakefile::GetRequiredDefinition(const std::string& name) const
 
 bool cmMakefile::IsDefinitionSet(const std::string& name) const
 {
-  const char* def = this->StateSnapshot.GetDefinition(name);
+  const char* def = this->Internal->GetDefinition(name);
   if(!def)
     {
     def = this->GetState()->GetInitializedCacheValue(name);
@@ -2514,7 +2606,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
 
 const char* cmMakefile::GetDefinition(const std::string& name) const
 {
-  const char* def = this->StateSnapshot.GetDefinition(name);
+  const char* def = this->Internal->GetDefinition(name);
   if(!def)
     {
     def = this->GetState()->GetInitializedCacheValue(name);
@@ -2550,7 +2642,7 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const
 
 std::vector<std::string> cmMakefile::GetDefinitions() const
 {
-  std::vector<std::string> res = this->StateSnapshot.ClosureKeys();
+  std::vector<std::string> res = this->Internal->ClosureKeys();
   std::vector<std::string> cacheKeys = this->GetState()->GetCacheEntryKeys();
   res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
   std::sort(res.begin(), res.end());
@@ -4329,17 +4421,8 @@ std::string cmMakefile::FormatListFileStack() const
 
 void cmMakefile::PushScope()
 {
-  std::string commandName;
-  long line = 0;
-  if (!this->ContextStack.empty())
-    {
-    commandName = this->ContextStack.back()->Name;
-    line = this->ContextStack.back()->Line;
-    }
-  this->StateSnapshot = this->GetState()->CreateVariableScopeSnapshot(
-        this->StateSnapshot,
-        commandName,
-        line);
+  this->Internal->PushDefinitions();
+
   this->PushLoopBlockBarrier();
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -4357,9 +4440,7 @@ void cmMakefile::PopScope()
 
   this->CheckForUnusedVariables();
 
-  this->StateSnapshot =
-      this->GetState()->Pop(this->StateSnapshot);
-  assert(this->StateSnapshot.IsValid());
+  this->Internal->PopDefinitions();
 }
 
 void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
@@ -4369,7 +4450,7 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
     return;
     }
 
-  if (!this->StateSnapshot.RaiseScope(var, varDef))
+  if (!this->Internal->RaiseScope(var, varDef, this))
     {
     std::ostringstream m;
     m << "Cannot set \"" << var << "\": current scope has no parent.";
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index fc4fa30..f425861 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -15,13 +15,11 @@
 #include "cmCacheManager.h"
 #include "cmCommand.h"
 #include "cmAlgorithms.h"
-#include "cmDefinitions.h"
 
 #include <assert.h>
 
 struct cmState::SnapshotDataType
 {
-  cmState::PositionType ScopeParent;
   cmState::PositionType DirectoryParent;
   cmLinkedTree<cmState::PolicyStackEntry>::iterator Policies;
   cmLinkedTree<cmState::PolicyStackEntry>::iterator PolicyRoot;
@@ -30,9 +28,6 @@ struct cmState::SnapshotDataType
   cmLinkedTree<std::string>::iterator ExecutionListFile;
   cmLinkedTree<cmState::BuildsystemDirectoryStateType>::iterator
                                                           BuildSystemDirectory;
-  cmLinkedTree<cmDefinitions>::iterator Vars;
-  cmLinkedTree<cmDefinitions>::iterator Root;
-  cmLinkedTree<cmDefinitions>::iterator Parent;
   std::string EntryPointCommand;
   long EntryPointLine;
   std::vector<std::string>::size_type IncludeDirectoryPosition;
@@ -279,10 +274,6 @@ cmState::Snapshot cmState::Reset()
   pos->PolicyScope = this->PolicyStack.Root();
   assert(pos->Policies.IsValid());
   assert(pos->PolicyRoot.IsValid());
-  this->VarTree.Clear();
-  pos->Vars = this->VarTree.Extend(this->VarTree.Root());
-  pos->Parent = this->VarTree.Root();
-  pos->Root = this->VarTree.Root();
 
   this->DefineProperty
     ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
@@ -651,56 +642,6 @@ bool cmState::UseMSYSShell() const
   return this->MSYSShell;
 }
 
-size_t cmState::DefinitionsSize() const
-{
-  return this->VarTree.Size();
-}
-
-void cmState::ReserveDefinitions(size_t amount)
-{
-  this->VarTree.Reserve(amount);
-}
-
-size_t cmState::SnapshotsSize() const
-{
-  return this->SnapshotData.Size();
-}
-
-void cmState::ReserveSnapshots(size_t amount)
-{
-  this->SnapshotData.Reserve(amount);
-}
-
-size_t cmState::ListFilesSize() const
-{
-  return this->ExecutionListFiles.Size();
-}
-
-void cmState::ReserveListFiles(size_t amount)
-{
-  this->ExecutionListFiles.Reserve(amount);
-}
-
-size_t cmState::DirectoriesSize() const
-{
-  return this->BuildsystemDirectory.Size();
-}
-
-void cmState::ReserveDirectories(size_t amount)
-{
-  this->BuildsystemDirectory.Reserve(amount);
-}
-
-size_t cmState::PoliciesSize() const
-{
-  return this->PolicyStack.Size();
-}
-
-void cmState::ReservePolicies(size_t amount)
-{
-  this->PolicyStack.Reserve(amount);
-}
-
 const char* cmState::GetBinaryDirectory() const
 {
   return this->BinaryDirectory.c_str();
@@ -795,8 +736,7 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
 {
   PositionType pos = this->SnapshotData.Extend(this->SnapshotData.Root());
   pos->DirectoryParent = this->SnapshotData.Root();
-  pos->ScopeParent = this->SnapshotData.Root();
-  pos->SnapshotType = BaseType;
+  pos->SnapshotType = BuildsystemDirectoryType;
   pos->BuildSystemDirectory =
       this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root());
   pos->ExecutionListFile =
@@ -810,10 +750,6 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
   pos->PolicyScope = this->PolicyStack.Root();
   assert(pos->Policies.IsValid());
   assert(pos->PolicyRoot.IsValid());
-  pos->Vars = this->VarTree.Extend(this->VarTree.Root());
-  assert(pos->Vars.IsValid());
-  pos->Parent = this->VarTree.Root();
-  pos->Root = this->VarTree.Root();
   return cmState::Snapshot(this, pos);
 }
 
@@ -827,7 +763,6 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
   pos->EntryPointLine = entryPointLine;
   pos->EntryPointCommand = entryPointCommand;
   pos->DirectoryParent = originSnapshot.Position;
-  pos->ScopeParent = originSnapshot.Position;
   pos->SnapshotType = BuildsystemDirectoryType;
   pos->BuildSystemDirectory =
       this->BuildsystemDirectory.Extend(
@@ -841,25 +776,6 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
   pos->PolicyScope = originSnapshot.Position->Policies;
   assert(pos->Policies.IsValid());
   assert(pos->PolicyRoot.IsValid());
-
-  cmLinkedTree<cmDefinitions>::iterator origin = originSnapshot.Position->Vars;
-  cmLinkedTree<cmDefinitions>::iterator newVars = this->VarTree.Extend(origin);
-
-  PositionType originPos = originSnapshot.Position;
-  while(originPos.IsValid())
-    {
-    originPos->Vars = newVars;
-    if ((originPos->SnapshotType == BaseType)
-        || (originPos->SnapshotType == FunctionCallType)
-        || (originPos->SnapshotType == VariableScopeType)
-        || (originPos->SnapshotType == BuildsystemDirectoryType))
-      break;
-    ++originPos;
-    }
-
-  pos->Parent = newVars;
-  pos->Root = origin;
-  pos->Vars = this->VarTree.Extend(origin);
   return cmState::Snapshot(this, pos);
 }
 
@@ -871,7 +787,6 @@ cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot,
 {
   PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
                                                *originSnapshot.Position);
-  pos->ScopeParent = originSnapshot.Position;
   pos->EntryPointLine = entryPointLine;
   pos->EntryPointCommand = entryPointCommand;
   pos->SnapshotType = FunctionCallType;
@@ -879,25 +794,6 @@ cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot,
         originSnapshot.Position->ExecutionListFile, fileName);
   pos->BuildSystemDirectory->DirectoryEnd = pos;
   pos->PolicyScope = originSnapshot.Position->Policies;
-  assert(originSnapshot.Position->Vars.IsValid());
-  cmLinkedTree<cmDefinitions>::iterator origin =
-      originSnapshot.Position->Vars;
-  cmLinkedTree<cmDefinitions>::iterator newVars = this->VarTree.Extend(origin);
-
-  PositionType originPos = originSnapshot.Position;
-  while(originPos.IsValid())
-    {
-    originPos->Vars = newVars;
-    if ((originPos->SnapshotType == BaseType)
-        || (originPos->SnapshotType == FunctionCallType)
-        || (originPos->SnapshotType == VariableScopeType)
-        || (originPos->SnapshotType == BuildsystemDirectoryType))
-      break;
-    ++originPos;
-    }
-
-  pos->Parent = newVars;
-  pos->Vars = this->VarTree.Extend(origin);
   return cmState::Snapshot(this, pos);
 }
 
@@ -915,7 +811,6 @@ cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot,
   pos->SnapshotType = MacroCallType;
   pos->ExecutionListFile = this->ExecutionListFiles.Extend(
         originSnapshot.Position->ExecutionListFile, fileName);
-  assert(originSnapshot.Position->Vars.IsValid());
   pos->BuildSystemDirectory->DirectoryEnd = pos;
   pos->PolicyScope = originSnapshot.Position->Policies;
   return cmState::Snapshot(this, pos);
@@ -934,48 +829,12 @@ cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot,
   pos->SnapshotType = CallStackType;
   pos->ExecutionListFile = this->ExecutionListFiles.Extend(
         originSnapshot.Position->ExecutionListFile, fileName);
-  assert(originSnapshot.Position->Vars.IsValid());
   pos->BuildSystemDirectory->DirectoryEnd = pos;
   pos->PolicyScope = originSnapshot.Position->Policies;
   return cmState::Snapshot(this, pos);
 }
 
 cmState::Snapshot
-cmState::CreateVariableScopeSnapshot(cmState::Snapshot originSnapshot,
-                                     std::string const& entryPointCommand,
-                                     long entryPointLine)
-{
-  PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
-                                               *originSnapshot.Position);
-  pos->ScopeParent = originSnapshot.Position;
-  pos->EntryPointLine = entryPointLine;
-  pos->EntryPointCommand = entryPointCommand;
-  pos->SnapshotType = VariableScopeType;
-  assert(originSnapshot.Position->Vars.IsValid());
-
-  cmLinkedTree<cmDefinitions>::iterator origin =
-      originSnapshot.Position->Vars;
-  cmLinkedTree<cmDefinitions>::iterator newVars = this->VarTree.Extend(origin);
-
-  PositionType originPos = originSnapshot.Position;
-  while(originPos.IsValid())
-    {
-    originPos->Vars = newVars;
-    if ((originPos->SnapshotType == BaseType)
-        || (originPos->SnapshotType == FunctionCallType)
-        || (originPos->SnapshotType == VariableScopeType)
-        || (originPos->SnapshotType == BuildsystemDirectoryType))
-      break;
-    ++originPos;
-    }
-
-  pos->Parent = newVars;
-  pos->Vars = this->VarTree.Extend(origin);
-  assert(pos->Vars.IsValid());
-  return cmState::Snapshot(this, pos);
-}
-
-cmState::Snapshot
 cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot,
                                       const std::string& entryPointCommand,
                                       long entryPointLine,
@@ -1160,8 +1019,7 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
     {
     ++parentPos;
     }
-  if (parentPos->SnapshotType == cmState::BuildsystemDirectoryType
-      || parentPos->SnapshotType == cmState::BaseType)
+  if (parentPos->SnapshotType == cmState::BuildsystemDirectoryType)
     {
     return snapshot;
     }
@@ -1263,72 +1121,6 @@ bool cmState::Snapshot::HasDefinedPolicyCMP0011()
   return !this->Position->Policies->IsEmpty();
 }
 
-const char* cmState::Snapshot::GetDefinition(std::string const& name) const
-{
-  assert(this->Position->Vars.IsValid());
-  return cmDefinitions::Get(name, this->Position->Vars,
-                    this->Position->Root);
-}
-
-bool cmState::Snapshot::IsInitialized(std::string const& name) const
-{
-  return cmDefinitions::HasKey(name, this->Position->Vars,
-                               this->Position->Root);
-}
-
-void cmState::Snapshot::SetDefinition(std::string const& name,
-                                      std::string const& value)
-{
-  this->Position->Vars->Set(name, value.c_str());
-}
-
-void cmState::Snapshot::RemoveDefinition(std::string const& name)
-{
-  this->Position->Vars->Set(name, 0);
-}
-
-std::vector<std::string> cmState::Snapshot::UnusedKeys() const
-{
-  return this->Position->Vars->UnusedKeys();
-}
-
-std::vector<std::string> cmState::Snapshot::ClosureKeys() const
-{
-  return cmDefinitions::ClosureKeys(this->Position->Vars,
-                                    this->Position->Root);
-}
-
-bool cmState::Snapshot::RaiseScope(std::string const& var, const char* varDef)
-{
-  if(this->Position->ScopeParent == this->Position->DirectoryParent)
-    {
-    Snapshot parentDir = this->GetBuildsystemDirectoryParent();
-    if(!parentDir.IsValid())
-      {
-      return false;
-      }
-    // Update the definition in the parent directory top scope.  This
-    // directory's scope was initialized by the closure of the parent
-    // scope, so we do not need to localize the definition first.
-    if (varDef)
-      {
-      parentDir.SetDefinition(var, varDef);
-      }
-    else
-      {
-      parentDir.RemoveDefinition(var);
-      }
-    return true;
-    }
-  // First localize the definition in the current scope.
-  cmDefinitions::Raise(var, this->Position->Vars,
-                       this->Position->Root);
-
-  // Now update the definition in the parent scope.
-  this->Position->Parent->Set(var, varDef);
-  return true;
-}
-
 static const std::string cmPropertySentinal = std::string();
 
 template<typename T, typename U, typename V>
@@ -1365,11 +1157,6 @@ void InitializeContentFromParent(T& parentContent,
 void cmState::Snapshot::InitializeFromParent()
 {
   PositionType parent = this->Position->DirectoryParent;
-  assert(this->Position->Vars.IsValid());
-  assert(parent->Vars.IsValid());
-
-  *this->Position->Vars =
-      cmDefinitions::MakeClosure(parent->Vars, parent->Root);
 
   InitializeContentFromParent(parent->BuildSystemDirectory->IncludeDirectories,
               this->Position->BuildSystemDirectory->IncludeDirectories,
diff --git a/Source/cmState.h b/Source/cmState.h
index 8380587..07aa2a5 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -21,8 +21,6 @@
 
 class cmake;
 class cmCommand;
-class cmDefinitions;
-class cmListFileBacktrace;
 
 class cmState
 {
@@ -37,14 +35,12 @@ public:
 
   enum SnapshotType
   {
-    BaseType,
     BuildsystemDirectoryType,
     FunctionCallType,
     MacroCallType,
     CallStackType,
     InlineListFileType,
-    PolicyScopeType,
-    VariableScopeType
+    PolicyScopeType
   };
 
   class Directory;
@@ -54,14 +50,6 @@ public:
     Snapshot(cmState* state = 0);
     Snapshot(cmState* state, PositionType position);
 
-    const char* GetDefinition(std::string const& name) const;
-    bool IsInitialized(std::string const& name) const;
-    void SetDefinition(std::string const& name, std::string const& value);
-    void RemoveDefinition(std::string const& name);
-    std::vector<std::string> UnusedKeys() const;
-    std::vector<std::string> ClosureKeys() const;
-    bool RaiseScope(std::string const& var, const char* varDef);
-
     void SetListFile(std::string const& listfile);
 
     std::string GetExecutionListFile() const;
@@ -166,9 +154,6 @@ public:
                                    std::string const& entryPointCommand,
                                    long entryPointLine,
                                    std::string const& fileName);
-  Snapshot CreateVariableScopeSnapshot(Snapshot originSnapshot,
-                                       std::string const& entryPointCommand,
-                                       long entryPointLine);
   Snapshot CreateInlineListFileSnapshot(Snapshot originSnapshot,
                                         const std::string& entryPointCommand,
                                         long entryPointLine,
@@ -270,21 +255,6 @@ public:
   void SetMSYSShell(bool mSYSShell);
   bool UseMSYSShell() const;
 
-  size_t DefinitionsSize() const;
-  void ReserveDefinitions(size_t amount);
-
-  size_t SnapshotsSize() const;
-  void ReserveSnapshots(size_t amount);
-
-  size_t ListFilesSize() const;
-  void ReserveListFiles(size_t amount);
-
-  size_t DirectoriesSize() const;
-  void ReserveDirectories(size_t amount);
-
-  size_t PoliciesSize() const;
-  void ReservePolicies(size_t amount);
-
 private:
   std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
   std::vector<std::string> EnabledLanguages;
@@ -298,7 +268,6 @@ private:
 
   cmLinkedTree<PolicyStackEntry> PolicyStack;
   cmLinkedTree<SnapshotDataType> SnapshotData;
-  cmLinkedTree<cmDefinitions> VarTree;
 
   std::vector<std::string> SourceDirectoryComponents;
   std::vector<std::string> BinaryDirectoryComponents;

-----------------------------------------------------------------------

Summary of changes:
 Source/cmDefinitions.cxx     |   14 +--
 Source/cmDefinitions.h       |   17 ++--
 Source/cmGlobalGenerator.cxx |   65 -------------
 Source/cmLinkedTree.h        |   11 ---
 Source/cmMakefile.cxx        |  135 ++++++++++++++++++++------
 Source/cmState.cxx           |  217 +-----------------------------------------
 Source/cmState.h             |   33 +------
 7 files changed, 125 insertions(+), 367 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list