@@ -1249,9 +1249,11 @@ llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo(
1249
1249
llvm::DILocation *CheckDI = Builder.getCurrentDebugLocation ();
1250
1250
1251
1251
// TODO: the annotation could be more precise:
1252
- // 1) use the ordinal name if there is only one ordinal
1252
+ // 1) use the ordinal name if there is only one ordinal; and/or,
1253
1253
// 2) use the overarching SanitizerHandler if there are multiple ordinals
1254
+ // (this may be confusing to users)
1254
1255
for (auto Ord : Ordinals) {
1256
+ // TODO: deprecate ClArrayBoundsPseudoFn
1255
1257
if (((ClArrayBoundsPseudoFn && Ord == SanitizerKind::SO_ArrayBounds) ||
1256
1258
CGM.getCodeGenOpts ().SanitizeAnnotateDebugInfo .has (Ord)) &&
1257
1259
CheckDI) {
@@ -4029,9 +4031,10 @@ void CodeGenFunction::EmitCfiCheckFail() {
4029
4031
4030
4032
void CodeGenFunction::EmitUnreachable (SourceLocation Loc) {
4031
4033
if (SanOpts.has (SanitizerKind::Unreachable)) {
4032
- SanitizerScope SanScope (this , {SanitizerKind::SO_Unreachable});
4034
+ auto CheckOrdinal = SanitizerKind::SO_Unreachable;
4035
+ SanitizerScope SanScope (this , {CheckOrdinal});
4033
4036
EmitCheck (std::make_pair (static_cast <llvm::Value *>(Builder.getFalse ()),
4034
- SanitizerKind::SO_Unreachable ),
4037
+ CheckOrdinal ),
4035
4038
SanitizerHandler::BuiltinUnreachable,
4036
4039
EmitCheckSourceLocation (Loc), {});
4037
4040
}
@@ -6270,7 +6273,8 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType,
6270
6273
!isa<FunctionNoProtoType>(PointeeType)) {
6271
6274
if (llvm::Constant *PrefixSig =
6272
6275
CGM.getTargetCodeGenInfo ().getUBSanFunctionSignature (CGM)) {
6273
- SanitizerScope SanScope (this , {SanitizerKind::SO_Function});
6276
+ auto CheckOrdinal = SanitizerKind::SO_Function;
6277
+ SanitizerScope SanScope (this , {CheckOrdinal});
6274
6278
auto *TypeHash = getUBSanFunctionTypeHash (PointeeType);
6275
6279
6276
6280
llvm::Type *PrefixSigType = PrefixSig->getType ();
@@ -6330,7 +6334,7 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType,
6330
6334
Builder.CreateICmpEQ (CalleeTypeHash, TypeHash);
6331
6335
llvm::Constant *StaticData[] = {EmitCheckSourceLocation (E->getBeginLoc ()),
6332
6336
EmitCheckTypeDescriptor (CalleeType)};
6333
- EmitCheck (std::make_pair (CalleeTypeHashMatch, SanitizerKind::SO_Function ),
6337
+ EmitCheck (std::make_pair (CalleeTypeHashMatch, CheckOrdinal ),
6334
6338
SanitizerHandler::FunctionTypeMismatch, StaticData,
6335
6339
{CalleePtr});
6336
6340
@@ -6349,10 +6353,9 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType,
6349
6353
// function pointer is a member of the bit set for the function type.
6350
6354
if (SanOpts.has (SanitizerKind::CFIICall) &&
6351
6355
(!TargetDecl || !isa<FunctionDecl>(TargetDecl))) {
6352
- SanitizerScope SanScope (this , {SanitizerKind::SO_CFIICall});
6356
+ auto CheckOrdinal = SanitizerKind::SO_CFIICall;
6357
+ SanitizerScope SanScope (this , {CheckOrdinal});
6353
6358
EmitSanitizerStatReport (llvm::SanStat_CFI_ICall);
6354
- ApplyDebugLocation ApplyTrapDI (
6355
- *this , SanitizerAnnotateDebugInfo (SanitizerKind::SO_CFIICall));
6356
6359
6357
6360
llvm::Metadata *MD;
6358
6361
if (CGM.getCodeGenOpts ().SanitizeCfiICallGeneralizePointers )
@@ -6373,10 +6376,10 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType,
6373
6376
EmitCheckTypeDescriptor (QualType (FnType, 0 )),
6374
6377
};
6375
6378
if (CGM.getCodeGenOpts ().SanitizeCfiCrossDso && CrossDsoTypeId) {
6376
- EmitCfiSlowPathCheck (SanitizerKind::SO_CFIICall , TypeTest, CrossDsoTypeId,
6377
- CalleePtr, StaticData);
6379
+ EmitCfiSlowPathCheck (CheckOrdinal , TypeTest, CrossDsoTypeId, CalleePtr ,
6380
+ StaticData);
6378
6381
} else {
6379
- EmitCheck (std::make_pair (TypeTest, SanitizerKind::SO_CFIICall ),
6382
+ EmitCheck (std::make_pair (TypeTest, CheckOrdinal ),
6380
6383
SanitizerHandler::CFICheckFail, StaticData,
6381
6384
{CalleePtr, llvm::UndefValue::get (IntPtrTy)});
6382
6385
}
0 commit comments