summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-25 14:12:20 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-28 13:49:08 (GMT)
commit727ed0c403ad87c5cae84222d7d69b95b665b63f (patch)
treed932b888f9e3196d956ffc62e7fb77b6a09030ea /Source/cmMakefile.cxx
parente456dae6693dc3a79e2708481a969b43cda188cf (diff)
downloadCMake-727ed0c403ad87c5cae84222d7d69b95b665b63f.zip
CMake-727ed0c403ad87c5cae84222d7d69b95b665b63f.tar.gz
CMake-727ed0c403ad87c5cae84222d7d69b95b665b63f.tar.bz2
cmMakefile: Simplify ExpandArguments signature
The only call sites that pass the explicit file name argument are in function blocker `ArgumentsMatch` methods for `function` and `macro`. We already ensure that they are balanced within a file scope, and the RAII helpers `BuildsystemFileScope` and `ListFileScope` ensure that the backtrace and execution list file stacks unwind to the matching level. Therefore we can assume that the file name where we are checking for matching arguments matches starting file name where those arguments first appeared, and do not need to pass it explicitly.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx23
1 files changed, 8 insertions, 15 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e529896..2147026 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3335,13 +3335,9 @@ std::string const& cmMakefile::GetExecutionFilePath() const
}
bool cmMakefile::ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
- std::vector<std::string>& outArgs,
- const char* filename) const
+ std::vector<std::string>& outArgs) const
{
- if (!filename) {
- auto const& efp = this->GetExecutionFilePath();
- filename = efp.c_str();
- }
+ std::string const& filename = this->GetExecutionFilePath();
std::string value;
outArgs.reserve(inArgs.size());
for (cmListFileArgument const& i : inArgs) {
@@ -3352,8 +3348,8 @@ bool cmMakefile::ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
}
// Expand the variables in the argument.
value = i.Value;
- this->ExpandVariablesInString(value, false, false, false, filename, i.Line,
- false, false);
+ this->ExpandVariablesInString(value, false, false, false, filename.c_str(),
+ i.Line, false, false);
// If the argument is quoted, it should be one argument.
// Otherwise, it may be a list of arguments.
@@ -3368,12 +3364,9 @@ bool cmMakefile::ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
bool cmMakefile::ExpandArguments(
std::vector<cmListFileArgument> const& inArgs,
- std::vector<cmExpandedCommandArgument>& outArgs, const char* filename) const
+ std::vector<cmExpandedCommandArgument>& outArgs) const
{
- if (!filename) {
- auto const& efp = this->GetExecutionFilePath();
- filename = efp.c_str();
- }
+ std::string const& filename = this->GetExecutionFilePath();
std::string value;
outArgs.reserve(inArgs.size());
for (cmListFileArgument const& i : inArgs) {
@@ -3384,8 +3377,8 @@ bool cmMakefile::ExpandArguments(
}
// Expand the variables in the argument.
value = i.Value;
- this->ExpandVariablesInString(value, false, false, false, filename, i.Line,
- false, false);
+ this->ExpandVariablesInString(value, false, false, false, filename.c_str(),
+ i.Line, false, false);
// If the argument is quoted, it should be one argument.
// Otherwise, it may be a list of arguments.