cmMakefile: Split CallStack into two pieces.
This commit is contained in:
parent
27ff19a96a
commit
dbafb01580
|
@ -247,11 +247,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
|
||||||
std::string const& text) const
|
std::string const& text) const
|
||||||
{
|
{
|
||||||
// Collect context information.
|
// Collect context information.
|
||||||
if(!this->CallStack.empty())
|
if(!this->ExecutionStatusStack.empty())
|
||||||
{
|
{
|
||||||
if((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR))
|
if((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR))
|
||||||
{
|
{
|
||||||
this->CallStack.back().Status->SetNestedError(true);
|
this->ExecutionStatusStack.back()->SetNestedError(true);
|
||||||
}
|
}
|
||||||
this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace());
|
this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace());
|
||||||
}
|
}
|
||||||
|
@ -276,10 +276,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
|
||||||
cmListFileBacktrace cmMakefile::GetBacktrace() const
|
cmListFileBacktrace cmMakefile::GetBacktrace() const
|
||||||
{
|
{
|
||||||
cmListFileBacktrace backtrace(this->StateSnapshot);
|
cmListFileBacktrace backtrace(this->StateSnapshot);
|
||||||
for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
|
for(std::vector<cmListFileContext const*>::const_reverse_iterator
|
||||||
i != this->CallStack.rend(); ++i)
|
i = this->ContextStack.rbegin();
|
||||||
|
i != this->ContextStack.rend(); ++i)
|
||||||
{
|
{
|
||||||
backtrace.Append(*i->Context);
|
backtrace.Append(*(*i));
|
||||||
}
|
}
|
||||||
return backtrace;
|
return backtrace;
|
||||||
}
|
}
|
||||||
|
@ -290,10 +291,11 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
|
||||||
{
|
{
|
||||||
cmListFileBacktrace backtrace(this->StateSnapshot);
|
cmListFileBacktrace backtrace(this->StateSnapshot);
|
||||||
backtrace.Append(lfc);
|
backtrace.Append(lfc);
|
||||||
for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
|
for(std::vector<cmListFileContext const*>::const_reverse_iterator
|
||||||
i != this->CallStack.rend(); ++i)
|
i = this->ContextStack.rbegin();
|
||||||
|
i != this->ContextStack.rend(); ++i)
|
||||||
{
|
{
|
||||||
backtrace.Append(*i->Context);
|
backtrace.Append(*(*i));
|
||||||
}
|
}
|
||||||
return backtrace;
|
return backtrace;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +303,7 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmListFileContext cmMakefile::GetExecutionContext() const
|
cmListFileContext cmMakefile::GetExecutionContext() const
|
||||||
{
|
{
|
||||||
return *this->CallStack.back().Context;
|
return *this->ContextStack.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -1996,7 +1998,7 @@ void cmMakefile::LogUnused(const char* reason,
|
||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
cmListFileContext lfc;
|
cmListFileContext lfc;
|
||||||
if (!this->CallStack.empty())
|
if (!this->ExecutionStatusStack.empty())
|
||||||
{
|
{
|
||||||
lfc = this->GetExecutionContext();
|
lfc = this->GetExecutionContext();
|
||||||
path = lfc.FilePath;
|
path = lfc.FilePath;
|
||||||
|
@ -3360,11 +3362,11 @@ bool cmMakefile::IsLoopBlock() const
|
||||||
|
|
||||||
std::string cmMakefile::GetExecutionFilePath() const
|
std::string cmMakefile::GetExecutionFilePath() const
|
||||||
{
|
{
|
||||||
if (this->CallStack.empty())
|
if (this->ContextStack.empty())
|
||||||
{
|
{
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
return this->CallStack.back().Context->FilePath;
|
return this->ContextStack.back()->FilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -3455,7 +3457,7 @@ bool cmMakefile::ExpandArguments(
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
|
void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
|
||||||
{
|
{
|
||||||
if(!this->CallStack.empty())
|
if(!this->ExecutionStatusStack.empty())
|
||||||
{
|
{
|
||||||
// Record the context in which the blocker is created.
|
// Record the context in which the blocker is created.
|
||||||
fb->SetStartingContext(this->GetExecutionContext());
|
fb->SetStartingContext(this->GetExecutionContext());
|
||||||
|
@ -5503,11 +5505,12 @@ cmMakefile::MacroPushPop::~MacroPushPop()
|
||||||
cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmListFileContext& lfc,
|
cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmListFileContext& lfc,
|
||||||
cmExecutionStatus& status): Makefile(mf)
|
cmExecutionStatus& status): Makefile(mf)
|
||||||
{
|
{
|
||||||
cmMakefile::CallStackEntry entry = {&lfc, &status};
|
this->Makefile->ContextStack.push_back(&lfc);
|
||||||
this->Makefile->CallStack.push_back(entry);
|
this->Makefile->ExecutionStatusStack.push_back(&status);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmMakefileCall::~cmMakefileCall()
|
cmMakefileCall::~cmMakefileCall()
|
||||||
{
|
{
|
||||||
this->Makefile->CallStack.pop_back();
|
this->Makefile->ExecutionStatusStack.pop_back();
|
||||||
|
this->Makefile->ContextStack.pop_back();
|
||||||
}
|
}
|
||||||
|
|
|
@ -935,14 +935,8 @@ private:
|
||||||
// stack of list files being read
|
// stack of list files being read
|
||||||
std::vector<std::string> ListFileStack;
|
std::vector<std::string> ListFileStack;
|
||||||
|
|
||||||
// stack of commands being invoked.
|
std::vector<cmListFileContext const*> ContextStack;
|
||||||
struct CallStackEntry
|
std::vector<cmExecutionStatus*> ExecutionStatusStack;
|
||||||
{
|
|
||||||
cmListFileContext const* Context;
|
|
||||||
cmExecutionStatus* Status;
|
|
||||||
};
|
|
||||||
typedef std::vector<CallStackEntry> CallStackType;
|
|
||||||
CallStackType CallStack;
|
|
||||||
friend class cmMakefileCall;
|
friend class cmMakefileCall;
|
||||||
|
|
||||||
std::vector<cmTarget*> ImportedTargetsOwned;
|
std::vector<cmTarget*> ImportedTargetsOwned;
|
||||||
|
|
Loading…
Reference in New Issue