================
@@ -85,6 +85,96 @@ enum VariableTypeDescriptorKind : uint16_t {
 //                        Miscellaneous Helper Methods
 //===--------------------------------------------------------------------===//
 
+static llvm::StringRef GetUBSanTrapForHandler(SanitizerHandler ID) {
+  switch (ID) {
+  case SanitizerHandler::AddOverflow:
+    return "Signed integer addition overflowed";
+
+  case SanitizerHandler::BuiltinUnreachable:
+    return "_builtin_unreachable(), execution reached an unreachable program "
+           "point";
+
+  case SanitizerHandler::CFICheckFail:
+    return "Control flow integrity check failed";
+
+  case SanitizerHandler::DivremOverflow:
+    return "Signed integer divide or remainder overflowed";
+
+  case SanitizerHandler::DynamicTypeCacheMiss:
+    return "Dynamic type cache miss, member call made on an object whose "
+           "dynamic type differs from the expected type";
+
+  case SanitizerHandler::FloatCastOverflow:
+    return "Floating-point to integer conversion overflowed";
+
+  case SanitizerHandler::FunctionTypeMismatch:
+    return "Function called with mismatched signature";
+
+  case SanitizerHandler::ImplicitConversion:
+    return "Implicit integer conversion overflowed or lost data";
+
+  case SanitizerHandler::InvalidBuiltin:
+    return "Invalid use of builtin function";
+
+  case SanitizerHandler::InvalidObjCCast:
+    return "Invalid Objective-C cast";
+
+  case SanitizerHandler::LoadInvalidValue:
+    return "Loaded an invalid or uninitialized value for the type";
+
+  case SanitizerHandler::MissingReturn:
+    return "Execution reached the end of a value-returning function without "
+           "returning a value";
+
+  case SanitizerHandler::MulOverflow:
+    return "Signed integer multiplication overflowed";
+
+  case SanitizerHandler::NegateOverflow:
+    return "Signed integer negation overflowed";
+
+  case SanitizerHandler::NullabilityArg:
+    return "Passing null as an argument which is annotated with "
+           "_Nonnull";
+
+  case SanitizerHandler::NullabilityReturn:
+    return "Returning null from a function with a return type annotated with "
+           "_Nonnull";
+
+  case SanitizerHandler::NonnullArg:
+    return "Passing null pointer as an argument which is declared to never be "
+           "null";
+
+  case SanitizerHandler::NonnullReturn:
+    return "Returning null pointer from a function which is declared to never "
+           "return null";
+
+  case SanitizerHandler::OutOfBounds:
+    return "Array index out of bounds";
+
+  case SanitizerHandler::PointerOverflow:
+    return "Pointer arithmetic overflowed bounds";
+
+  case SanitizerHandler::ShiftOutOfBounds:
+    return "Shift exponent is too large for the type";
+
+  case SanitizerHandler::SubOverflow:
+    return "Signed integer subtraction overflowed";
+
+  case SanitizerHandler::TypeMismatch:
+    return "Type mismatch in operation";
----------------
delcypher wrote:

We can do that but this seems like it should be done as a separate patch. Also 
if we do this we need to be careful because the enum values are effectively ABI 
at this point. The main case I'm concerned about is the value for 
`-fbounds-safety` (0x19) is ABI and we have no desire for that to change.

https://github.com/llvm/llvm-project/pull/145967
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to