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/cmCMakeLanguageCommand.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/cmCMakeLanguageCommand.cxx')
-rw-r--r-- | Source/cmCMakeLanguageCommand.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx index 9277c20..789c78d 100644 --- a/Source/cmCMakeLanguageCommand.cxx +++ b/Source/cmCMakeLanguageCommand.cxx @@ -77,18 +77,14 @@ bool cmCMakeLanguageCommandCALL(std::vector<cmListFileArgument> const& args, cmMakefile& makefile = status.GetMakefile(); cmListFileContext context = makefile.GetBacktrace().Top(); - cmListFileFunction func; - func.Name = callCommand; - func.Line = context.Line; + std::vector<cmListFileArgument> funcArgs; + funcArgs.reserve(args.size() - startArg); // The rest of the arguments are passed to the function call above for (size_t i = startArg; i < args.size(); ++i) { - cmListFileArgument lfarg; - lfarg.Delim = args[i].Delim; - lfarg.Line = context.Line; - lfarg.Value = args[i].Value; - func.Arguments.emplace_back(lfarg); + funcArgs.emplace_back(args[i].Value, args[i].Delim, context.Line); } + cmListFileFunction func{ callCommand, context.Line, std::move(funcArgs) }; if (defer) { if (defer->Id.empty()) { |