[clang] [CIR] Add nonnull on returns and pointer params (PR #188281)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 21 14:50:15 PDT 2026
================
@@ -693,8 +696,19 @@ 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 array of ParmVarDecls aligned with argAttrs so we can
+ // access parameter-level attributes (e.g. nonnull) in the zip loop below.
+ SmallVector<const ParmVarDecl *> parmDecls(argAttrs.size(), nullptr);
----------------
erichkeane wrote:
```suggestion
SmallVector<const ParmVarDecl *> parmDecls;
parmDecls.reserve(argAttrs.size());
```
https://github.com/llvm/llvm-project/pull/188281
More information about the cfe-commits
mailing list