cmMakefile: Add API for elseif to create backtrace.

This commit is contained in:
Stephen Kelly 2015-05-29 01:14:19 +02:00
parent 17e13f0a2d
commit b68f2ea8ae
3 changed files with 17 additions and 5 deletions

View File

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

View File

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

View File

@ -572,6 +572,7 @@ public:
* Get the current context backtrace.
*/
cmListFileBacktrace GetBacktrace() const;
cmListFileBacktrace GetBacktrace(cmListFileContext const& lfc) const;
cmListFileContext GetExecutionContext() const;
/**