[clang] [CIR] Record if c++ ABI was overridden via -fc++-abi flag (PR #229494)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 7 04:50:20 PDT 2026
================
@@ -257,6 +258,21 @@ cir::CIRDialect::verifyOperationAttribute(mlir::Operation *op,
if (isOpenCLVersionAttrName(attrName))
return verifyOpenCLVersionAttr(op, attr);
+ if (attrName == getCXXABIAttrName()) {
+ if (!mlir::isa<mlir::ModuleOp>(op))
+ return op->emitOpError() << "expects '" << getCXXABIAttrName()
+ << "' attribute to be attached to '"
+ << mlir::ModuleOp::getOperationName() << "'";
+ auto abi = mlir::dyn_cast<mlir::StringAttr>(attr.getValue());
+ if (!abi)
+ return op->emitOpError()
+ << "expects '" << getCXXABIAttrName() << "' to be a string";
+
+ if (!clang::TargetCXXABI::isABI(abi.getValue()))
+ return op->emitOpError() << "unknown C++ ABI '" << abi.getValue() << "'";
+ return success();
+ }
+
----------------
Fznamznon wrote:
Ok, added new verification in 40533b33fb2f7358d032dd141cb971d6321c76d2 . I'm concerned though that this will need updates once more ABIs are supported by CIR.
https://github.com/llvm/llvm-project/pull/229494
More information about the cfe-commits
mailing list