[Lldb-commits] [lldb] r349967 - [ExpressionParser] Reserve size before copying over args

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 21 14:16:10 PST 2018


Author: jdevlieghere
Date: Fri Dec 21 14:16:10 2018
New Revision: 349967

URL: http://llvm.org/viewvc/llvm-project?rev=349967&view=rev
Log:
[ExpressionParser] Reserve size before copying over args

We already know the final size here so we might as well reserve it so we
don't have to re-allocate during the loop.

Modified:
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=349967&r1=349966&r2=349967&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp Fri Dec 21 14:16:10 2018
@@ -608,7 +608,8 @@ ClangModulesDeclVendor::Create(Target &t
                                                  new StoringDiagnosticConsumer);
 
   std::vector<const char *> compiler_invocation_argument_cstrs;
-
+  compiler_invocation_argument_cstrs.reserve(
+      compiler_invocation_arguments.size());
   for (const std::string &arg : compiler_invocation_arguments) {
     compiler_invocation_argument_cstrs.push_back(arg.c_str());
   }




More information about the lldb-commits mailing list