summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-25 13:17:22 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-28 13:49:08 (GMT)
commite456dae6693dc3a79e2708481a969b43cda188cf (patch)
treed4bb0f716d018dff91eeee9bc73b4dcfb54cbcc8
parent0100a4943eb862409ad0cf9619eca93e170dea4a (diff)
downloadCMake-e456dae6693dc3a79e2708481a969b43cda188cf.zip
CMake-e456dae6693dc3a79e2708481a969b43cda188cf.tar.gz
CMake-e456dae6693dc3a79e2708481a969b43cda188cf.tar.bz2
cmConditionEvaluator: Remove extra copy of execution context
The execution context passed to the constructor always matches the top of the backtrace, so the former can be removed in favor of using only the latter.
-rw-r--r--Source/cmConditionEvaluator.cxx8
-rw-r--r--Source/cmConditionEvaluator.h4
-rw-r--r--Source/cmIfCommand.cxx10
-rw-r--r--Source/cmWhileCommand.cxx3
4 files changed, 6 insertions, 19 deletions
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 7ada8d8..14f10bd74 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -56,10 +56,8 @@ static std::string const keyVERSION_LESS = "VERSION_LESS";
static std::string const keyVERSION_LESS_EQUAL = "VERSION_LESS_EQUAL";
cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile,
- cmListFileContext context,
cmListFileBacktrace bt)
: Makefile(makefile)
- , ExecutionContext(std::move(context))
, Backtrace(std::move(bt))
, Policy12Status(makefile.GetPolicyStatus(cmPolicies::CMP0012))
, Policy54Status(makefile.GetPolicyStatus(cmPolicies::CMP0054))
@@ -147,8 +145,7 @@ cmProp cmConditionEvaluator::GetDefinitionIfUnquoted(
if (def && argument.WasQuoted() &&
this->Policy54Status == cmPolicies::WARN) {
- if (!this->Makefile.HasCMP0054AlreadyBeenReported(
- this->ExecutionContext)) {
+ if (!this->Makefile.HasCMP0054AlreadyBeenReported(this->Backtrace.Top())) {
std::ostringstream e;
e << (cmPolicies::GetPolicyWarning(cmPolicies::CMP0054)) << "\n";
e << "Quoted variables like \"" << argument.GetValue()
@@ -191,8 +188,7 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword,
if (isKeyword && argument.WasQuoted() &&
this->Policy54Status == cmPolicies::WARN) {
- if (!this->Makefile.HasCMP0054AlreadyBeenReported(
- this->ExecutionContext)) {
+ if (!this->Makefile.HasCMP0054AlreadyBeenReported(this->Backtrace.Top())) {
std::ostringstream e;
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0054) << "\n";
e << "Quoted keywords like \"" << argument.GetValue()
diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h
index a4cedff..cf00ede 100644
--- a/Source/cmConditionEvaluator.h
+++ b/Source/cmConditionEvaluator.h
@@ -21,8 +21,7 @@ class cmConditionEvaluator
public:
using cmArgumentList = std::list<cmExpandedCommandArgument>;
- cmConditionEvaluator(cmMakefile& makefile, cmListFileContext context,
- cmListFileBacktrace bt);
+ cmConditionEvaluator(cmMakefile& makefile, cmListFileBacktrace bt);
// this is a shared function for both If and Else to determine if the
// arguments were valid, and if so, was the response true. If there is
@@ -79,7 +78,6 @@ private:
MessageType& status);
cmMakefile& Makefile;
- cmListFileContext ExecutionContext;
cmListFileBacktrace Backtrace;
cmPolicies::PolicyStatus Policy12Status;
cmPolicies::PolicyStatus Policy54Status;
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 557817c..fc257b1 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -120,12 +120,7 @@ bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
MessageType messType;
- cmListFileContext conditionContext =
- cmListFileContext::FromCommandContext(
- func, this->GetStartingContext().FilePath);
-
- cmConditionEvaluator conditionEvaluator(mf, conditionContext,
- elseifBT);
+ cmConditionEvaluator conditionEvaluator(mf, elseifBT);
bool isTrue =
conditionEvaluator.IsTrue(expandedArguments, errorString, messType);
@@ -180,8 +175,7 @@ bool cmIfCommand(std::vector<cmListFileArgument> const& args,
MessageType status;
- cmConditionEvaluator conditionEvaluator(
- makefile, makefile.GetBacktrace().Top(), makefile.GetBacktrace());
+ cmConditionEvaluator conditionEvaluator(makefile, makefile.GetBacktrace());
bool isTrue =
conditionEvaluator.IsTrue(expandedArguments, errorString, status);
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 876ce20..2c7a8a7 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -69,8 +69,7 @@ bool cmWhileFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
cmListFileBacktrace whileBT =
mf.GetBacktrace().Push(this->GetStartingContext());
- cmConditionEvaluator conditionEvaluator(mf, this->GetStartingContext(),
- whileBT);
+ cmConditionEvaluator conditionEvaluator(mf, whileBT);
bool isTrue =
conditionEvaluator.IsTrue(expandedArguments, errorString, messageType);