@@ -1223,8 +1223,28 @@ class CIRGenFunction : public CIRGenTypeCache {
12231223 // / to conserve the high level information.
12241224 mlir::Value emitToMemory (mlir::Value value, clang::QualType ty);
12251225
1226+ // / Emit a trap instruction, which is used to abort the program in an abnormal
1227+ // / way, usually for debugging purposes.
1228+ // / \p createNewBlock indicates whether to create a new block for the IR
1229+ // / builder. Since the `cir.trap` operation is a terminator, operations that
1230+ // / follow a trap cannot be emitted after `cir.trap` in the same block. To
1231+ // / ensure these operations get emitted successfully, you need to create a new
1232+ // / dummy block and set the insertion point there before continuing from the
1233+ // / trap operation.
1234+ void emitTrap (mlir::Location loc, bool createNewBlock);
1235+
12261236 LValue emitUnaryOpLValue (const clang::UnaryOperator *e);
12271237
1238+ // / Emit a reached-unreachable diagnostic if \p loc is valid and runtime
1239+ // / checking is enabled. Otherwise, just emit an unreachable instruction.
1240+ // / \p createNewBlock indicates whether to create a new block for the IR
1241+ // / builder. Since the `cir.unreachable` operation is a terminator, operations
1242+ // / that follow an unreachable point cannot be emitted after `cir.unreachable`
1243+ // / in the same block. To ensure these operations get emitted successfully,
1244+ // / you need to create a dummy block and set the insertion point there before
1245+ // / continuing from the unreachable point.
1246+ void emitUnreachable (clang::SourceLocation loc, bool createNewBlock);
1247+
12281248 // / This method handles emission of any variable declaration
12291249 // / inside a function, including static vars etc.
12301250 void emitVarDecl (const clang::VarDecl &d);
0 commit comments