Author: Timm Baeder
Date: 2026-09-01T06:08:55+02:00
New Revision: e5bbcd0614eb80c6002dbac57ca19f14467ce0ed

URL: 
https://github.com/llvm/llvm-project/commit/e5bbcd0614eb80c6002dbac57ca19f14467ce0ed
DIFF: 
https://github.com/llvm/llvm-project/commit/e5bbcd0614eb80c6002dbac57ca19f14467ce0ed.diff

LOG: [clang][bytecode][NFC] reserve() ParamDescriptors (#219981)

We know the size the vector is going to have in the success case, so
reserve that.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Context.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/Context.cpp 
b/clang/lib/AST/ByteCode/Context.cpp
index 75a5b04cdff19..0212574e4accd 100644
--- a/clang/lib/AST/ByteCode/Context.cpp
+++ b/clang/lib/AST/ByteCode/Context.cpp
@@ -672,7 +672,6 @@ const Function *Context::getOrCreateFunction(const 
FunctionDecl *FuncDecl) {
   }
   // Set up argument indices.
   unsigned ParamOffset = 0;
-  llvm::SmallVector<Function::ParamDescriptor> ParamDescriptors;
 
   // If the return is not a primitive, a pointer to the storage where the
   // value is initialized in is passed as the first argument. See 'RVO'
@@ -715,6 +714,9 @@ const Function *Context::getOrCreateFunction(const 
FunctionDecl *FuncDecl) {
 
   // Assign descriptors to all parameters.
   // Composite objects are lowered to pointers.
+  llvm::SmallVector<Function::ParamDescriptor> ParamDescriptors;
+  ParamDescriptors.reserve(FuncDecl->getNumParams());
+
   const auto *FuncProto = FuncDecl->getType()->getAs<FunctionProtoType>();
   unsigned BlockOffset = 0;
   for (auto [ParamIndex, PD] : llvm::enumerate(FuncDecl->parameters())) {


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to