diff options
author | Oleksandr Koval <oleksandr.koval.dev@gmail.com> | 2020-10-01 11:28:03 (GMT) |
---|---|---|
committer | Oleksandr Koval <oleksandr.koval.dev@gmail.com> | 2020-10-01 11:28:03 (GMT) |
commit | e614528ad1e7d053169535cc32fe566f6eb22d41 (patch) | |
tree | fc81ab6b79afc387519d5b97d088ef99a0454567 /Source/cmMacroCommand.cxx | |
parent | 47b569a85852f716b05ede538e9940392407316c (diff) | |
download | CMake-e614528ad1e7d053169535cc32fe566f6eb22d41.zip CMake-e614528ad1e7d053169535cc32fe566f6eb22d41.tar.gz CMake-e614528ad1e7d053169535cc32fe566f6eb22d41.tar.bz2 |
cmListFileCache: Make cmListFileFunction a shared pointer
Passing cmListFileFunction everywhere by-value involves big overhead.
Now cmListFileFunction stores std::shared_ptr to the underlying data.
Diffstat (limited to 'Source/cmMacroCommand.cxx')
-rw-r--r-- | Source/cmMacroCommand.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 91a600e..98f88c1 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -81,17 +81,14 @@ bool cmMacroHelperCommand::operator()( argVs.emplace_back(argvName); } // Invoke all the functions that were collected in the block. - cmListFileFunction newLFF; // for each function for (cmListFileFunction const& func : this->Functions) { // Replace the formal arguments and then invoke the command. - newLFF.Arguments.clear(); - newLFF.Arguments.reserve(func.Arguments.size()); - newLFF.Name = func.Name; - newLFF.Line = func.Line; + std::vector<cmListFileArgument> newLFFArgs; + newLFFArgs.reserve(func.Arguments().size()); // for each argument of the current function - for (cmListFileArgument const& k : func.Arguments) { + for (cmListFileArgument const& k : func.Arguments()) { cmListFileArgument arg; arg.Value = k.Value; if (k.Delim != cmListFileArgument::Bracket) { @@ -116,8 +113,10 @@ bool cmMacroHelperCommand::operator()( } arg.Delim = k.Delim; arg.Line = k.Line; - newLFF.Arguments.push_back(std::move(arg)); + newLFFArgs.push_back(std::move(arg)); } + cmListFileFunction newLFF{ func.OriginalName(), func.Line(), + std::move(newLFFArgs) }; cmExecutionStatus status(makefile); if (!makefile.ExecuteCommand(newLFF, status) || status.GetNestedError()) { // The error message should have already included the call stack @@ -157,7 +156,7 @@ bool cmMacroFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff, cmMakefile& mf) const { std::vector<std::string> expandedArguments; - mf.ExpandArguments(lff.Arguments, expandedArguments); + mf.ExpandArguments(lff.Arguments(), expandedArguments); return expandedArguments.empty() || expandedArguments[0] == this->Args[0]; } |