Commit b68f2ea8 authored by Stephen Kelly's avatar Stephen Kelly
Browse files

cmMakefile: Add API for elseif to create backtrace.

parent 17e13f0a
......@@ -92,10 +92,6 @@ IsFunctionBlocked(const cmListFileFunction& lff,
}
else
{
// Place this call on the call stack.
cmMakefileCall stack_manager(&mf, this->Functions[c], status);
static_cast<void>(stack_manager);
// if trace is enabled, print the evaluated "elseif" statement
if(mf.GetCMakeInstance()->GetTrace())
{
......@@ -119,7 +115,8 @@ IsFunctionBlocked(const cmListFileFunction& lff,
{
std::string err = cmIfCommandError(expandedArguments);
err += errorString;
mf.IssueMessage(messType, err);
cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]);
mf.GetCMakeInstance()->IssueMessage(messType, err, bt);
if (messType == cmake::FATAL_ERROR)
{
cmSystemTools::SetFatalErrorOccured();
......
......@@ -286,6 +286,20 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
return backtrace;
}
//----------------------------------------------------------------------------
cmListFileBacktrace
cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
{
cmListFileBacktrace backtrace(this->GetLocalGenerator());
backtrace.Append(lfc);
for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
i != this->CallStack.rend(); ++i)
{
backtrace.Append(*i->Context);
}
return backtrace;
}
//----------------------------------------------------------------------------
cmListFileContext cmMakefile::GetExecutionContext() const
{
......
......@@ -572,6 +572,7 @@ public:
* Get the current context backtrace.
*/
cmListFileBacktrace GetBacktrace() const;
cmListFileBacktrace GetBacktrace(cmListFileContext const& lfc) const;
cmListFileContext GetExecutionContext() const;
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment