[clang] [CIR] Add BinOpOverflowOp and basic pointer arithmetic support (PR #133118)

Morris Hafner via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 26 09:59:30 PDT 2025


================
@@ -223,6 +223,16 @@ class CIRGenFunction : public CIRGenTypeCache {
 
   void emitDecl(const clang::Decl &d);
 
+  /// Same as IRBuilder::CreateInBoundsGEP, but additionally emits a check to
+  /// detect undefined behavior when the pointer overflow sanitizer is enabled.
+  /// \p SignedIndices indicates whether any of the GEP indices are signed.
+  /// \p IsSubtraction indicates whether the expression used to form the GEP
+  /// is a subtraction.
+  mlir::Value emitCheckedInBoundsGEP(mlir::Type elemTy, mlir::Value ptr,
----------------
mmha wrote:

Sure 👍 

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


More information about the cfe-commits mailing list