@@ -1199,8 +1199,28 @@ class CIRGenFunction : public CIRGenTypeCache {
11991199 // / to conserve the high level information.
12001200 mlir::Value emitToMemory (mlir::Value value, clang::QualType ty);
12011201
1202+ // / Emit a trap instruction, which is used to abort the program in an abnormal
1203+ // / way, usually for debugging purposes.
1204+ // / \p createNewBlock indicates whether to create a new block for the IR
1205+ // / builder. Since the `cir.trap` operation is a terminator, operations that
1206+ // / follow a trap cannot be emitted after `cir.trap` in the same block. To
1207+ // / ensure these operations get emitted successfully, you need to create a new
1208+ // / dummy block and set the insertion point there before continuing from the
1209+ // / trap operation.
1210+ void emitTrap (mlir::Location loc, bool createNewBlock);
1211+
12021212 LValue emitUnaryOpLValue (const clang::UnaryOperator *e);
12031213
1214+ // / Emit a reached-unreachable diagnostic if \p loc is valid and runtime
1215+ // / checking is enabled. Otherwise, just emit an unreachable instruction.
1216+ // / \p createNewBlock indicates whether to create a new block for the IR
1217+ // / builder. Since the `cir.unreachable` operation is a terminator, operations
1218+ // / that follow an unreachable point cannot be emitted after `cir.unreachable`
1219+ // / in the same block. To ensure these operations get emitted successfully,
1220+ // / you need to create a dummy block and set the insertion point there before
1221+ // / continuing from the unreachable point.
1222+ void emitUnreachable (clang::SourceLocation loc, bool createNewBlock);
1223+
12041224 // / This method handles emission of any variable declaration
12051225 // / inside a function, including static vars etc.
12061226 void emitVarDecl (const clang::VarDecl &d);
0 commit comments