[clang] [WIP][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 8 00:17:11 PDT 2026


================
@@ -0,0 +1,130 @@
+// RUN: cir-opt %s -cir-lowering-prepare -verify-diagnostics -split-input-file
+// RUN: not cir-opt %s -cir-lowering-prepare -split-input-file 2>/dev/null \
+// RUN:   | FileCheck %s --implicit-check-not=cir.func
+
+// Check that missing or malformed module attributes required/used by
+// -cir-lowering-prepare do not cause asserts or compiler crashes, and are
+// diagnosed properly. The pass should fail on bad attributes, so only modules
+// with valid attributes are printed.
+
+
+// Missing cir.triple.
----------------
ianayl wrote:

Since `-cir-cxx-abi-lowering`, `-cir-lowering-prepare`, and `-cir-target-lowering` all depend on obtaining a CIR `LowerModule`, their errors/warnings are really similar with minor real differences. I opted to include all the test cases for each of the aforementioned tests for sake of completeness, but for the sake of brevity maybe I should remove some tests that are perhaps a bit too redundant?

https://github.com/llvm/llvm-project/pull/230003


More information about the cfe-commits mailing list