@@ -88,53 +88,48 @@ enum VariableTypeDescriptorKind : uint16_t {
8888static llvm::StringRef GetTrapMessageForHandler (SanitizerHandler ID) {
8989 switch (ID) {
9090 case SanitizerHandler::AddOverflow:
91- return " The addition of two signed integers resulted in overflow ." ;
91+ return " Signed integer addition overflowed ." ;
9292
9393 case SanitizerHandler::BuiltinUnreachable:
94- return " _builtin_unreachable encountered ." ;
94+ return " _builtin_unreachable() executed ." ;
9595
9696 case SanitizerHandler::CFICheckFail:
97- return " Control flow integrity check failed. " ;
97+ return " Control flow integrity check failed" ;
9898
99- case SanitizerHandler::DivremOverflow: // Unsure
100- return " stub " ;
99+ case SanitizerHandler::DivremOverflow:
100+ return " Signed integer divide or remainder overflowed " ;
101101
102- case SanitizerHandler::DynamicTypeCacheMiss: // Unsure
103- return " Data requested for dynamic type not found in cache memory. " ;
102+ case SanitizerHandler::DynamicTypeCacheMiss:
103+ return " Dynamic- type cache miss " ;
104104
105- case SanitizerHandler::FloatCastOverflow: // Pasted from LLVM docs, maybe
106- // something better to put here.
107- return " Conversion to, from, or between floating-point types which would "
108- " overflow the destination." ;
105+ case SanitizerHandler::FloatCastOverflow:
106+ return " Floating-point to integer conversion overflowed" ;
109107
110108 case SanitizerHandler::FunctionTypeMismatch:
111- return " Function called with arguments of a different data type than "
112- " expected" ;
109+ return " Function called with mismatched signature" ;
113110
114111 case SanitizerHandler::ImplicitConversion:
115- return " Implicit conversion occurred. " ;
112+ return " Implicit integer conversion overflowed or lost data " ;
116113
117114 case SanitizerHandler::InvalidBuiltin:
118- return " Built-in function or keyword not recognized. " ;
115+ return " Invalid use of builtin function " ;
119116
120117 case SanitizerHandler::InvalidObjCCast:
121118 return " Invalid Objective-C cast." ;
122119
123120 case SanitizerHandler::LoadInvalidValue:
124- return " stub " ;
121+ return " Loaded an invalid or uninitialized value " ;
125122
126123 case SanitizerHandler::MissingReturn:
127- return " Function is missing a return. " ;
124+ return " Non-void function fell off end without return" ;
128125
129126 case SanitizerHandler::MulOverflow:
130- return " The multiplication of two signed integers resulted in overflow. " ;
127+ return " Signed integer multiplication overflowed " ;
131128
132129 case SanitizerHandler::NegateOverflow:
133- return " Underflow/negative overflow occurred. " ;
130+ return " Signed integer negation overflowed " ;
134131
135- case SanitizerHandler::
136- NullabilityArg: // Next 4 pasted from
137- // https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
132+ case SanitizerHandler::NullabilityArg:
138133 return " Passing null as a function parameter which is annotated with "
139134 " _Nonnull" ;
140135
@@ -151,26 +146,25 @@ static llvm::StringRef GetTrapMessageForHandler(SanitizerHandler ID) {
151146 " be null" ;
152147
153148 case SanitizerHandler::OutOfBounds:
154- return " Out of bounds -- memory accessed outside of expected boundaries. " ;
149+ return " Array index out of bounds " ;
155150
156151 case SanitizerHandler::PointerOverflow:
157- return " stub " ;
152+ return " Pointer arithmetic overflowed bounds " ;
158153
159154 case SanitizerHandler::ShiftOutOfBounds:
160- return " Bit shift attempted to move bits beyond boundaries of data type's "
161- " bit size." ;
155+ return " Shift amount exceeds bit-width of operand" ;
162156
163157 case SanitizerHandler::SubOverflow:
164- return " The subtraction of two signed integers resulted in overflow. " ;
158+ return " Signed integer subtraction overflowed " ;
165159
166160 case SanitizerHandler::TypeMismatch:
167- return " Type mismatch -- value type used does not match type expected. " ;
161+ return " Type mismatch in operation " ;
168162
169163 case SanitizerHandler::AlignmentAssumption: // Help on bottom 2
170- return " stub " ;
164+ return " Alignment assumption violated " ;
171165
172166 case SanitizerHandler::VLABoundNotPositive:
173- return " stub " ;
167+ return " Variable-length array bound is not positive " ;
174168
175169 default :
176170 return " " ;
@@ -4133,8 +4127,7 @@ void CodeGenFunction::EmitUnreachable(SourceLocation Loc) {
41334127
41344128void CodeGenFunction::EmitTrapCheck (llvm::Value *Checked,
41354129 SanitizerHandler CheckHandlerID,
4136- bool NoMerge, StringRef Annotation,
4137- StringRef TrapMessage) {
4130+ bool NoMerge) {
41384131 llvm::BasicBlock *Cont = createBasicBlock (" cont" );
41394132
41404133 // If we're optimizing, collapse all calls to trap down to just one per
@@ -4145,7 +4138,8 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
41454138 llvm::BasicBlock *&TrapBB = TrapBBs[CheckHandlerID];
41464139
41474140 llvm::DILocation *TrapLocation = Builder.getCurrentDebugLocation ();
4148- llvm::StringRef Category = GetTrapMessageForHandler (CheckHandlerID);
4141+ llvm::StringRef Category = " UBSan Trap Reason" ;
4142+ llvm::StringRef TrapMessage = GetTrapMessageForHandler (CheckHandlerID);
41494143
41504144 if (getDebugInfo () && !Category.empty ()) {
41514145 TrapLocation = getDebugInfo ()->CreateTrapFailureMessageFor (
0 commit comments