From 52dbe654dea7562564be9d880540e6bc706998ba Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 1 Aug 2015 07:20:26 +0200 Subject: [PATCH] cmState: Record the end position of each directory. At generate time, variables and policies are determined from the end state of the cmMakefile. --- Source/cmState.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 09446bb08..1d24ec611 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -34,6 +34,8 @@ struct cmState::SnapshotDataType struct cmState::BuildsystemDirectoryStateType { + cmState::PositionType DirectoryEnd; + std::string Location; std::string OutputLocation; @@ -239,6 +241,9 @@ cmState::Snapshot cmState::Reset() this->GlobalProperties.clear(); this->PropertyDefinitions.clear(); + PositionType pos = this->SnapshotData.Truncate(); + this->ExecutionListFiles.Truncate(); + { cmLinkedTree::iterator it = this->BuildsystemDirectory.Truncate(); @@ -248,9 +253,8 @@ cmState::Snapshot cmState::Reset() it->CompileDefinitionsBacktraces.clear(); it->CompileOptions.clear(); it->CompileOptionsBacktraces.clear(); + it->DirectoryEnd = pos; } - PositionType pos = this->SnapshotData.Truncate(); - this->ExecutionListFiles.Truncate(); this->DefineProperty ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, @@ -721,6 +725,7 @@ cmState::Snapshot cmState::CreateBaseSnapshot() pos->IncludeDirectoryPosition = 0; pos->CompileDefinitionsPosition = 0; pos->CompileOptionsPosition = 0; + pos->BuildSystemDirectory->DirectoryEnd = pos; return cmState::Snapshot(this, pos); } @@ -741,6 +746,7 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot, pos->ExecutionListFile = this->ExecutionListFiles.Extend( originSnapshot.Position->ExecutionListFile); + pos->BuildSystemDirectory->DirectoryEnd = pos; return cmState::Snapshot(this, pos); } @@ -757,6 +763,7 @@ cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot, pos->SnapshotType = FunctionCallType; pos->ExecutionListFile = this->ExecutionListFiles.Extend( originSnapshot.Position->ExecutionListFile, fileName); + pos->BuildSystemDirectory->DirectoryEnd = pos; return cmState::Snapshot(this, pos); } @@ -774,6 +781,7 @@ cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot, pos->SnapshotType = MacroCallType; pos->ExecutionListFile = this->ExecutionListFiles.Extend( originSnapshot.Position->ExecutionListFile, fileName); + pos->BuildSystemDirectory->DirectoryEnd = pos; return cmState::Snapshot(this, pos); } @@ -790,6 +798,7 @@ cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot, pos->SnapshotType = CallStackType; pos->ExecutionListFile = this->ExecutionListFiles.Extend( originSnapshot.Position->ExecutionListFile, fileName); + pos->BuildSystemDirectory->DirectoryEnd = pos; return cmState::Snapshot(this, pos); } @@ -806,6 +815,7 @@ cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot, pos->SnapshotType = InlineListFileType; pos->ExecutionListFile = this->ExecutionListFiles.Extend( originSnapshot.Position->ExecutionListFile, fileName); + pos->BuildSystemDirectory->DirectoryEnd = pos; return cmState::Snapshot(this, pos); } @@ -815,6 +825,7 @@ cmState::CreatePolicyScopeSnapshot(cmState::Snapshot originSnapshot) PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, *originSnapshot.Position); pos->SnapshotType = PolicyScopeType; + pos->BuildSystemDirectory->DirectoryEnd = pos; return cmState::Snapshot(this, pos); } @@ -829,6 +840,7 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot) prevPos->BuildSystemDirectory->CompileDefinitions.size(); prevPos->CompileOptionsPosition = prevPos->BuildSystemDirectory->CompileOptions.size(); + prevPos->BuildSystemDirectory->DirectoryEnd = prevPos; return Snapshot(this, prevPos); }