mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-20 21:28:23 -05:00
cmMakefile: Replace GetExecutionFilePath with the top of the Backtrace
The execution file path stack and the backtrace stack are kept in sync. At all call sites of `GetExecutionFilePath`, the execution file path matches the path in the context at the top of the backtrace stack.
This commit is contained in:
+5
-11
@@ -279,7 +279,7 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
|
|||||||
// Check if current file in the list of requested to trace...
|
// Check if current file in the list of requested to trace...
|
||||||
std::vector<std::string> const& trace_only_this_files =
|
std::vector<std::string> const& trace_only_this_files =
|
||||||
this->GetCMakeInstance()->GetTraceSources();
|
this->GetCMakeInstance()->GetTraceSources();
|
||||||
std::string const& full_path = this->GetExecutionFilePath();
|
std::string const& full_path = this->GetBacktrace().Top().FilePath;
|
||||||
std::string const& only_filename = cmSystemTools::GetFilenameName(full_path);
|
std::string const& only_filename = cmSystemTools::GetFilenameName(full_path);
|
||||||
bool trace = trace_only_this_files.empty();
|
bool trace = trace_only_this_files.empty();
|
||||||
if (!trace) {
|
if (!trace) {
|
||||||
@@ -578,7 +578,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
|
|||||||
std::ostringstream w;
|
std::ostringstream w;
|
||||||
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0011) << "\n"
|
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0011) << "\n"
|
||||||
<< "The included script\n "
|
<< "The included script\n "
|
||||||
<< this->Makefile->GetExecutionFilePath() << "\n"
|
<< this->Makefile->GetBacktrace().Top().FilePath << "\n"
|
||||||
<< "affects policy settings. "
|
<< "affects policy settings. "
|
||||||
<< "CMake is implying the NO_POLICY_SCOPE option for compatibility, "
|
<< "CMake is implying the NO_POLICY_SCOPE option for compatibility, "
|
||||||
<< "so the effects are applied to the including context.";
|
<< "so the effects are applied to the including context.";
|
||||||
@@ -591,7 +591,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
|
|||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n"
|
e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n"
|
||||||
<< "The included script\n "
|
<< "The included script\n "
|
||||||
<< this->Makefile->GetExecutionFilePath() << "\n"
|
<< this->Makefile->GetBacktrace().Top().FilePath << "\n"
|
||||||
<< "affects policy settings, so it requires this policy to be set.";
|
<< "affects policy settings, so it requires this policy to be set.";
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
||||||
@@ -3328,16 +3328,10 @@ bool cmMakefile::IsLoopBlock() const
|
|||||||
return !this->LoopBlockCounter.empty() && this->LoopBlockCounter.top() > 0;
|
return !this->LoopBlockCounter.empty() && this->LoopBlockCounter.top() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& cmMakefile::GetExecutionFilePath() const
|
|
||||||
{
|
|
||||||
assert(this->StateSnapshot.IsValid());
|
|
||||||
return this->StateSnapshot.GetExecutionListFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cmMakefile::ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
|
bool cmMakefile::ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
|
||||||
std::vector<std::string>& outArgs) const
|
std::vector<std::string>& outArgs) const
|
||||||
{
|
{
|
||||||
std::string const& filename = this->GetExecutionFilePath();
|
std::string const& filename = this->GetBacktrace().Top().FilePath;
|
||||||
std::string value;
|
std::string value;
|
||||||
outArgs.reserve(inArgs.size());
|
outArgs.reserve(inArgs.size());
|
||||||
for (cmListFileArgument const& i : inArgs) {
|
for (cmListFileArgument const& i : inArgs) {
|
||||||
@@ -3366,7 +3360,7 @@ bool cmMakefile::ExpandArguments(
|
|||||||
std::vector<cmListFileArgument> const& inArgs,
|
std::vector<cmListFileArgument> const& inArgs,
|
||||||
std::vector<cmExpandedCommandArgument>& outArgs) const
|
std::vector<cmExpandedCommandArgument>& outArgs) const
|
||||||
{
|
{
|
||||||
std::string const& filename = this->GetExecutionFilePath();
|
std::string const& filename = this->GetBacktrace().Top().FilePath;
|
||||||
std::string value;
|
std::string value;
|
||||||
outArgs.reserve(inArgs.size());
|
outArgs.reserve(inArgs.size());
|
||||||
for (cmListFileArgument const& i : inArgs) {
|
for (cmListFileArgument const& i : inArgs) {
|
||||||
|
|||||||
@@ -937,8 +937,6 @@ public:
|
|||||||
|
|
||||||
const char* GetDefineFlagsCMP0059() const;
|
const char* GetDefineFlagsCMP0059() const;
|
||||||
|
|
||||||
std::string const& GetExecutionFilePath() const;
|
|
||||||
|
|
||||||
void EnforceDirectoryLevelRules() const;
|
void EnforceDirectoryLevelRules() const;
|
||||||
|
|
||||||
void AddEvaluationFile(
|
void AddEvaluationFile(
|
||||||
|
|||||||
Reference in New Issue
Block a user