diff options
author | Brad King <brad.king@kitware.com> | 2021-12-07 20:18:17 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-12-08 15:03:48 (GMT) |
commit | 3d378541bb22f00e3a22bf5f12e97b7943a81294 (patch) | |
tree | 853fa2666199c276b677e28c6b9c15fce70481c9 /Source/cmListFileCache.cxx | |
parent | 642238b3021ccb1923e57563bb61e0abb0111c84 (diff) | |
download | CMake-3d378541bb22f00e3a22bf5f12e97b7943a81294.zip CMake-3d378541bb22f00e3a22bf5f12e97b7943a81294.tar.gz CMake-3d378541bb22f00e3a22bf5f12e97b7943a81294.tar.bz2 |
cmMessenger: Adopt backtrace printing functions
Move backtrace printing functions from `cmListFileBacktrace` over to
`cmMessenger`, their primary caller. Thread `cmMessenger` instances
through APIs needed to update other call sites.
Diffstat (limited to 'Source/cmListFileCache.cxx')
-rw-r--r-- | Source/cmListFileCache.cxx | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 2e444f2..4c434a3 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -14,7 +14,6 @@ #include "cmListFileLexer.h" #include "cmMessageType.h" #include "cmMessenger.h" -#include "cmState.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -540,53 +539,6 @@ cmListFileContext const& cmListFileBacktrace::Top() const return this->TopEntry->Context; } -void cmListFileBacktrace::PrintTitle(std::ostream& out) const -{ - // The title exists only if we have a call on top of the bottom. - if (!this->TopEntry || this->TopEntry->IsBottom()) { - return; - } - cmListFileContext lfc = this->TopEntry->Context; - cmStateSnapshot bottom = this->GetBottom(); - if (bottom.GetState()->GetProjectKind() == cmState::ProjectKind::Normal) { - lfc.FilePath = cmSystemTools::RelativeIfUnder( - bottom.GetState()->GetSourceDirectory(), lfc.FilePath); - } - out << (lfc.Line ? " at " : " in ") << lfc; -} - -void cmListFileBacktrace::PrintCallStack(std::ostream& out) const -{ - // The call stack exists only if we have at least two calls on top - // of the bottom. - if (!this->TopEntry || this->TopEntry->IsBottom() || - this->TopEntry->Parent->IsBottom()) { - return; - } - - bool first = true; - cmStateSnapshot bottom = this->GetBottom(); - for (Entry const* cur = this->TopEntry->Parent.get(); !cur->IsBottom(); - cur = cur->Parent.get()) { - if (cur->Context.Name.empty() && - cur->Context.Line != cmListFileContext::DeferPlaceholderLine) { - // Skip this whole-file scope. When we get here we already will - // have printed a more-specific context within the file. - continue; - } - if (first) { - first = false; - out << "Call Stack (most recent call first):\n"; - } - cmListFileContext lfc = cur->Context; - if (bottom.GetState()->GetProjectKind() == cmState::ProjectKind::Normal) { - lfc.FilePath = cmSystemTools::RelativeIfUnder( - bottom.GetState()->GetSourceDirectory(), lfc.FilePath); - } - out << " " << lfc << "\n"; - } -} - size_t cmListFileBacktrace::Depth() const { size_t depth = 0; |