================
@@ -668,8 +672,20 @@ void CIRGenModule::constructFunctionArgumentAttributes(
   // that seems risky at the moment. At one point we should evaluate if at 
least
   // dereferenceable, nonnull, and align can be combined.
   const cir::CIRDataLayout &layout = getDataLayout();
-  for (const auto &[argAttrList, argCanType] :
-       llvm::zip_equal(argAttrs, info.arguments())) {
+  const auto *fd = dyn_cast_or_null<FunctionDecl>(targetDecl);
+
+  // Build a parallel vector of ParmVarDecls aligned with argAttrs.
+  // Instance methods have a leading 'this' slot with no ParmVarDecl.
+  SmallVector<const ParmVarDecl *> parmDecls(argAttrs.size(), nullptr);
+  if (fd) {
----------------
erichkeane wrote:

Don't use a loop for this, you should be able to use the range- initializer + a 
`insert` a nullptr at the front.

Second, this is problematic, as it does a `zip_equal` below.  IF this ends up 
being empty or lesser than the list of `arguments` (such as if `!fd`) it makes 
the read on 717 UB.

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

Reply via email to