summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-01-25 13:37:37 (GMT)
committerBrad King <brad.king@kitware.com>2022-01-25 13:39:52 (GMT)
commit03866411423c1b844580eb4879f378a592d73809 (patch)
treef9023f091e1ad1f99bf8064ffe6e8e545d253f43
parent3c4fa4c8924c1e219981bbc30ad02a89fd144ab6 (diff)
downloadCMake-03866411423c1b844580eb4879f378a592d73809.zip
CMake-03866411423c1b844580eb4879f378a592d73809.tar.gz
CMake-03866411423c1b844580eb4879f378a592d73809.tar.bz2
cmListFileCache: Rename FromCommandContext to FromListFileFunction
Accept a `cmListFileFunction` instead of a `cmCommandContext`.
-rw-r--r--Source/cmFunctionBlocker.cxx2
-rw-r--r--Source/cmListFileCache.cxx28
-rw-r--r--Source/cmListFileCache.h5
-rw-r--r--Source/cmMakefile.cxx2
4 files changed, 19 insertions, 18 deletions
diff --git a/Source/cmFunctionBlocker.cxx b/Source/cmFunctionBlocker.cxx
index d4666d7..40e692d 100644
--- a/Source/cmFunctionBlocker.cxx
+++ b/Source/cmFunctionBlocker.cxx
@@ -27,7 +27,7 @@ bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
if (!this->ArgumentsMatch(lff, mf)) {
cmListFileContext const& lfc = this->GetStartingContext();
cmListFileContext closingContext =
- cmListFileContext::FromCommandContext(lff, lfc.FilePath);
+ cmListFileContext::FromListFileFunction(lff, lfc.FilePath);
std::ostringstream e;
/* clang-format off */
e << "A logical block opening on the line\n"
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 9f8a18f..3da266d 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -369,68 +369,68 @@ cm::optional<cmListFileContext> cmListFileParser::CheckNesting() const
if (name == "if") {
stack.push_back({
NestingStateEnum::If,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
});
} else if (name == "elseif") {
if (!TopIs(stack, NestingStateEnum::If)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.back() = {
NestingStateEnum::If,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
};
} else if (name == "else") {
if (!TopIs(stack, NestingStateEnum::If)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.back() = {
NestingStateEnum::Else,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
};
} else if (name == "endif") {
if (!TopIs(stack, NestingStateEnum::If) &&
!TopIs(stack, NestingStateEnum::Else)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.pop_back();
} else if (name == "while") {
stack.push_back({
NestingStateEnum::While,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
});
} else if (name == "endwhile") {
if (!TopIs(stack, NestingStateEnum::While)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.pop_back();
} else if (name == "foreach") {
stack.push_back({
NestingStateEnum::Foreach,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
});
} else if (name == "endforeach") {
if (!TopIs(stack, NestingStateEnum::Foreach)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.pop_back();
} else if (name == "function") {
stack.push_back({
NestingStateEnum::Function,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
});
} else if (name == "endfunction") {
if (!TopIs(stack, NestingStateEnum::Function)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.pop_back();
} else if (name == "macro") {
stack.push_back({
NestingStateEnum::Macro,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
});
} else if (name == "endmacro") {
if (!TopIs(stack, NestingStateEnum::Macro)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.pop_back();
}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 16ba2c2..1d45b30 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -143,10 +143,11 @@ public:
{
}
- static cmListFileContext FromCommandContext(
- cmCommandContext const& lfcc, std::string const& fileName,
+ static cmListFileContext FromListFileFunction(
+ cmListFileFunction const& lff, std::string const& fileName,
cm::optional<std::string> deferId = {})
{
+ cmCommandContext const& lfcc = lff;
cmListFileContext lfc;
lfc.FilePath = fileName;
lfc.Line = lfcc.Line;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cc687b1..68e61bb 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -339,7 +339,7 @@ public:
cm::optional<std::string> deferId, cmExecutionStatus& status)
: Makefile(mf)
{
- cmListFileContext const& lfc = cmListFileContext::FromCommandContext(
+ cmListFileContext const& lfc = cmListFileContext::FromListFileFunction(
lff, this->Makefile->StateSnapshot.GetExecutionListFile(),
std::move(deferId));
this->Makefile->Backtrace = this->Makefile->Backtrace.Push(lfc);