cmMakefile: Add access to the top-level execution context.
This is cheaper than getting the whole backtrace, and the cmListFileBacktrace will not always be composed of cmListFileContext objects.
This commit is contained in:
parent
1ec1bf9f07
commit
e17b5e4262
|
@ -113,7 +113,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted(
|
||||||
if(def && argument.WasQuoted() && this->Policy54Status == cmPolicies::WARN)
|
if(def && argument.WasQuoted() && this->Policy54Status == cmPolicies::WARN)
|
||||||
{
|
{
|
||||||
bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported(
|
bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported(
|
||||||
this->Makefile.GetBacktrace()[0]);
|
this->Makefile.GetExecutionContext());
|
||||||
|
|
||||||
if(!hasBeenReported)
|
if(!hasBeenReported)
|
||||||
{
|
{
|
||||||
|
@ -162,7 +162,7 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword,
|
||||||
this->Policy54Status == cmPolicies::WARN)
|
this->Policy54Status == cmPolicies::WARN)
|
||||||
{
|
{
|
||||||
bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported(
|
bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported(
|
||||||
this->Makefile.GetBacktrace()[0]);
|
this->Makefile.GetExecutionContext());
|
||||||
|
|
||||||
if(!hasBeenReported)
|
if(!hasBeenReported)
|
||||||
{
|
{
|
||||||
|
|
|
@ -377,6 +377,12 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
|
||||||
return backtrace;
|
return backtrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
cmListFileContext cmMakefile::GetExecutionContext() const
|
||||||
|
{
|
||||||
|
return *this->CallStack.back().Context;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
|
void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
|
||||||
{
|
{
|
||||||
|
@ -1937,9 +1943,9 @@ void cmMakefile::CheckForUnused(const char* reason,
|
||||||
cmListFileBacktrace bt(this->GetLocalGenerator());
|
cmListFileBacktrace bt(this->GetLocalGenerator());
|
||||||
if (!this->CallStack.empty())
|
if (!this->CallStack.empty())
|
||||||
{
|
{
|
||||||
const cmListFileContext* file = this->CallStack.back().Context;
|
cmListFileContext file = this->GetExecutionContext();
|
||||||
bt.push_back(*file);
|
bt.push_back(file);
|
||||||
path = file->FilePath.c_str();
|
path = file.FilePath;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3410,7 +3416,7 @@ void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
|
||||||
if(!this->CallStack.empty())
|
if(!this->CallStack.empty())
|
||||||
{
|
{
|
||||||
// Record the context in which the blocker is created.
|
// Record the context in which the blocker is created.
|
||||||
fb->SetStartingContext(*(this->CallStack.back().Context));
|
fb->SetStartingContext(this->GetExecutionContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
this->FunctionBlockers.push_back(fb);
|
this->FunctionBlockers.push_back(fb);
|
||||||
|
|
|
@ -610,6 +610,7 @@ public:
|
||||||
* Get the current context backtrace.
|
* Get the current context backtrace.
|
||||||
*/
|
*/
|
||||||
cmListFileBacktrace GetBacktrace() const;
|
cmListFileBacktrace GetBacktrace() const;
|
||||||
|
cmListFileContext GetExecutionContext() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the vector of files created by this makefile
|
* Get the vector of files created by this makefile
|
||||||
|
|
Loading…
Reference in New Issue