[clang] [CIR] Diagnose missing/bad `cir.triple` and `cir.opt_info` attributes in CIR tests instead of asserts/crashes (PR #230003)
Ian Li via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 15 00:04:20 PDT 2026
================
@@ -898,16 +898,21 @@ populateCXXABIConversionTarget(mlir::ConversionTarget &target,
void CXXABILoweringPass::runOnOperation() {
auto mod = mlir::cast<mlir::ModuleOp>(getOperation());
+ // Triple attribute is required by createLowerModule:
+ if (!mod->hasAttr(cir::CIRDialect::getTripleAttrName())) {
+ mod.emitError() << getArgument() << " requires a module with a '"
+ << cir::CIRDialect::getTripleAttrName() << "' attribute";
+ return signalPassFailure();
+ }
+
mlir::MLIRContext *ctx = mod.getContext();
std::unique_ptr<cir::LowerModule> lowerModule = cir::createLowerModule(mod);
- // If lower module is not available, skip the ABI lowering pass.
if (!lowerModule) {
----------------
ianayl wrote:
Done, let me know if more changes are necessary. Thanks for the review once again!
https://github.com/llvm/llvm-project/pull/230003
More information about the cfe-commits
mailing list