mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user