[Cmake-commits] CMake branch, next, updated. v3.5.1-928-gee786ea
Brad King
brad.king at kitware.com
Thu Apr 14 16:20:32 EDT 2016
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 ee786eaf3e502aeadc0e1b2913cf26fd0ec451a8 (commit)
via 750594f10c68998f73aec24faccbee4fd1a3a59f (commit)
from 273c68fe269b62f07081208763f77e7d2dbb8b5b (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee786eaf3e502aeadc0e1b2913cf26fd0ec451a8
commit ee786eaf3e502aeadc0e1b2913cf26fd0ec451a8
Merge: 273c68fe 750594f
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 14 16:20:31 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Apr 14 16:20:31 2016 -0400
Merge topic 'refactor-cmListFileBacktrace' into next
750594f1 Revert topic 'refactor-cmListFileBacktrace'
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=750594f10c68998f73aec24faccbee4fd1a3a59f
commit 750594f10c68998f73aec24faccbee4fd1a3a59f
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 14 16:19:41 2016 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Apr 14 16:19:41 2016 -0400
Revert topic 'refactor-cmListFileBacktrace'
It will be revised and restored.
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index f198ac3..d5d0184 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -400,40 +400,13 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot snapshot,
cmCommandContext const& cc)
- : Snapshot(snapshot)
+ : Context(cc)
+ , Snapshot(snapshot)
{
- if (!this->Snapshot.IsValid())
- {
- return;
- }
-
- // Record the entire call stack now so that the `Snapshot` we
- // save for later refers to a long-lived scope. This avoids
- // having to keep short-lived scopes around just to extract
- // their backtrace information later.
-
- cmListFileContext lfc =
- cmListFileContext::FromCommandContext(
- cc, this->Snapshot.GetExecutionListFile());
- this->push_back(lfc);
-
- cmState::Snapshot parent = this->Snapshot.GetCallStackParent();
- while (parent.IsValid())
+ if (this->Snapshot.IsValid())
{
- lfc.Name = this->Snapshot.GetEntryPointCommand();
- lfc.Line = this->Snapshot.GetEntryPointLine();
- lfc.FilePath = parent.GetExecutionListFile();
- if (lfc.FilePath.empty())
- {
- break;
- }
- this->push_back(lfc);
-
- this->Snapshot = parent;
- parent = parent.GetCallStackParent();
+ this->Snapshot.Keep();
}
-
- this->Snapshot = this->Snapshot.GetCallStackBottom();
}
cmListFileBacktrace::~cmListFileBacktrace()
@@ -442,30 +415,48 @@ cmListFileBacktrace::~cmListFileBacktrace()
void cmListFileBacktrace::PrintTitle(std::ostream& out) const
{
- if (this->empty())
+ if (!this->Snapshot.IsValid())
{
return;
}
cmOutputConverter converter(this->Snapshot);
- cmListFileContext lfc = this->front();
+ cmListFileContext lfc =
+ cmListFileContext::FromCommandContext(
+ this->Context, this->Snapshot.GetExecutionListFile());
lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
out << (lfc.Line ? " at " : " in ") << lfc;
}
void cmListFileBacktrace::PrintCallStack(std::ostream& out) const
{
- if (this->size() <= 1)
+ if (!this->Snapshot.IsValid())
+ {
+ return;
+ }
+ cmState::Snapshot parent = this->Snapshot.GetCallStackParent();
+ if (!parent.IsValid() || parent.GetExecutionListFile().empty())
{
return;
}
- out << "Call Stack (most recent call first):\n";
cmOutputConverter converter(this->Snapshot);
- for (const_iterator i = this->begin() + 1; i != this->end(); ++i)
+ std::string commandName = this->Snapshot.GetEntryPointCommand();
+ long commandLine = this->Snapshot.GetEntryPointLine();
+
+ out << "Call Stack (most recent call first):\n";
+ while(parent.IsValid())
{
- cmListFileContext lfc = *i;
- lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
+ cmListFileContext lfc;
+ lfc.Name = commandName;
+ lfc.Line = commandLine;
+
+ lfc.FilePath = converter.Convert(parent.GetExecutionListFile(),
+ cmOutputConverter::HOME);
out << " " << lfc << "\n";
+
+ commandName = parent.GetEntryPointCommand();
+ commandLine = parent.GetEntryPointLine();
+ parent = parent.GetCallStackParent();
}
}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index d3cab22..4d3055f 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -87,7 +87,7 @@ struct cmListFileFunction: public cmCommandContext
std::vector<cmListFileArgument> Arguments;
};
-class cmListFileBacktrace: private std::vector<cmListFileContext>
+class cmListFileBacktrace
{
public:
cmListFileBacktrace(cmState::Snapshot snapshot = cmState::Snapshot(),
@@ -97,6 +97,7 @@ class cmListFileBacktrace: private std::vector<cmListFileContext>
void PrintTitle(std::ostream& out) const;
void PrintCallStack(std::ostream& out) const;
private:
+ cmCommandContext Context;
cmState::Snapshot Snapshot;
};
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index bec5682..be8e418 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -1098,6 +1098,11 @@ void cmState::Directory::SetCurrentBinary(std::string const& dir)
this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc.c_str());
}
+void cmState::Snapshot::Keep()
+{
+ this->Position->Keep = true;
+}
+
void cmState::Snapshot::SetListFile(const std::string& listfile)
{
*this->Position->ExecutionListFile = listfile;
@@ -1208,21 +1213,6 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
return snapshot;
}
-cmState::Snapshot cmState::Snapshot::GetCallStackBottom() const
-{
- assert(this->State);
- assert(this->Position != this->State->SnapshotData.Root());
-
- PositionType pos = this->Position;
- while (pos->SnapshotType != cmState::BaseType &&
- pos->SnapshotType != cmState::BuildsystemDirectoryType &&
- pos != this->State->SnapshotData.Root())
- {
- ++pos;
- }
- return Snapshot(this->State, pos);
-}
-
void cmState::Snapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak)
{
PositionType pos = this->Position;
diff --git a/Source/cmState.h b/Source/cmState.h
index 507d500..ef61406 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -63,6 +63,7 @@ public:
std::vector<std::string> ClosureKeys() const;
bool RaiseScope(std::string const& var, const char* varDef);
+ void Keep();
void SetListFile(std::string const& listfile);
std::string GetExecutionListFile() const;
@@ -74,7 +75,6 @@ public:
bool IsValid() const;
Snapshot GetBuildsystemDirectoryParent() const;
Snapshot GetCallStackParent() const;
- Snapshot GetCallStackBottom() const;
SnapshotType GetType() const;
void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status);
-----------------------------------------------------------------------
Summary of changes:
Source/cmListFileCache.cxx | 67 +++++++++++++++++++-------------------------
Source/cmListFileCache.h | 3 +-
Source/cmState.cxx | 20 ++++---------
Source/cmState.h | 2 +-
4 files changed, 37 insertions(+), 55 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list