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

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 28 09:09:04 PDT 2026


================
@@ -716,14 +716,23 @@ static CanQual<FunctionProtoType> getFormalType(const CXXMethodDecl *md) {
 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());
+  ArrayRef<FunctionProtoType::ExtParameterInfo> extInfos =
+      fpt->getExtParameterInfos();
+  for (unsigned i = 0, e = fpt->getNumParams(); i != e; ++i) {
----------------
adams381 wrote:

Replaced `make_range + zip` with `llvm::enumerate(extInfos)` + `fpt->getParamType(i)`.  The `make_range` was needed because `CanQual<FunctionProtoType>` doesn't expose a range accessor through its CanProxy, but `enumerate` avoids the issue entirely and is cleaner.  Also added the `assert(extInfos.size() == fpt->getNumParams())` to match classic codegen.

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


More information about the cfe-commits mailing list