================
@@ -613,16 +614,21 @@ void CIRGenModule::constructFunctionReturnAttributes(
getNaturalPointeeTypeAlignment(retTy).getQuantity()));
}
}
+
+ if (targetDecl && targetDecl->hasAttr<ReturnsNonNullAttr>() &&
+ !codeGenOpts.NullPointerIsValid)
+ retAttrs.set(mlir::LLVM::LLVMDialect::getNonNullAttrName(),
+ mlir::UnitAttr::get(&getMLIRContext()));
}
void CIRGenModule::constructFunctionArgumentAttributes(
- const CIRGenFunctionInfo &info, bool isThunk,
+ const CIRGenFunctionInfo &info, const Decl *targetDecl, bool isThunk,
llvm::MutableArrayRef<mlir::NamedAttrList> argAttrs) {
assert(!cir::MissingFeatures::abiArgInfo());
// TODO(cir): classic codegen does a lot of work here based on the ABIArgInfo
// to set things based on calling convention.
- // At the moment, only nonnull, dereferenceable, align, and noundef are being
- // implemented here, using similar logic to how we do so for return types.
+
+ const auto *fd = dyn_cast_or_null<FunctionDecl>(targetDecl);
----------------
adams381 wrote:
Moved into the pvd block below.
https://github.com/llvm/llvm-project/pull/188281
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits