summaryrefslogtreecommitdiffstats
path: root/Source/cmState.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-05-31 17:37:08 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-07-05 23:37:15 (GMT)
commit6361f680568c81e0391fa56cf9a7f4637bd745dc (patch)
tree24e8c14c2bf179a931ea9d1baa44f5ead864b419 /Source/cmState.cxx
parent94704d759cc8939f3573122d36d52c4598fd04ba (diff)
downloadCMake-6361f680568c81e0391fa56cf9a7f4637bd745dc.zip
CMake-6361f680568c81e0391fa56cf9a7f4637bd745dc.tar.gz
CMake-6361f680568c81e0391fa56cf9a7f4637bd745dc.tar.bz2
cmState: Store execution context.
Extend snapshot creation API to store the file being executed and the entry point to get to that context.
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r--Source/cmState.cxx71
1 files changed, 66 insertions, 5 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 5ca1cce..d918f65 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -23,8 +23,11 @@ struct cmState::SnapshotDataType
cmState::PositionType CallStackParent;
cmState::PositionType DirectoryParent;
cmState::SnapshotType SnapshotType;
+ cmLinkedTree<std::string>::iterator ExecutionListFile;
cmLinkedTree<cmState::BuildsystemDirectoryStateType>::iterator
BuildSystemDirectory;
+ std::string EntryPointCommand;
+ long EntryPointLine;
};
struct cmState::BuildsystemDirectoryStateType
@@ -227,6 +230,7 @@ cmState::Snapshot cmState::Reset()
this->BuildsystemDirectory.Truncate();
PositionType pos = this->SnapshotData.Truncate();
+ this->ExecutionListFiles.Truncate();
this->DefineProperty
("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
@@ -683,61 +687,98 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
pos->SnapshotType = BuildsystemDirectoryType;
pos->BuildSystemDirectory =
this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root());
+ pos->ExecutionListFile =
+ this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root());
return cmState::Snapshot(this, pos);
}
cmState::Snapshot
-cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot)
+cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine)
{
assert(originSnapshot.IsValid());
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position);
pos->CallStackParent = originSnapshot.Position;
+ pos->EntryPointLine = entryPointLine;
+ pos->EntryPointCommand = entryPointCommand;
pos->DirectoryParent = originSnapshot.Position;
pos->SnapshotType = BuildsystemDirectoryType;
pos->BuildSystemDirectory =
this->BuildsystemDirectory.Extend(
originSnapshot.Position->BuildSystemDirectory);
+ pos->ExecutionListFile =
+ this->ExecutionListFiles.Extend(
+ originSnapshot.Position->ExecutionListFile);
return cmState::Snapshot(this, pos);
}
cmState::Snapshot
-cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot)
+cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine,
+ std::string const& fileName)
{
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
*originSnapshot.Position);
pos->CallStackParent = originSnapshot.Position;
+ pos->EntryPointLine = entryPointLine;
+ pos->EntryPointCommand = entryPointCommand;
pos->SnapshotType = FunctionCallType;
+ pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+ originSnapshot.Position->ExecutionListFile, fileName);
return cmState::Snapshot(this, pos);
}
cmState::Snapshot
-cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot)
+cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine,
+ std::string const& fileName)
{
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
*originSnapshot.Position);
pos->CallStackParent = originSnapshot.Position;
+ pos->EntryPointLine = entryPointLine;
+ pos->EntryPointCommand = entryPointCommand;
pos->SnapshotType = MacroCallType;
+ pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+ originSnapshot.Position->ExecutionListFile, fileName);
return cmState::Snapshot(this, pos);
}
cmState::Snapshot
-cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot)
+cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot,
+ const std::string& entryPointCommand,
+ long entryPointLine,
+ const std::string& fileName)
{
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
*originSnapshot.Position);
pos->CallStackParent = originSnapshot.Position;
+ pos->EntryPointLine = entryPointLine;
+ pos->EntryPointCommand = entryPointCommand;
pos->SnapshotType = CallStackType;
+ pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+ originSnapshot.Position->ExecutionListFile, fileName);
return cmState::Snapshot(this, pos);
}
cmState::Snapshot
-cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot)
+cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot,
+ const std::string& entryPointCommand,
+ long entryPointLine,
+ const std::string& fileName)
{
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
*originSnapshot.Position);
pos->CallStackParent = originSnapshot.Position;
+ pos->EntryPointLine = entryPointLine;
+ pos->EntryPointCommand = entryPointCommand;
pos->SnapshotType = InlineListFileType;
+ pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+ originSnapshot.Position->ExecutionListFile, fileName);
return cmState::Snapshot(this, pos);
}
@@ -797,6 +838,11 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir)
this->ComputeRelativePathTopBinary();
}
+void cmState::Snapshot::SetListFile(const std::string& listfile)
+{
+ *this->Position->ExecutionListFile = listfile;
+}
+
std::vector<std::string> const&
cmState::Snapshot::GetCurrentSourceDirectoryComponents() const
{
@@ -831,6 +877,21 @@ void cmState::Snapshot::SetRelativePathTopBinary(const char* dir)
this->Position->BuildSystemDirectory->RelativePathTopBinary = dir;
}
+std::string cmState::Snapshot::GetExecutionListFile() const
+{
+ return *this->Position->ExecutionListFile;
+}
+
+std::string cmState::Snapshot::GetEntryPointCommand() const
+{
+ return this->Position->EntryPointCommand;
+}
+
+long cmState::Snapshot::GetEntryPointLine() const
+{
+ return this->Position->EntryPointLine;
+}
+
bool cmState::Snapshot::IsValid() const
{
return this->State && this->Position.IsValid()