[clang] [compiler-rt] Split TypeMismatch UBSan handler into 4 handlers (PR #151243)

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 15:59:53 PDT 2025


================
@@ -766,18 +766,13 @@ void CodeGenFunction::EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc,
   llvm::BasicBlock *Done = nullptr;
   bool DoneViaNullSanitize = false;
 
+  llvm::Value *True = llvm::ConstantInt::getTrue(getLLVMContext());
+
   {
-    auto CheckHandler = SanitizerHandler::TypeMismatch;
-    SanitizerDebugLocation SanScope(this,
-                                    {SanitizerKind::SO_Null,
-                                     SanitizerKind::SO_ObjectSize,
-                                     SanitizerKind::SO_Alignment},
+    auto CheckHandler = SanitizerHandler::NullPointerUse;
+    SanitizerDebugLocation SanScope(this, {SanitizerKind::SO_Null},
----------------
thurstond wrote:

Nit: assign the SanitizerKind to a variable, so that it can be reused between the SanScope and EmitCheck.
(Prior to this change, that wasn't possible because the SanScope had multiple SanitizerKinds but the EmitCheck only had one.)

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


More information about the llvm-commits mailing list