aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenFunction.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenFunction.h')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenFunction.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h
index 68d54bb..3d92545 100644
--- a/clang/lib/CIR/CodeGen/CIRGenFunction.h
+++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h
@@ -1223,8 +1223,28 @@ public:
/// to conserve the high level information.
mlir::Value emitToMemory(mlir::Value value, clang::QualType ty);
+ /// Emit a trap instruction, which is used to abort the program in an abnormal
+ /// way, usually for debugging purposes.
+ /// \p createNewBlock indicates whether to create a new block for the IR
+ /// builder. Since the `cir.trap` operation is a terminator, operations that
+ /// follow a trap cannot be emitted after `cir.trap` in the same block. To
+ /// ensure these operations get emitted successfully, you need to create a new
+ /// dummy block and set the insertion point there before continuing from the
+ /// trap operation.
+ void emitTrap(mlir::Location loc, bool createNewBlock);
+
LValue emitUnaryOpLValue(const clang::UnaryOperator *e);
+ /// Emit a reached-unreachable diagnostic if \p loc is valid and runtime
+ /// checking is enabled. Otherwise, just emit an unreachable instruction.
+ /// \p createNewBlock indicates whether to create a new block for the IR
+ /// builder. Since the `cir.unreachable` operation is a terminator, operations
+ /// that follow an unreachable point cannot be emitted after `cir.unreachable`
+ /// in the same block. To ensure these operations get emitted successfully,
+ /// you need to create a dummy block and set the insertion point there before
+ /// continuing from the unreachable point.
+ void emitUnreachable(clang::SourceLocation loc, bool createNewBlock);
+
/// This method handles emission of any variable declaration
/// inside a function, including static vars etc.
void emitVarDecl(const clang::VarDecl &d);