[clang] [CIR] Add pass_object_size hidden parameter support (PR #191482)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 15 12:10:28 PDT 2026


================
@@ -710,20 +710,28 @@ static CanQual<FunctionProtoType> getFormalType(const CXXMethodDecl *md) {
       .getAs<FunctionProtoType>();
 }
 
-/// Adds the formal parameters in FPT to the given prefix. If any parameter in
-/// FPT has pass_object_size_attrs, then we'll add parameters for those, too.
+/// Adds the formal parameters in FPT to the given prefix.  If any parameter in
+/// FPT has pass_object_size attrs, then we'll add parameters for those, too.
 /// TODO(cir): this should be shared with LLVM codegen
 static void appendParameterTypes(const CIRGenTypes &cgt,
                                  SmallVectorImpl<CanQualType> &prefix,
                                  CanQual<FunctionProtoType> fpt) {
-  assert(!cir::MissingFeatures::opCallExtParameterInfo());
   // Fast path: don't touch param info if we don't need to.
   if (!fpt->hasExtParameterInfos()) {
     prefix.append(fpt->param_type_begin(), fpt->param_type_end());
     return;
   }
 
-  cgt.getCGModule().errorNYI("appendParameterTypes: hasExtParameterInfos");
+  // In the vast majority of cases, we'll have precisely FPT->getNumParams()
+  // parameters; the only thing that can change this is the presence of
+  // pass_object_size.  So, we preallocate for the common case.
+  prefix.reserve(prefix.size() + fpt->getNumParams());
+  auto extInfos = fpt->getExtParameterInfos();
----------------
adams381 wrote:

Done -- using explicit `ArrayRef<FunctionProtoType::ExtParameterInfo>`.

https://github.com/llvm/llvm-project/pull/191482


More information about the cfe-commits mailing list