Skip to content

Commit 5093d81

Browse files
committed
Make SanitizerAnnotateDebugInfo public and fix merge conflict
1 parent 8bbc00f commit 5093d81

File tree

2 files changed

+5
-39
lines changed

2 files changed

+5
-39
lines changed

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,35 +1217,6 @@ void CodeGenFunction::EmitBoundsCheck(const Expr *E, const Expr *Base,
12171217
EmitBoundsCheckImpl(E, Bound, Index, IndexType, IndexedType, Accessed);
12181218
}
12191219

1220-
llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo(
1221-
SanitizerKind::SanitizerOrdinal CheckKindOrdinal) {
1222-
std::string Label;
1223-
switch (CheckKindOrdinal) {
1224-
#define SANITIZER(NAME, ID) \
1225-
case SanitizerKind::SO_##ID: \
1226-
Label = "__ubsan_check_" NAME; \
1227-
break;
1228-
#include "clang/Basic/Sanitizers.def"
1229-
default:
1230-
llvm_unreachable("unexpected sanitizer kind");
1231-
}
1232-
1233-
// Sanitize label
1234-
for (unsigned int i = 0; i < Label.length(); i++)
1235-
if (!std::isalpha(Label[i]))
1236-
Label[i] = '_';
1237-
1238-
llvm::DILocation *CheckDI = Builder.getCurrentDebugLocation();
1239-
// TODO: deprecate ClArrayBoundsPseudoFn
1240-
if (((ClArrayBoundsPseudoFn &&
1241-
CheckKindOrdinal == SanitizerKind::SO_ArrayBounds) ||
1242-
CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo.has(CheckKindOrdinal)) &&
1243-
CheckDI)
1244-
CheckDI = getDebugInfo()->CreateSyntheticInlineAt(CheckDI, Label);
1245-
1246-
return CheckDI;
1247-
}
1248-
12491220
void CodeGenFunction::EmitBoundsCheckImpl(const Expr *E, llvm::Value *Bound,
12501221
llvm::Value *Index,
12511222
QualType IndexType,

clang/lib/CodeGen/CodeGenFunction.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2816,11 +2816,6 @@ class CodeGenFunction : public CodeGenTypeCache {
28162816
void emitStoresForInitAfterBZero(llvm::Constant *Init, Address Loc,
28172817
bool isVolatile, bool IsAutoInit);
28182818

2819-
/// Returns debug info, with additional annotation if enabled by
2820-
/// CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo[CheckKindOrdinal].
2821-
llvm::DILocation *
2822-
SanitizerAnnotateDebugInfo(SanitizerKind::SanitizerOrdinal CheckKindOrdinal);
2823-
28242819
public:
28252820
// Captures all the allocas created during the scope of its RAII object.
28262821
struct AllocaTrackerRAII {
@@ -3358,11 +3353,6 @@ class CodeGenFunction : public CodeGenTypeCache {
33583353
SanitizerSet SkippedChecks = SanitizerSet(),
33593354
llvm::Value *ArraySize = nullptr);
33603355

3361-
/// Returns debug info, with additional annotation if enabled by
3362-
/// CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo[CheckKindOrdinal].
3363-
llvm::DILocation *
3364-
SanitizerAnnotateDebugInfo(SanitizerKind::SanitizerOrdinal CheckKindOrdinal);
3365-
33663356
/// Converts the CFITypeCheckKind into SanitizerKind::SanitizerOrdinal and
33673357
/// llvm::SanitizerStatKind.
33683358
static std::pair<SanitizerKind::SanitizerOrdinal, llvm::SanitizerStatKind>
@@ -3377,6 +3367,11 @@ class CodeGenFunction : public CodeGenTypeCache {
33773367
llvm::Value *Index, QualType IndexType,
33783368
QualType IndexedType, bool Accessed);
33793369

3370+
/// Returns debug info, with additional annotation if enabled by
3371+
/// CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo[CheckKindOrdinal].
3372+
llvm::DILocation *
3373+
SanitizerAnnotateDebugInfo(SanitizerKind::SanitizerOrdinal CheckKindOrdinal);
3374+
33803375
llvm::Value *GetCountedByFieldExprGEP(const Expr *Base, const FieldDecl *FD,
33813376
const FieldDecl *CountDecl);
33823377

0 commit comments

Comments
 (0)