summaryrefslogtreecommitdiffstats
path: root/Source/cmIfCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-20 17:13:52 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-10-20 21:40:12 (GMT)
commitd6a03b475e023da9b7532a5b8735caec36b5de86 (patch)
tree5a7fce28bcc989ae6a841118b2031f162ae3b705 /Source/cmIfCommand.cxx
parent22bfb39dea2476df8f7aa5ed5c773a7a6720c4bc (diff)
downloadCMake-d6a03b475e023da9b7532a5b8735caec36b5de86.zip
CMake-d6a03b475e023da9b7532a5b8735caec36b5de86.tar.gz
CMake-d6a03b475e023da9b7532a5b8735caec36b5de86.tar.bz2
cmIfCommand: Issue CMP0054 warning with appropriate context. (#15802)
Commit v3.4.0-rc1~494^2~4 (cmMakefile: Add API for elseif to create backtrace., 2015-05-29) removed the use of cmMakefileCall to push/pop execution context in favor of a new way to create backtraces. However, a call to cmMakefile::GetExecutionContext is still invoked to issue a contextual CMP0054 warning through cmConditionEvaluator. As the elseif is not part of the call stack, this resulted in trying to access an empty vector. Avoid the attempt at getting execution context when evaluating elseif by constructing a context and backtrace on behalf of the cmConditionEvaluator in all cases.
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r--Source/cmIfCommand.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 20448c1..9e71d37 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -106,7 +106,14 @@ IsFunctionBlocked(const cmListFileFunction& lff,
cmake::MessageType messType;
- cmConditionEvaluator conditionEvaluator(mf);
+ cmListFileContext conditionContext =
+ cmConditionEvaluator::GetConditionContext(
+ &mf, this->Functions[c],
+ this->GetStartingContext().FilePath);
+
+ cmConditionEvaluator conditionEvaluator(
+ mf, conditionContext,
+ mf.GetBacktrace(this->Functions[c]));
bool isTrue = conditionEvaluator.IsTrue(
expandedArguments, errorString, messType);
@@ -195,7 +202,16 @@ bool cmIfCommand
cmake::MessageType status;
- cmConditionEvaluator conditionEvaluator(*(this->Makefile));
+ cmListFileContext execContext = this->Makefile->GetExecutionContext();
+
+ cmCommandContext commandContext;
+ commandContext.Line = execContext.Line;
+ commandContext.Name = execContext.Name;
+
+ cmConditionEvaluator conditionEvaluator(
+ *(this->Makefile), cmConditionEvaluator::GetConditionContext(
+ this->Makefile, commandContext, execContext.FilePath),
+ this->Makefile->GetBacktrace());
bool isTrue = conditionEvaluator.IsTrue(
expandedArguments, errorString, status);