[clang] [CIR] Function type return type improvements (PR #128787)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 26 14:22:32 PST 2025
================
@@ -424,6 +424,10 @@ LogicalResult cir::FuncOp::verifyType() {
if (!isa<cir::FuncType>(type))
return emitOpError("requires '" + getFunctionTypeAttrName().str() +
"' attribute of function type");
+ if (auto rt = type.getReturnTypes();
----------------
erichkeane wrote:
Yeah, just super weird/scary for me that FuncType has `getReturnTypes` here. BUT I consider the verifier for the purposes of sanity-checking anyway... I guess it would fail parsing, but one of the justifications for making the verifier so aggressive in LLVM at checking EVERYTHING is that it can sometimes come from other, side-channel sources like a handwritten text file, or one of the CAPIs.
ALSO-ALSO: If I'm mentally parsing this right: That check on line 424 is an absolute impossibility by the type system, right?
`getFunctionType` already gives us a `cir::FuncType`, so an `isa` will always be true, correct? Or am I missing something?
https://github.com/llvm/llvm-project/pull/128787
More information about the cfe-commits
mailing list