mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 06:40:48 -06:00
cmListFileCache: Rename FromCommandContext to FromListFileFunction
Accept a `cmListFileFunction` instead of a `cmCommandContext`.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user