diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-05-18 19:33:38 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-05-18 21:56:00 (GMT) |
commit | 61d52e6e77bef903225bd3bad3e381bac73ee557 (patch) | |
tree | 40b42b258872096cab15ca5aaac95edc1a2a089d /Source/cmListFileCache.cxx | |
parent | a271f7f17707c50744c2dbeb20ae82b10c886f4f (diff) | |
download | CMake-61d52e6e77bef903225bd3bad3e381bac73ee557.zip CMake-61d52e6e77bef903225bd3bad3e381bac73ee557.tar.gz CMake-61d52e6e77bef903225bd3bad3e381bac73ee557.tar.bz2 |
cmListFileBacktrace: Hide the context-stack implementation detail.
The backtrace will soon not be implemented in terms of a stack of
cmListFileContext objects. Keep the cmListFileContext in the API
for convenience for now.
Diffstat (limited to 'Source/cmListFileCache.cxx')
-rw-r--r-- | Source/cmListFileCache.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 3e3d708..2756cd2 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -400,6 +400,11 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, } } +void cmListFileBacktrace::Append(cmListFileContext const& context) +{ + this->push_back(context); +} + //---------------------------------------------------------------------------- void cmListFileBacktrace::MakeRelative() { @@ -416,6 +421,31 @@ void cmListFileBacktrace::MakeRelative() this->Relative = true; } +void cmListFileBacktrace::PrintTitle(std::ostream& out) +{ + if (this->empty()) + { + return; + } + out << (this->front().Line ? " at " : " in ") << this->front(); +} + +void cmListFileBacktrace::PrintCallStack(std::ostream& out) +{ + if (size() <= 1) + { + return; + } + + const_iterator i = this->begin() + 1; + out << "Call Stack (most recent call first):\n"; + while(i != this->end()) + { + cmListFileContext const& lfc = *i; + out << " " << lfc << "\n"; + ++i; + } +} //---------------------------------------------------------------------------- std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc) |