summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmConditionEvaluator.cxx4
-rw-r--r--Source/cmMakefile.cxx14
-rw-r--r--Source/cmMakefile.h1
3 files changed, 13 insertions, 6 deletions
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 73aface..e5a89b6 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -113,7 +113,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted(
if(def && argument.WasQuoted() && this->Policy54Status == cmPolicies::WARN)
{
bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported(
- this->Makefile.GetBacktrace()[0]);
+ this->Makefile.GetExecutionContext());
if(!hasBeenReported)
{
@@ -162,7 +162,7 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword,
this->Policy54Status == cmPolicies::WARN)
{
bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported(
- this->Makefile.GetBacktrace()[0]);
+ this->Makefile.GetExecutionContext());
if(!hasBeenReported)
{
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 272ac4c..4de3bcd 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -378,6 +378,12 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
}
//----------------------------------------------------------------------------
+cmListFileContext cmMakefile::GetExecutionContext() const
+{
+ return *this->CallStack.back().Context;
+}
+
+//----------------------------------------------------------------------------
void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
{
std::ostringstream msg;
@@ -1937,9 +1943,9 @@ void cmMakefile::CheckForUnused(const char* reason,
cmListFileBacktrace bt(this->GetLocalGenerator());
if (!this->CallStack.empty())
{
- const cmListFileContext* file = this->CallStack.back().Context;
- bt.push_back(*file);
- path = file->FilePath.c_str();
+ cmListFileContext file = this->GetExecutionContext();
+ bt.push_back(file);
+ path = file.FilePath;
}
else
{
@@ -3410,7 +3416,7 @@ void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
if(!this->CallStack.empty())
{
// Record the context in which the blocker is created.
- fb->SetStartingContext(*(this->CallStack.back().Context));
+ fb->SetStartingContext(this->GetExecutionContext());
}
this->FunctionBlockers.push_back(fb);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 453884a..5ef2ec9 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -610,6 +610,7 @@ public:
* Get the current context backtrace.
*/
cmListFileBacktrace GetBacktrace() const;
+ cmListFileContext GetExecutionContext() const;
/**
* Get the vector of files created by this makefile