58
58
using namespace clang ;
59
59
using namespace clang ::CodeGen;
60
60
61
- // TODO: consider deprecating ClArrayBoundsPseudoFn; functionality is subsumed
62
- // by -fsanitize-annotate-debug-info
63
- static llvm::cl::opt<bool > ClArrayBoundsPseudoFn (
64
- " array-bounds-pseudofn" , llvm::cl::Hidden, llvm::cl::Optional,
65
- llvm::cl::desc (" Emit debug info that places array-bounds instrumentation "
66
- " in an inline function called __ubsan_check_array_bounds." ));
67
-
68
61
static uint32_t getTypeAlignIfRequired (const Type *Ty, const ASTContext &Ctx) {
69
62
auto TI = Ctx.getTypeInfo (Ty);
70
63
if (TI.isAlignRequired ())
@@ -6482,7 +6475,11 @@ llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo(
6482
6475
SanitizerHandler Handler) {
6483
6476
llvm::DILocation *CheckDebugLoc = Builder.getCurrentDebugLocation ();
6484
6477
auto *DI = getDebugInfo ();
6485
- if (!DI)
6478
+ if (!DI || !CheckDebugLoc)
6479
+ return CheckDebugLoc;
6480
+ const auto &AnnotateDebugInfo =
6481
+ CGM.getCodeGenOpts ().SanitizeAnnotateDebugInfo ;
6482
+ if (AnnotateDebugInfo.empty ())
6486
6483
return CheckDebugLoc;
6487
6484
6488
6485
std::string Label;
@@ -6491,14 +6488,8 @@ llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo(
6491
6488
else
6492
6489
Label = SanitizerHandlerToCheckLabel (Handler);
6493
6490
6494
- for (auto Ord : Ordinals) {
6495
- // TODO: deprecate ClArrayBoundsPseudoFn
6496
- if (((ClArrayBoundsPseudoFn && Ord == SanitizerKind::SO_ArrayBounds) ||
6497
- CGM.getCodeGenOpts ().SanitizeAnnotateDebugInfo .has (Ord)) &&
6498
- CheckDebugLoc) {
6499
- return DI->CreateSyntheticInlineAt (CheckDebugLoc, Label);
6500
- }
6501
- }
6491
+ if (any_of (Ordinals, [&](auto Ord) { return AnnotateDebugInfo.has (Ord); }))
6492
+ return DI->CreateSyntheticInlineAt (CheckDebugLoc, Label);
6502
6493
6503
6494
return CheckDebugLoc;
6504
6495
}
0 commit comments