Skip to content

Commit 1b8a136

Browse files
authored
[Sanitizer] remove array-bounds-pseudofn (#149430)
This has been replaced by -fsanitize-annotate-debug-info
1 parent 3641448 commit 1b8a136

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@
5858
using namespace clang;
5959
using namespace clang::CodeGen;
6060

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-
6861
static uint32_t getTypeAlignIfRequired(const Type *Ty, const ASTContext &Ctx) {
6962
auto TI = Ctx.getTypeInfo(Ty);
7063
if (TI.isAlignRequired())
@@ -6482,7 +6475,11 @@ llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo(
64826475
SanitizerHandler Handler) {
64836476
llvm::DILocation *CheckDebugLoc = Builder.getCurrentDebugLocation();
64846477
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())
64866483
return CheckDebugLoc;
64876484

64886485
std::string Label;
@@ -6491,14 +6488,8 @@ llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo(
64916488
else
64926489
Label = SanitizerHandlerToCheckLabel(Handler);
64936490

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);
65026493

65036494
return CheckDebugLoc;
65046495
}

0 commit comments

Comments
 (0)