diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-05-29 20:37:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-07-06 15:22:42 (GMT) |
commit | d2475bb5c4488a0ef6015f13ee46ddc7a2e4455b (patch) | |
tree | d590a226216dde3fad489be3170f240b40f459ee /Source/cmMakefile.cxx | |
parent | 238aac23514ecdae0d4edb71033e443f30e94158 (diff) | |
download | CMake-d2475bb5c4488a0ef6015f13ee46ddc7a2e4455b.zip CMake-d2475bb5c4488a0ef6015f13ee46ddc7a2e4455b.tar.gz CMake-d2475bb5c4488a0ef6015f13ee46ddc7a2e4455b.tar.bz2 |
cmListFileBacktrace: Implement in terms of cmState::Snapshot.
Avoid copying many strings into each backtrace object.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9f2abff..94c77e1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -275,43 +275,21 @@ void cmMakefile::IssueMessage(cmake::MessageType t, //---------------------------------------------------------------------------- cmListFileBacktrace cmMakefile::GetBacktrace() const { - cmListFileBacktrace backtrace(this->StateSnapshot); - cmState::Snapshot snp = this->StateSnapshot; - for(std::vector<cmCommandContext const*>::const_reverse_iterator - i = this->ContextStack.rbegin(); - i != this->ContextStack.rend(); - ++i, snp = snp.GetCallStackParent()) + cmListFileBacktrace backtrace; + if (!this->ContextStack.empty()) { - assert(snp.IsValid()); - cmListFileContext frame = - cmListFileContext::FromCommandContext(*(*i), - snp.GetExecutionListFile()); - backtrace.Append(frame); + backtrace = cmListFileBacktrace(this->StateSnapshot, + *this->ContextStack.back()); } return backtrace; } //---------------------------------------------------------------------------- cmListFileBacktrace -cmMakefile::GetBacktrace(cmListFileContext const& lfc) const +cmMakefile::GetBacktrace(cmCommandContext const& cc) const { - cmListFileBacktrace backtrace(this->StateSnapshot); - backtrace.Append(lfc); cmState::Snapshot snp = this->StateSnapshot; - assert(snp.GetExecutionListFile() == lfc.FilePath); - snp = snp.GetCallStackParent(); - for(std::vector<cmCommandContext const*>::const_reverse_iterator - i = this->ContextStack.rbegin(); - i != this->ContextStack.rend(); - ++i, snp = snp.GetCallStackParent()) - { - assert(snp.IsValid()); - cmListFileContext frame = - cmListFileContext::FromCommandContext(*(*i), - snp.GetExecutionListFile()); - backtrace.Append(frame); - } - return backtrace; + return cmListFileBacktrace(snp, cc); } //---------------------------------------------------------------------------- |