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:
Stephen Kelly
2015-05-18 21:33:38 +02:00
parent a271f7f177
commit 61d52e6e77
5 changed files with 44 additions and 24 deletions

View File

@@ -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)