@@ -88,53 +88,48 @@ enum VariableTypeDescriptorKind : uint16_t {
88
88
static llvm::StringRef GetTrapMessageForHandler (SanitizerHandler ID) {
89
89
switch (ID) {
90
90
case SanitizerHandler::AddOverflow:
91
- return " The addition of two signed integers resulted in overflow ." ;
91
+ return " Signed integer addition overflowed ." ;
92
92
93
93
case SanitizerHandler::BuiltinUnreachable:
94
- return " _builtin_unreachable encountered ." ;
94
+ return " _builtin_unreachable() executed ." ;
95
95
96
96
case SanitizerHandler::CFICheckFail:
97
- return " Control flow integrity check failed. " ;
97
+ return " Control flow integrity check failed" ;
98
98
99
- case SanitizerHandler::DivremOverflow: // Unsure
100
- return " stub " ;
99
+ case SanitizerHandler::DivremOverflow:
100
+ return " Signed integer divide or remainder overflowed " ;
101
101
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 " ;
104
104
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" ;
109
107
110
108
case SanitizerHandler::FunctionTypeMismatch:
111
- return " Function called with arguments of a different data type than "
112
- " expected" ;
109
+ return " Function called with mismatched signature" ;
113
110
114
111
case SanitizerHandler::ImplicitConversion:
115
- return " Implicit conversion occurred. " ;
112
+ return " Implicit integer conversion overflowed or lost data " ;
116
113
117
114
case SanitizerHandler::InvalidBuiltin:
118
- return " Built-in function or keyword not recognized. " ;
115
+ return " Invalid use of builtin function " ;
119
116
120
117
case SanitizerHandler::InvalidObjCCast:
121
118
return " Invalid Objective-C cast." ;
122
119
123
120
case SanitizerHandler::LoadInvalidValue:
124
- return " stub " ;
121
+ return " Loaded an invalid or uninitialized value " ;
125
122
126
123
case SanitizerHandler::MissingReturn:
127
- return " Function is missing a return. " ;
124
+ return " Non-void function fell off end without return" ;
128
125
129
126
case SanitizerHandler::MulOverflow:
130
- return " The multiplication of two signed integers resulted in overflow. " ;
127
+ return " Signed integer multiplication overflowed " ;
131
128
132
129
case SanitizerHandler::NegateOverflow:
133
- return " Underflow/negative overflow occurred. " ;
130
+ return " Signed integer negation overflowed " ;
134
131
135
- case SanitizerHandler::
136
- NullabilityArg: // Next 4 pasted from
137
- // https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
132
+ case SanitizerHandler::NullabilityArg:
138
133
return " Passing null as a function parameter which is annotated with "
139
134
" _Nonnull" ;
140
135
@@ -151,26 +146,25 @@ static llvm::StringRef GetTrapMessageForHandler(SanitizerHandler ID) {
151
146
" be null" ;
152
147
153
148
case SanitizerHandler::OutOfBounds:
154
- return " Out of bounds -- memory accessed outside of expected boundaries. " ;
149
+ return " Array index out of bounds " ;
155
150
156
151
case SanitizerHandler::PointerOverflow:
157
- return " stub " ;
152
+ return " Pointer arithmetic overflowed bounds " ;
158
153
159
154
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" ;
162
156
163
157
case SanitizerHandler::SubOverflow:
164
- return " The subtraction of two signed integers resulted in overflow. " ;
158
+ return " Signed integer subtraction overflowed " ;
165
159
166
160
case SanitizerHandler::TypeMismatch:
167
- return " Type mismatch -- value type used does not match type expected. " ;
161
+ return " Type mismatch in operation " ;
168
162
169
163
case SanitizerHandler::AlignmentAssumption: // Help on bottom 2
170
- return " stub " ;
164
+ return " Alignment assumption violated " ;
171
165
172
166
case SanitizerHandler::VLABoundNotPositive:
173
- return " stub " ;
167
+ return " Variable-length array bound is not positive " ;
174
168
175
169
default :
176
170
return " " ;
@@ -4133,8 +4127,7 @@ void CodeGenFunction::EmitUnreachable(SourceLocation Loc) {
4133
4127
4134
4128
void CodeGenFunction::EmitTrapCheck (llvm::Value *Checked,
4135
4129
SanitizerHandler CheckHandlerID,
4136
- bool NoMerge, StringRef Annotation,
4137
- StringRef TrapMessage) {
4130
+ bool NoMerge) {
4138
4131
llvm::BasicBlock *Cont = createBasicBlock (" cont" );
4139
4132
4140
4133
// If we're optimizing, collapse all calls to trap down to just one per
@@ -4145,7 +4138,8 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
4145
4138
llvm::BasicBlock *&TrapBB = TrapBBs[CheckHandlerID];
4146
4139
4147
4140
llvm::DILocation *TrapLocation = Builder.getCurrentDebugLocation ();
4148
- llvm::StringRef Category = GetTrapMessageForHandler (CheckHandlerID);
4141
+ llvm::StringRef Category = " UBSan Trap Reason" ;
4142
+ llvm::StringRef TrapMessage = GetTrapMessageForHandler (CheckHandlerID);
4149
4143
4150
4144
if (getDebugInfo () && !Category.empty ()) {
4151
4145
TrapLocation = getDebugInfo ()->CreateTrapFailureMessageFor (
0 commit comments