Merge topic 'rename-cmState-API'

cf1233a0 cmState: Rename GetParent method.
942df88b cmState: Rename CreateSnapshot method.
da28f115 cmState: Add CreateBaseSnapshot method.
This commit is contained in:
Brad King 2015-06-04 09:13:31 -04:00 committed by CMake Topic Stage
commit 5a1c8806bf
5 changed files with 27 additions and 14 deletions

View File

@ -73,7 +73,7 @@ cmLocalGenerator::~cmLocalGenerator()
bool cmLocalGenerator::IsRootMakefile() const bool cmLocalGenerator::IsRootMakefile() const
{ {
return !this->StateSnapshot.GetParent().IsValid(); return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -1628,7 +1628,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
} }
cmState::Snapshot newSnapshot = this->GetState() cmState::Snapshot newSnapshot = this->GetState()
->CreateSnapshot(this->StateSnapshot); ->CreateBuildsystemDirectorySnapshot(this->StateSnapshot);
// create a new local generator and set its parent // create a new local generator and set its parent
cmLocalGenerator *lg2 = this->GetGlobalGenerator() cmLocalGenerator *lg2 = this->GetGlobalGenerator()
@ -4032,7 +4032,8 @@ const char *cmMakefile::GetProperty(const std::string& prop,
output = ""; output = "";
if (prop == "PARENT_DIRECTORY") if (prop == "PARENT_DIRECTORY")
{ {
cmState::Snapshot parent = this->StateSnapshot.GetParent(); cmState::Snapshot parent =
this->StateSnapshot.GetBuildsystemDirectoryParent();
if(parent.IsValid()) if(parent.IsValid())
{ {
return parent.GetCurrentSourceDirectory(); return parent.GetCurrentSourceDirectory();

View File

@ -590,7 +590,7 @@ void cmState::Snapshot::ComputeRelativePathTopSource()
snapshots.push_back(snapshot); snapshots.push_back(snapshot);
while (true) while (true)
{ {
snapshot = snapshot.GetParent(); snapshot = snapshot.GetBuildsystemDirectoryParent();
if (snapshot.IsValid()) if (snapshot.IsValid())
{ {
snapshots.push_back(snapshot); snapshots.push_back(snapshot);
@ -622,7 +622,7 @@ void cmState::Snapshot::ComputeRelativePathTopBinary()
snapshots.push_back(snapshot); snapshots.push_back(snapshot);
while (true) while (true)
{ {
snapshot = snapshot.GetParent(); snapshot = snapshot.GetBuildsystemDirectoryParent();
if (snapshot.IsValid()) if (snapshot.IsValid())
{ {
snapshots.push_back(snapshot); snapshots.push_back(snapshot);
@ -659,12 +659,23 @@ void cmState::Snapshot::ComputeRelativePathTopBinary()
} }
} }
cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) cmState::Snapshot cmState::CreateBaseSnapshot()
{ {
if (!originSnapshot.IsValid()) PositionType pos = 0;
{ this->ParentPositions.push_back(pos);
originSnapshot.State = this; this->Locations.resize(1);
this->OutputLocations.resize(1);
this->CurrentSourceDirectoryComponents.resize(1);
this->CurrentBinaryDirectoryComponents.resize(1);
this->RelativePathTopSource.resize(1);
this->RelativePathTopBinary.resize(1);
return cmState::Snapshot(this, pos);
} }
cmState::Snapshot
cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot)
{
assert(originSnapshot.IsValid());
PositionType pos = this->ParentPositions.size(); PositionType pos = this->ParentPositions.size();
this->ParentPositions.push_back(originSnapshot.Position); this->ParentPositions.push_back(originSnapshot.Position);
this->Locations.resize(this->Locations.size() + 1); this->Locations.resize(this->Locations.size() + 1);
@ -764,7 +775,7 @@ bool cmState::Snapshot::IsValid() const
return this->State ? true : false; return this->State ? true : false;
} }
cmState::Snapshot cmState::Snapshot::GetParent() const cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const
{ {
Snapshot snapshot; Snapshot snapshot;
if (!this->State || this->Position == 0) if (!this->State || this->Position == 0)

View File

@ -45,7 +45,7 @@ public:
void SetRelativePathTopBinary(const char* dir); void SetRelativePathTopBinary(const char* dir);
bool IsValid() const; bool IsValid() const;
Snapshot GetParent() const; Snapshot GetBuildsystemDirectoryParent() const;
private: private:
void ComputeRelativePathTopSource(); void ComputeRelativePathTopSource();
@ -57,7 +57,8 @@ public:
cmState::PositionType Position; cmState::PositionType Position;
}; };
Snapshot CreateSnapshot(Snapshot originSnapshot); Snapshot CreateBaseSnapshot();
Snapshot CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot);
enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,
UNINITIALIZED }; UNINITIALIZED };

View File

@ -134,7 +134,7 @@ cmake::cmake()
this->Policies = new cmPolicies(); this->Policies = new cmPolicies();
this->State = new cmState(this); this->State = new cmState(this);
this->CurrentSnapshot = this->State->CreateSnapshot(cmState::Snapshot()); this->CurrentSnapshot = this->State->CreateBaseSnapshot();
#ifdef __APPLE__ #ifdef __APPLE__
struct rlimit rlp; struct rlimit rlp;