summaryrefslogtreecommitdiff
path: root/Source/cmWhileCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-20 19:13:52 +0200
committerStephen Kelly <steveire@gmail.com>2015-10-20 23:40:12 +0200
commitd6a03b475e023da9b7532a5b8735caec36b5de86 (patch)
tree5a7fce28bcc989ae6a841118b2031f162ae3b705 /Source/cmWhileCommand.cxx
parent22bfb39dea2476df8f7aa5ed5c773a7a6720c4bc (diff)
downloadcmake-d6a03b475e023da9b7532a5b8735caec36b5de86.tar.gz
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/cmWhileCommand.cxx')
-rw-r--r--Source/cmWhileCommand.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 012c580f0a..4b7afd87a5 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -49,7 +49,20 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
mf.ExpandArguments(this->Args, expandedArguments);
cmake::MessageType messageType;
- cmConditionEvaluator conditionEvaluator(mf);
+ cmListFileContext execContext = this->GetStartingContext();
+
+ cmCommandContext commandContext;
+ commandContext.Line = execContext.Line;
+ commandContext.Name = execContext.Name;
+
+ cmListFileContext conditionContext =
+ cmConditionEvaluator::GetConditionContext(
+ &mf, commandContext,
+ this->GetStartingContext().FilePath);
+
+ cmConditionEvaluator conditionEvaluator(
+ mf, conditionContext,
+ mf.GetBacktrace(commandContext));
bool isTrue = conditionEvaluator.IsTrue(
expandedArguments, errorString, messageType);