[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)
Thurston Dang via cfe-commits
cfe-commits at lists.llvm.org
Tue May 13 16:59:31 PDT 2025
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139809
>From ead256dfd33d04877766ddb26830f264682e9b48 Mon Sep 17 00:00:00 2001
From: Thurston Dang <thurston at google.com>
Date: Wed, 7 May 2025 23:33:21 +0000
Subject: [PATCH 1/4] [cfi] Enable -fsanitize-annotate-debug-info functionality
for CFI checks
This connects the -fsanitize-annotate-debug-info plumbing
(https://github.com/llvm/llvm-project/pull/138577) to CFI check codegen.
Updates the tests from https://github.com/llvm/llvm-project/pull/139149.
A side effect is that __ubsan_check_array_bounds is renamed to __ubsan_check_array-bounds.
This affects clang/test/CodeGen/bounds-checking-debuginfo.c
from https://github.com/llvm/llvm-project/pull/128977
---
clang/lib/CodeGen/CGClass.cpp | 53 ++++++--
clang/lib/CodeGen/CGExpr.cpp | 42 ++++--
clang/lib/CodeGen/CodeGenFunction.h | 11 ++
clang/lib/CodeGen/ItaniumCXXABI.cpp | 7 +-
.../test/CodeGen/bounds-checking-debuginfo.c | 4 +-
clang/test/CodeGen/cfi-check-fail-debuginfo.c | 23 ++--
.../CodeGen/cfi-icall-generalize-debuginfo.c | 46 ++++---
.../CodeGen/cfi-icall-normalize2-debuginfo.c | 127 +++++++++---------
8 files changed, 198 insertions(+), 115 deletions(-)
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index befbfc64a680c..232965f8f0a84 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -2779,6 +2779,36 @@ void CodeGenFunction::EmitTypeMetadataCodeForVCall(const CXXRecordDecl *RD,
}
}
+void CodeGenFunction::ParseCFITypeCheckKind(CFITypeCheckKind TCK,
+ SanitizerKind::SanitizerOrdinal &M,
+ llvm::SanitizerStatKind &SSK) {
+ switch (TCK) {
+ case CFITCK_VCall:
+ M = SanitizerKind::SO_CFIVCall;
+ SSK = llvm::SanStat_CFI_VCall;
+ break;
+ case CFITCK_NVCall:
+ M = SanitizerKind::SO_CFINVCall;
+ SSK = llvm::SanStat_CFI_NVCall;
+ break;
+ case CFITCK_DerivedCast:
+ M = SanitizerKind::SO_CFIDerivedCast;
+ SSK = llvm::SanStat_CFI_DerivedCast;
+ break;
+ case CFITCK_UnrelatedCast:
+ M = SanitizerKind::SO_CFIUnrelatedCast;
+ SSK = llvm::SanStat_CFI_UnrelatedCast;
+ break;
+ case CFITCK_ICall:
+ M = SanitizerKind::SO_CFIICall;
+ SSK = llvm::SanStat_CFI_ICall;
+ break;
+ case CFITCK_NVMFCall:
+ case CFITCK_VMFCall:
+ llvm_unreachable("unexpected sanitizer kind");
+ }
+}
+
void CodeGenFunction::EmitVTablePtrCheckForCall(const CXXRecordDecl *RD,
llvm::Value *VTable,
CFITypeCheckKind TCK,
@@ -2786,6 +2816,10 @@ void CodeGenFunction::EmitVTablePtrCheckForCall(const CXXRecordDecl *RD,
if (!SanOpts.has(SanitizerKind::CFICastStrict))
RD = LeastDerivedClassWithSameLayout(RD);
+ SanitizerKind::SanitizerOrdinal Ordinal;
+ llvm::SanitizerStatKind SSK;
+ ParseCFITypeCheckKind(TCK, Ordinal, SSK);
+ ApplyDebugLocation ApplyTrapDI(*this, SanitizerAnnotateDebugInfo(Ordinal));
EmitVTablePtrCheck(RD, VTable, TCK, Loc);
}
@@ -2808,6 +2842,11 @@ void CodeGenFunction::EmitVTablePtrCheckForCast(QualType T, Address Derived,
if (!SanOpts.has(SanitizerKind::CFICastStrict))
ClassDecl = LeastDerivedClassWithSameLayout(ClassDecl);
+ SanitizerKind::SanitizerOrdinal Ordinal;
+ llvm::SanitizerStatKind SSK;
+ ParseCFITypeCheckKind(TCK, Ordinal, SSK);
+ ApplyDebugLocation ApplyTrapDI(*this, SanitizerAnnotateDebugInfo(Ordinal));
+
llvm::BasicBlock *ContBlock = nullptr;
if (MayBeNull) {
@@ -2844,22 +2883,12 @@ void CodeGenFunction::EmitVTablePtrCheck(const CXXRecordDecl *RD,
SanitizerKind::SanitizerOrdinal M;
llvm::SanitizerStatKind SSK;
+ ParseCFITypeCheckKind(TCK, M, SSK);
switch (TCK) {
case CFITCK_VCall:
- M = SanitizerKind::SO_CFIVCall;
- SSK = llvm::SanStat_CFI_VCall;
- break;
case CFITCK_NVCall:
- M = SanitizerKind::SO_CFINVCall;
- SSK = llvm::SanStat_CFI_NVCall;
- break;
case CFITCK_DerivedCast:
- M = SanitizerKind::SO_CFIDerivedCast;
- SSK = llvm::SanStat_CFI_DerivedCast;
- break;
case CFITCK_UnrelatedCast:
- M = SanitizerKind::SO_CFIUnrelatedCast;
- SSK = llvm::SanStat_CFI_UnrelatedCast;
break;
case CFITCK_ICall:
case CFITCK_NVMFCall:
@@ -2932,6 +2961,8 @@ llvm::Value *CodeGenFunction::EmitVTableTypeCheckedLoad(
SanitizerScope SanScope(this);
EmitSanitizerStatReport(llvm::SanStat_CFI_VCall);
+ ApplyDebugLocation ApplyTrapDI(
+ *this, SanitizerAnnotateDebugInfo(SanitizerKind::SO_CFIVCall));
llvm::Metadata *MD =
CGM.CreateMetadataIdentifierForType(QualType(RD->getTypeForDecl(), 0));
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 0d03923951a16..8519584c1f081 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -1217,6 +1217,30 @@ void CodeGenFunction::EmitBoundsCheck(const Expr *E, const Expr *Base,
EmitBoundsCheckImpl(E, Bound, Index, IndexType, IndexedType, Accessed);
}
+llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo(
+ SanitizerKind::SanitizerOrdinal CheckKindOrdinal) {
+ StringRef Label;
+ switch (CheckKindOrdinal) {
+#define SANITIZER(NAME, ID) \
+ case SanitizerKind::SO_##ID: \
+ Label = "__ubsan_check_" NAME; \
+ break;
+#include "clang/Basic/Sanitizers.def"
+ default:
+ llvm_unreachable("unexpected sanitizer kind");
+ }
+
+ llvm::DILocation *CheckDI = Builder.getCurrentDebugLocation();
+ // TODO: deprecate ClArrayBoundsPseudoFn
+ if (((ClArrayBoundsPseudoFn &&
+ CheckKindOrdinal == SanitizerKind::SO_ArrayBounds) ||
+ CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo.has(CheckKindOrdinal)) &&
+ CheckDI) {
+ CheckDI = getDebugInfo()->CreateSyntheticInlineAt(CheckDI, Label);
+ }
+ return CheckDI;
+}
+
void CodeGenFunction::EmitBoundsCheckImpl(const Expr *E, llvm::Value *Bound,
llvm::Value *Index,
QualType IndexType,
@@ -1225,17 +1249,8 @@ void CodeGenFunction::EmitBoundsCheckImpl(const Expr *E, llvm::Value *Bound,
return;
SanitizerScope SanScope(this);
-
- llvm::DILocation *CheckDI = Builder.getCurrentDebugLocation();
auto CheckKind = SanitizerKind::SO_ArrayBounds;
- // TODO: deprecate ClArrayBoundsPseudoFn
- if ((ClArrayBoundsPseudoFn ||
- CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo.has(CheckKind)) &&
- CheckDI) {
- CheckDI = getDebugInfo()->CreateSyntheticInlineAt(
- Builder.getCurrentDebugLocation(), "__ubsan_check_array_bounds");
- }
- ApplyDebugLocation ApplyTrapDI(*this, CheckDI);
+ ApplyDebugLocation ApplyTrapDI(*this, SanitizerAnnotateDebugInfo(CheckKind));
bool IndexSigned = IndexType->isSignedIntegerOrEnumerationType();
llvm::Value *IndexVal = Builder.CreateIntCast(Index, SizeTy, IndexSigned);
@@ -3950,6 +3965,8 @@ void CodeGenFunction::EmitCfiCheckFail() {
{Addr, AllVtables}),
IntPtrTy);
+ // TODO: the instructions above are not annotated with debug info. It is
+ // inconvenient to do so because we hadn't determined the SanitizerKind yet.
const std::pair<int, SanitizerKind::SanitizerOrdinal> CheckKinds[] = {
{CFITCK_VCall, SanitizerKind::SO_CFIVCall},
{CFITCK_NVCall, SanitizerKind::SO_CFINVCall},
@@ -3960,6 +3977,9 @@ void CodeGenFunction::EmitCfiCheckFail() {
for (auto CheckKindOrdinalPair : CheckKinds) {
int Kind = CheckKindOrdinalPair.first;
SanitizerKind::SanitizerOrdinal Ordinal = CheckKindOrdinalPair.second;
+
+ ApplyDebugLocation ApplyTrapDI(*this, SanitizerAnnotateDebugInfo(Ordinal));
+
llvm::Value *Cond =
Builder.CreateICmpNE(CheckKind, llvm::ConstantInt::get(Int8Ty, Kind));
if (CGM.getLangOpts().Sanitize.has(Ordinal))
@@ -6245,6 +6265,8 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType,
(!TargetDecl || !isa<FunctionDecl>(TargetDecl))) {
SanitizerScope SanScope(this);
EmitSanitizerStatReport(llvm::SanStat_CFI_ICall);
+ ApplyDebugLocation ApplyTrapDI(
+ *this, SanitizerAnnotateDebugInfo(SanitizerKind::SO_CFIICall));
llvm::Metadata *MD;
if (CGM.getCodeGenOpts().SanitizeCfiICallGeneralizePointers)
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index c0bc3825f0188..ab36e0965d6fe 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -3353,6 +3353,17 @@ class CodeGenFunction : public CodeGenTypeCache {
SanitizerSet SkippedChecks = SanitizerSet(),
llvm::Value *ArraySize = nullptr);
+ /// Returns debug info, with additional annotation if enabled by
+ /// CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo[CheckKindOrdinal].
+ llvm::DILocation *
+ SanitizerAnnotateDebugInfo(SanitizerKind::SanitizerOrdinal CheckKindOrdinal);
+
+ /// Converts the CFITypeCheckKind into SanitizerKind::SanitizerOrdinal and
+ /// llvm::SanitizerStatKind.
+ void ParseCFITypeCheckKind(CFITypeCheckKind TCK,
+ SanitizerKind::SanitizerOrdinal &M,
+ llvm::SanitizerStatKind &SSK);
+
/// Emit a check that \p Base points into an array object, which
/// we can access at index \p Index. \p Accessed should be \c false if we
/// this expression is used as an lvalue, for instance in "&Arr[Idx]".
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 70b53be7e77a3..df12425ee46f9 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -703,6 +703,9 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
{
CodeGenFunction::SanitizerScope SanScope(&CGF);
+ ApplyDebugLocation ApplyTrapDI(
+ CGF, CGF.SanitizerAnnotateDebugInfo(SanitizerKind::SO_CFIMFCall));
+
llvm::Value *TypeId = nullptr;
llvm::Value *CheckResult = nullptr;
@@ -792,14 +795,16 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
// In the non-virtual path, the function pointer is actually a
// function pointer.
CGF.EmitBlock(FnNonVirtual);
+
llvm::Value *NonVirtualFn =
Builder.CreateIntToPtr(FnAsInt, CGF.UnqualPtrTy, "memptr.nonvirtualfn");
-
// Check the function pointer if CFI on member function pointers is enabled.
if (ShouldEmitCFICheck) {
CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl();
if (RD->hasDefinition()) {
CodeGenFunction::SanitizerScope SanScope(&CGF);
+ ApplyDebugLocation ApplyTrapDI(
+ CGF, CGF.SanitizerAnnotateDebugInfo(SanitizerKind::SO_CFIMFCall));
llvm::Constant *StaticData[] = {
llvm::ConstantInt::get(CGF.Int8Ty, CodeGenFunction::CFITCK_NVMFCall),
diff --git a/clang/test/CodeGen/bounds-checking-debuginfo.c b/clang/test/CodeGen/bounds-checking-debuginfo.c
index 74c06665dfe02..1549b02938697 100644
--- a/clang/test/CodeGen/bounds-checking-debuginfo.c
+++ b/clang/test/CodeGen/bounds-checking-debuginfo.c
@@ -89,7 +89,7 @@ double f1(int b, int i) {
// CHECK-TRAP: [[DBG21]] = !DILocation(line: 65, column: 3, scope: [[DBG4]])
// CHECK-TRAP: [[DBG22]] = !DILocation(line: 66, column: 12, scope: [[DBG4]])
// CHECK-TRAP: [[DBG23]] = !DILocation(line: 0, scope: [[META24:![0-9]+]], inlinedAt: [[DBG26]])
-// CHECK-TRAP: [[META24]] = distinct !DISubprogram(name: "__ubsan_check_array_bounds", scope: [[META5]], file: [[META5]], type: [[META25:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// CHECK-TRAP: [[META24]] = distinct !DISubprogram(name: "__ubsan_check_array-bounds", scope: [[META5]], file: [[META5]], type: [[META25:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// CHECK-TRAP: [[META25]] = !DISubroutineType(types: null)
// CHECK-TRAP: [[DBG26]] = !DILocation(line: 66, column: 10, scope: [[DBG4]])
// CHECK-TRAP: [[PROF27]] = !{!"branch_weights", i32 1048575, i32 1}
@@ -117,7 +117,7 @@ double f1(int b, int i) {
// CHECK-NOTRAP: [[DBG21]] = !DILocation(line: 65, column: 3, scope: [[DBG4]])
// CHECK-NOTRAP: [[DBG22]] = !DILocation(line: 66, column: 12, scope: [[DBG4]])
// CHECK-NOTRAP: [[DBG23]] = !DILocation(line: 0, scope: [[META24:![0-9]+]], inlinedAt: [[DBG26]])
-// CHECK-NOTRAP: [[META24]] = distinct !DISubprogram(name: "__ubsan_check_array_bounds", scope: [[META5]], file: [[META5]], type: [[META25:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// CHECK-NOTRAP: [[META24]] = distinct !DISubprogram(name: "__ubsan_check_array-bounds", scope: [[META5]], file: [[META5]], type: [[META25:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// CHECK-NOTRAP: [[META25]] = !DISubroutineType(types: null)
// CHECK-NOTRAP: [[DBG26]] = !DILocation(line: 66, column: 10, scope: [[DBG4]])
// CHECK-NOTRAP: [[PROF27]] = !{!"branch_weights", i32 1048575, i32 1}
diff --git a/clang/test/CodeGen/cfi-check-fail-debuginfo.c b/clang/test/CodeGen/cfi-check-fail-debuginfo.c
index cd5ec567cb01b..7100a42fef886 100644
--- a/clang/test/CodeGen/cfi-check-fail-debuginfo.c
+++ b/clang/test/CodeGen/cfi-check-fail-debuginfo.c
@@ -10,14 +10,14 @@
// CHECK-SAME: ptr noundef [[F:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] !dbg [[DBG7:![0-9]+]] !type [[META16:![0-9]+]] !type [[META17:![0-9]+]] !type [[META18:![0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: #dbg_value(ptr [[F]], [[META15:![0-9]+]], !DIExpression(), [[META19:![0-9]+]])
-// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[F]], metadata !"_ZTSFvvE"), !dbg [[DBG20:![0-9]+]], !nosanitize [[META21:![0-9]+]]
-// CHECK-NEXT: br i1 [[TMP0]], label %[[CFI_CONT:.*]], label %[[CFI_SLOWPATH:.*]], !dbg [[DBG20]], !prof [[PROF22:![0-9]+]], !nosanitize [[META21]]
+// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[F]], metadata !"_ZTSFvvE"), !dbg [[DBG20:![0-9]+]], !nosanitize [[META24:![0-9]+]]
+// CHECK-NEXT: br i1 [[TMP0]], label %[[CFI_CONT:.*]], label %[[CFI_SLOWPATH:.*]], !dbg [[DBG20]], !prof [[PROF25:![0-9]+]], !nosanitize [[META24]]
// CHECK: [[CFI_SLOWPATH]]:
-// CHECK-NEXT: tail call void @__cfi_slowpath(i64 9080559750644022485, ptr [[F]]) #[[ATTR6:[0-9]+]], !dbg [[DBG20]], !nosanitize [[META21]]
-// CHECK-NEXT: br label %[[CFI_CONT]], !dbg [[DBG20]], !nosanitize [[META21]]
+// CHECK-NEXT: tail call void @__cfi_slowpath(i64 9080559750644022485, ptr [[F]]) #[[ATTR6:[0-9]+]], !dbg [[DBG20]], !nosanitize [[META24]]
+// CHECK-NEXT: br label %[[CFI_CONT]], !dbg [[DBG20]], !nosanitize [[META24]]
// CHECK: [[CFI_CONT]]:
-// CHECK-NEXT: tail call void [[F]]() #[[ATTR6]], !dbg [[DBG20]]
-// CHECK-NEXT: ret void, !dbg [[DBG23:![0-9]+]]
+// CHECK-NEXT: tail call void [[F]]() #[[ATTR6]], !dbg [[DBG23:![0-9]+]]
+// CHECK-NEXT: ret void, !dbg [[DBG26:![0-9]+]]
//
void caller(void (*f)(void)) {
f();
@@ -38,8 +38,11 @@ void caller(void (*f)(void)) {
// CHECK: [[META17]] = !{i64 0, !"_ZTSFvPvE.generalized"}
// CHECK: [[META18]] = !{i64 0, i64 2451761621477796417}
// CHECK: [[META19]] = !DILocation(line: 0, scope: [[DBG7]])
-// CHECK: [[DBG20]] = !DILocation(line: 23, column: 3, scope: [[DBG7]])
-// CHECK: [[META21]] = !{}
-// CHECK: [[PROF22]] = !{!"branch_weights", i32 1048575, i32 1}
-// CHECK: [[DBG23]] = !DILocation(line: 24, column: 1, scope: [[DBG7]])
+// CHECK: [[DBG20]] = !DILocation(line: 0, scope: [[META21:![0-9]+]], inlinedAt: [[DBG23]])
+// CHECK: [[META21]] = distinct !DISubprogram(name: "__ubsan_check_cfi-icall", scope: [[META8]], file: [[META8]], type: [[META22:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// CHECK: [[META22]] = !DISubroutineType(types: null)
+// CHECK: [[DBG23]] = !DILocation(line: 23, column: 3, scope: [[DBG7]])
+// CHECK: [[META24]] = !{}
+// CHECK: [[PROF25]] = !{!"branch_weights", i32 1048575, i32 1}
+// CHECK: [[DBG26]] = !DILocation(line: 24, column: 1, scope: [[DBG7]])
//.
diff --git a/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c b/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c
index 8b184528889a0..e47f058e2c633 100644
--- a/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c
+++ b/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c
@@ -27,27 +27,27 @@ int** f(const char *a, const char **b) {
// UNGENERALIZED-SAME: ptr noundef [[FP:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] !dbg [[DBG25:![0-9]+]] !type [[META31:![0-9]+]] !type [[META32:![0-9]+]] {
// UNGENERALIZED-NEXT: [[ENTRY:.*:]]
// UNGENERALIZED-NEXT: #dbg_value(ptr [[FP]], [[META30:![0-9]+]], !DIExpression(), [[META33:![0-9]+]])
-// UNGENERALIZED-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FP]], metadata !"_ZTSFPPiPKcPS2_E"), !dbg [[DBG34:![0-9]+]], !nosanitize [[META35:![0-9]+]]
-// UNGENERALIZED-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG34]], !prof [[PROF36:![0-9]+]], !nosanitize [[META35]]
+// UNGENERALIZED-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FP]], metadata !"_ZTSFPPiPKcPS2_E"), !dbg [[DBG34:![0-9]+]], !nosanitize [[META38:![0-9]+]]
+// UNGENERALIZED-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG34]], !prof [[PROF39:![0-9]+]], !nosanitize [[META38]]
// UNGENERALIZED: [[TRAP]]:
-// UNGENERALIZED-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR4:[0-9]+]], !dbg [[DBG34]], !nosanitize [[META35]]
-// UNGENERALIZED-NEXT: unreachable, !dbg [[DBG34]], !nosanitize [[META35]]
+// UNGENERALIZED-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR4:[0-9]+]], !dbg [[DBG34]], !nosanitize [[META38]]
+// UNGENERALIZED-NEXT: unreachable, !dbg [[DBG34]], !nosanitize [[META38]]
// UNGENERALIZED: [[CONT]]:
-// UNGENERALIZED-NEXT: [[CALL:%.*]] = tail call ptr [[FP]](ptr noundef null, ptr noundef null) #[[ATTR5:[0-9]+]], !dbg [[DBG34]]
-// UNGENERALIZED-NEXT: ret void, !dbg [[DBG37:![0-9]+]]
+// UNGENERALIZED-NEXT: [[CALL:%.*]] = tail call ptr [[FP]](ptr noundef null, ptr noundef null) #[[ATTR5:[0-9]+]], !dbg [[DBG37:![0-9]+]]
+// UNGENERALIZED-NEXT: ret void, !dbg [[DBG40:![0-9]+]]
//
// GENERALIZED-LABEL: define dso_local void @g(
// GENERALIZED-SAME: ptr noundef [[FP:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] !dbg [[DBG25:![0-9]+]] !type [[META31:![0-9]+]] !type [[META32:![0-9]+]] {
// GENERALIZED-NEXT: [[ENTRY:.*:]]
// GENERALIZED-NEXT: #dbg_value(ptr [[FP]], [[META30:![0-9]+]], !DIExpression(), [[META33:![0-9]+]])
-// GENERALIZED-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FP]], metadata !"_ZTSFPvPKvS_E.generalized"), !dbg [[DBG34:![0-9]+]], !nosanitize [[META35:![0-9]+]]
-// GENERALIZED-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG34]], !prof [[PROF36:![0-9]+]], !nosanitize [[META35]]
+// GENERALIZED-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FP]], metadata !"_ZTSFPvPKvS_E.generalized"), !dbg [[DBG34:![0-9]+]], !nosanitize [[META38:![0-9]+]]
+// GENERALIZED-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG34]], !prof [[PROF39:![0-9]+]], !nosanitize [[META38]]
// GENERALIZED: [[TRAP]]:
-// GENERALIZED-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR4:[0-9]+]], !dbg [[DBG34]], !nosanitize [[META35]]
-// GENERALIZED-NEXT: unreachable, !dbg [[DBG34]], !nosanitize [[META35]]
+// GENERALIZED-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR4:[0-9]+]], !dbg [[DBG34]], !nosanitize [[META38]]
+// GENERALIZED-NEXT: unreachable, !dbg [[DBG34]], !nosanitize [[META38]]
// GENERALIZED: [[CONT]]:
-// GENERALIZED-NEXT: [[CALL:%.*]] = tail call ptr [[FP]](ptr noundef null, ptr noundef null) #[[ATTR5:[0-9]+]], !dbg [[DBG34]]
-// GENERALIZED-NEXT: ret void, !dbg [[DBG37:![0-9]+]]
+// GENERALIZED-NEXT: [[CALL:%.*]] = tail call ptr [[FP]](ptr noundef null, ptr noundef null) #[[ATTR5:[0-9]+]], !dbg [[DBG37:![0-9]+]]
+// GENERALIZED-NEXT: ret void, !dbg [[DBG40:![0-9]+]]
//
void g(int** (*fp)(const char *, const char **)) {
fp(0, 0);
@@ -84,10 +84,13 @@ void g(int** (*fp)(const char *, const char **)) {
// UNGENERALIZED: [[META31]] = !{i64 0, !"_ZTSFvPFPPiPKcPS2_EE"}
// UNGENERALIZED: [[META32]] = !{i64 0, !"_ZTSFvPvE.generalized"}
// UNGENERALIZED: [[META33]] = !DILocation(line: 0, scope: [[DBG25]])
-// UNGENERALIZED: [[DBG34]] = !DILocation(line: 53, column: 3, scope: [[DBG25]])
-// UNGENERALIZED: [[META35]] = !{}
-// UNGENERALIZED: [[PROF36]] = !{!"branch_weights", i32 1048575, i32 1}
-// UNGENERALIZED: [[DBG37]] = !DILocation(line: 54, column: 1, scope: [[DBG25]])
+// UNGENERALIZED: [[DBG34]] = !DILocation(line: 0, scope: [[META35:![0-9]+]], inlinedAt: [[DBG37]])
+// UNGENERALIZED: [[META35]] = distinct !DISubprogram(name: "__ubsan_check_cfi-icall", scope: [[META11]], file: [[META11]], type: [[META36:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// UNGENERALIZED: [[META36]] = !DISubroutineType(types: null)
+// UNGENERALIZED: [[DBG37]] = !DILocation(line: 53, column: 3, scope: [[DBG25]])
+// UNGENERALIZED: [[META38]] = !{}
+// UNGENERALIZED: [[PROF39]] = !{!"branch_weights", i32 1048575, i32 1}
+// UNGENERALIZED: [[DBG40]] = !DILocation(line: 54, column: 1, scope: [[DBG25]])
//.
// GENERALIZED: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
// GENERALIZED: [[META1]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}})
@@ -119,8 +122,11 @@ void g(int** (*fp)(const char *, const char **)) {
// GENERALIZED: [[META31]] = !{i64 0, !"_ZTSFvPFPPiPKcPS2_EE"}
// GENERALIZED: [[META32]] = !{i64 0, !"_ZTSFvPvE.generalized"}
// GENERALIZED: [[META33]] = !DILocation(line: 0, scope: [[DBG25]])
-// GENERALIZED: [[DBG34]] = !DILocation(line: 53, column: 3, scope: [[DBG25]])
-// GENERALIZED: [[META35]] = !{}
-// GENERALIZED: [[PROF36]] = !{!"branch_weights", i32 1048575, i32 1}
-// GENERALIZED: [[DBG37]] = !DILocation(line: 54, column: 1, scope: [[DBG25]])
+// GENERALIZED: [[DBG34]] = !DILocation(line: 0, scope: [[META35:![0-9]+]], inlinedAt: [[DBG37]])
+// GENERALIZED: [[META35]] = distinct !DISubprogram(name: "__ubsan_check_cfi-icall", scope: [[META11]], file: [[META11]], type: [[META36:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// GENERALIZED: [[META36]] = !DISubroutineType(types: null)
+// GENERALIZED: [[DBG37]] = !DILocation(line: 53, column: 3, scope: [[DBG25]])
+// GENERALIZED: [[META38]] = !{}
+// GENERALIZED: [[PROF39]] = !{!"branch_weights", i32 1048575, i32 1}
+// GENERALIZED: [[DBG40]] = !DILocation(line: 54, column: 1, scope: [[DBG25]])
//.
diff --git a/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c b/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
index 00f416e47dee6..2c1574b646087 100644
--- a/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
+++ b/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
@@ -12,53 +12,53 @@
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: #dbg_value(ptr [[FN]], [[META16:![0-9]+]], !DIExpression(), [[META20:![0-9]+]])
// CHECK-NEXT: #dbg_value(i32 [[ARG]], [[META17:![0-9]+]], !DIExpression(), [[META20]])
-// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32E.normalized"), !dbg [[DBG21:![0-9]+]], !nosanitize [[META22:![0-9]+]]
-// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG21]], !prof [[PROF23:![0-9]+]], !nosanitize [[META22]]
+// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32E.normalized"), !dbg [[DBG21:![0-9]+]], !nosanitize [[META25:![0-9]+]]
+// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG21]], !prof [[PROF26:![0-9]+]], !nosanitize [[META25]]
// CHECK: [[TRAP]]:
-// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3:[0-9]+]], !dbg [[DBG21]], !nosanitize [[META22]]
-// CHECK-NEXT: unreachable, !dbg [[DBG21]], !nosanitize [[META22]]
+// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3:[0-9]+]], !dbg [[DBG21]], !nosanitize [[META25]]
+// CHECK-NEXT: unreachable, !dbg [[DBG21]], !nosanitize [[META25]]
// CHECK: [[CONT]]:
-// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG]]) #[[ATTR4:[0-9]+]], !dbg [[DBG21]]
-// CHECK-NEXT: ret void, !dbg [[DBG24:![0-9]+]]
+// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG]]) #[[ATTR4:[0-9]+]], !dbg [[DBG24:![0-9]+]]
+// CHECK-NEXT: ret void, !dbg [[DBG27:![0-9]+]]
//
void foo(void (*fn)(int), int arg) {
fn(arg);
}
// CHECK-LABEL: define dso_local void @bar(
-// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]]) local_unnamed_addr #[[ATTR0]] !dbg [[DBG25:![0-9]+]] !type [[META35:![0-9]+]] !type [[META36:![0-9]+]] {
+// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]]) local_unnamed_addr #[[ATTR0]] !dbg [[DBG28:![0-9]+]] !type [[META38:![0-9]+]] !type [[META39:![0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
-// CHECK-NEXT: #dbg_value(ptr [[FN]], [[META32:![0-9]+]], !DIExpression(), [[META37:![0-9]+]])
-// CHECK-NEXT: #dbg_value(i32 [[ARG1]], [[META33:![0-9]+]], !DIExpression(), [[META37]])
-// CHECK-NEXT: #dbg_value(i32 [[ARG2]], [[META34:![0-9]+]], !DIExpression(), [[META37]])
-// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32S_E.normalized"), !dbg [[DBG38:![0-9]+]], !nosanitize [[META22]]
-// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG38]], !prof [[PROF23]], !nosanitize [[META22]]
+// CHECK-NEXT: #dbg_value(ptr [[FN]], [[META35:![0-9]+]], !DIExpression(), [[META40:![0-9]+]])
+// CHECK-NEXT: #dbg_value(i32 [[ARG1]], [[META36:![0-9]+]], !DIExpression(), [[META40]])
+// CHECK-NEXT: #dbg_value(i32 [[ARG2]], [[META37:![0-9]+]], !DIExpression(), [[META40]])
+// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32S_E.normalized"), !dbg [[DBG41:![0-9]+]], !nosanitize [[META25]]
+// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG41]], !prof [[PROF26]], !nosanitize [[META25]]
// CHECK: [[TRAP]]:
-// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG38]], !nosanitize [[META22]]
-// CHECK-NEXT: unreachable, !dbg [[DBG38]], !nosanitize [[META22]]
+// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG41]], !nosanitize [[META25]]
+// CHECK-NEXT: unreachable, !dbg [[DBG41]], !nosanitize [[META25]]
// CHECK: [[CONT]]:
-// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG1]], i32 noundef [[ARG2]]) #[[ATTR4]], !dbg [[DBG38]]
-// CHECK-NEXT: ret void, !dbg [[DBG39:![0-9]+]]
+// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG1]], i32 noundef [[ARG2]]) #[[ATTR4]], !dbg [[DBG42:![0-9]+]]
+// CHECK-NEXT: ret void, !dbg [[DBG43:![0-9]+]]
//
void bar(void (*fn)(int, int), int arg1, int arg2) {
fn(arg1, arg2);
}
// CHECK-LABEL: define dso_local void @baz(
-// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]], i32 noundef [[ARG3:%.*]]) local_unnamed_addr #[[ATTR0]] !dbg [[DBG40:![0-9]+]] !type [[META51:![0-9]+]] !type [[META52:![0-9]+]] {
+// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]], i32 noundef [[ARG3:%.*]]) local_unnamed_addr #[[ATTR0]] !dbg [[DBG44:![0-9]+]] !type [[META55:![0-9]+]] !type [[META56:![0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
-// CHECK-NEXT: #dbg_value(ptr [[FN]], [[META47:![0-9]+]], !DIExpression(), [[META53:![0-9]+]])
-// CHECK-NEXT: #dbg_value(i32 [[ARG1]], [[META48:![0-9]+]], !DIExpression(), [[META53]])
-// CHECK-NEXT: #dbg_value(i32 [[ARG2]], [[META49:![0-9]+]], !DIExpression(), [[META53]])
-// CHECK-NEXT: #dbg_value(i32 [[ARG3]], [[META50:![0-9]+]], !DIExpression(), [[META53]])
-// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32S_S_E.normalized"), !dbg [[DBG54:![0-9]+]], !nosanitize [[META22]]
-// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG54]], !prof [[PROF23]], !nosanitize [[META22]]
+// CHECK-NEXT: #dbg_value(ptr [[FN]], [[META51:![0-9]+]], !DIExpression(), [[META57:![0-9]+]])
+// CHECK-NEXT: #dbg_value(i32 [[ARG1]], [[META52:![0-9]+]], !DIExpression(), [[META57]])
+// CHECK-NEXT: #dbg_value(i32 [[ARG2]], [[META53:![0-9]+]], !DIExpression(), [[META57]])
+// CHECK-NEXT: #dbg_value(i32 [[ARG3]], [[META54:![0-9]+]], !DIExpression(), [[META57]])
+// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32S_S_E.normalized"), !dbg [[DBG58:![0-9]+]], !nosanitize [[META25]]
+// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG58]], !prof [[PROF26]], !nosanitize [[META25]]
// CHECK: [[TRAP]]:
-// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG54]], !nosanitize [[META22]]
-// CHECK-NEXT: unreachable, !dbg [[DBG54]], !nosanitize [[META22]]
+// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG58]], !nosanitize [[META25]]
+// CHECK-NEXT: unreachable, !dbg [[DBG58]], !nosanitize [[META25]]
// CHECK: [[CONT]]:
-// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG1]], i32 noundef [[ARG2]], i32 noundef [[ARG3]]) #[[ATTR4]], !dbg [[DBG54]]
-// CHECK-NEXT: ret void, !dbg [[DBG55:![0-9]+]]
+// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG1]], i32 noundef [[ARG2]], i32 noundef [[ARG3]]) #[[ATTR4]], !dbg [[DBG59:![0-9]+]]
+// CHECK-NEXT: ret void, !dbg [[DBG60:![0-9]+]]
//
void baz(void (*fn)(int, int, int), int arg1, int arg2, int arg3) {
fn(arg1, arg2, arg3);
@@ -81,39 +81,44 @@ void baz(void (*fn)(int, int, int), int arg1, int arg2, int arg3) {
// CHECK: [[META18]] = !{i64 0, !"_ZTSFvPFvu3i32ES_E.normalized"}
// CHECK: [[META19]] = !{i64 0, !"_ZTSFvPvu3i32E.normalized.generalized"}
// CHECK: [[META20]] = !DILocation(line: 0, scope: [[DBG7]])
-// CHECK: [[DBG21]] = !DILocation(line: 25, column: 5, scope: [[DBG7]])
-// CHECK: [[META22]] = !{}
-// CHECK: [[PROF23]] = !{!"branch_weights", i32 1048575, i32 1}
-// CHECK: [[DBG24]] = !DILocation(line: 26, column: 1, scope: [[DBG7]])
-// CHECK: [[DBG25]] = distinct !DISubprogram(name: "bar", scope: [[META8]], file: [[META8]], line: 43, type: [[META26:![0-9]+]], scopeLine: 43, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META31:![0-9]+]])
-// CHECK: [[META26]] = !DISubroutineType(types: [[META27:![0-9]+]])
-// CHECK: [[META27]] = !{null, [[META28:![0-9]+]], [[META14]], [[META14]]}
-// CHECK: [[META28]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META29:![0-9]+]], size: 64)
+// CHECK: [[DBG21]] = !DILocation(line: 0, scope: [[META22:![0-9]+]], inlinedAt: [[DBG24]])
+// CHECK: [[META22]] = distinct !DISubprogram(name: "__ubsan_check_cfi-icall", scope: [[META8]], file: [[META8]], type: [[META23:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// CHECK: [[META23]] = !DISubroutineType(types: null)
+// CHECK: [[DBG24]] = !DILocation(line: 25, column: 5, scope: [[DBG7]])
+// CHECK: [[META25]] = !{}
+// CHECK: [[PROF26]] = !{!"branch_weights", i32 1048575, i32 1}
+// CHECK: [[DBG27]] = !DILocation(line: 26, column: 1, scope: [[DBG7]])
+// CHECK: [[DBG28]] = distinct !DISubprogram(name: "bar", scope: [[META8]], file: [[META8]], line: 43, type: [[META29:![0-9]+]], scopeLine: 43, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META34:![0-9]+]])
// CHECK: [[META29]] = !DISubroutineType(types: [[META30:![0-9]+]])
-// CHECK: [[META30]] = !{null, [[META14]], [[META14]]}
-// CHECK: [[META31]] = !{[[META32]], [[META33]], [[META34]]}
-// CHECK: [[META32]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG25]], file: [[META8]], line: 43, type: [[META28]])
-// CHECK: [[META33]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG25]], file: [[META8]], line: 43, type: [[META14]])
-// CHECK: [[META34]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG25]], file: [[META8]], line: 43, type: [[META14]])
-// CHECK: [[META35]] = !{i64 0, !"_ZTSFvPFvu3i32S_ES_S_E.normalized"}
-// CHECK: [[META36]] = !{i64 0, !"_ZTSFvPvu3i32S0_E.normalized.generalized"}
-// CHECK: [[META37]] = !DILocation(line: 0, scope: [[DBG25]])
-// CHECK: [[DBG38]] = !DILocation(line: 44, column: 5, scope: [[DBG25]])
-// CHECK: [[DBG39]] = !DILocation(line: 45, column: 1, scope: [[DBG25]])
-// CHECK: [[DBG40]] = distinct !DISubprogram(name: "baz", scope: [[META8]], file: [[META8]], line: 63, type: [[META41:![0-9]+]], scopeLine: 63, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META46:![0-9]+]])
-// CHECK: [[META41]] = !DISubroutineType(types: [[META42:![0-9]+]])
-// CHECK: [[META42]] = !{null, [[META43:![0-9]+]], [[META14]], [[META14]], [[META14]]}
-// CHECK: [[META43]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META44:![0-9]+]], size: 64)
-// CHECK: [[META44]] = !DISubroutineType(types: [[META45:![0-9]+]])
-// CHECK: [[META45]] = !{null, [[META14]], [[META14]], [[META14]]}
-// CHECK: [[META46]] = !{[[META47]], [[META48]], [[META49]], [[META50]]}
-// CHECK: [[META47]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG40]], file: [[META8]], line: 63, type: [[META43]])
-// CHECK: [[META48]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG40]], file: [[META8]], line: 63, type: [[META14]])
-// CHECK: [[META49]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG40]], file: [[META8]], line: 63, type: [[META14]])
-// CHECK: [[META50]] = !DILocalVariable(name: "arg3", arg: 4, scope: [[DBG40]], file: [[META8]], line: 63, type: [[META14]])
-// CHECK: [[META51]] = !{i64 0, !"_ZTSFvPFvu3i32S_S_ES_S_S_E.normalized"}
-// CHECK: [[META52]] = !{i64 0, !"_ZTSFvPvu3i32S0_S0_E.normalized.generalized"}
-// CHECK: [[META53]] = !DILocation(line: 0, scope: [[DBG40]])
-// CHECK: [[DBG54]] = !DILocation(line: 64, column: 5, scope: [[DBG40]])
-// CHECK: [[DBG55]] = !DILocation(line: 65, column: 1, scope: [[DBG40]])
+// CHECK: [[META30]] = !{null, [[META31:![0-9]+]], [[META14]], [[META14]]}
+// CHECK: [[META31]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META32:![0-9]+]], size: 64)
+// CHECK: [[META32]] = !DISubroutineType(types: [[META33:![0-9]+]])
+// CHECK: [[META33]] = !{null, [[META14]], [[META14]]}
+// CHECK: [[META34]] = !{[[META35]], [[META36]], [[META37]]}
+// CHECK: [[META35]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG28]], file: [[META8]], line: 43, type: [[META31]])
+// CHECK: [[META36]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG28]], file: [[META8]], line: 43, type: [[META14]])
+// CHECK: [[META37]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG28]], file: [[META8]], line: 43, type: [[META14]])
+// CHECK: [[META38]] = !{i64 0, !"_ZTSFvPFvu3i32S_ES_S_E.normalized"}
+// CHECK: [[META39]] = !{i64 0, !"_ZTSFvPvu3i32S0_E.normalized.generalized"}
+// CHECK: [[META40]] = !DILocation(line: 0, scope: [[DBG28]])
+// CHECK: [[DBG41]] = !DILocation(line: 0, scope: [[META22]], inlinedAt: [[DBG42]])
+// CHECK: [[DBG42]] = !DILocation(line: 44, column: 5, scope: [[DBG28]])
+// CHECK: [[DBG43]] = !DILocation(line: 45, column: 1, scope: [[DBG28]])
+// CHECK: [[DBG44]] = distinct !DISubprogram(name: "baz", scope: [[META8]], file: [[META8]], line: 63, type: [[META45:![0-9]+]], scopeLine: 63, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META50:![0-9]+]])
+// CHECK: [[META45]] = !DISubroutineType(types: [[META46:![0-9]+]])
+// CHECK: [[META46]] = !{null, [[META47:![0-9]+]], [[META14]], [[META14]], [[META14]]}
+// CHECK: [[META47]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META48:![0-9]+]], size: 64)
+// CHECK: [[META48]] = !DISubroutineType(types: [[META49:![0-9]+]])
+// CHECK: [[META49]] = !{null, [[META14]], [[META14]], [[META14]]}
+// CHECK: [[META50]] = !{[[META51]], [[META52]], [[META53]], [[META54]]}
+// CHECK: [[META51]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG44]], file: [[META8]], line: 63, type: [[META47]])
+// CHECK: [[META52]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG44]], file: [[META8]], line: 63, type: [[META14]])
+// CHECK: [[META53]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG44]], file: [[META8]], line: 63, type: [[META14]])
+// CHECK: [[META54]] = !DILocalVariable(name: "arg3", arg: 4, scope: [[DBG44]], file: [[META8]], line: 63, type: [[META14]])
+// CHECK: [[META55]] = !{i64 0, !"_ZTSFvPFvu3i32S_S_ES_S_S_E.normalized"}
+// CHECK: [[META56]] = !{i64 0, !"_ZTSFvPvu3i32S0_S0_E.normalized.generalized"}
+// CHECK: [[META57]] = !DILocation(line: 0, scope: [[DBG44]])
+// CHECK: [[DBG58]] = !DILocation(line: 0, scope: [[META22]], inlinedAt: [[DBG59]])
+// CHECK: [[DBG59]] = !DILocation(line: 64, column: 5, scope: [[DBG44]])
+// CHECK: [[DBG60]] = !DILocation(line: 65, column: 1, scope: [[DBG44]])
//.
>From b10ca9cbcf11eff5b84ec495079087355fe47a9a Mon Sep 17 00:00:00 2001
From: Thurston Dang <thurston at google.com>
Date: Tue, 13 May 2025 23:15:48 +0000
Subject: [PATCH 2/4] Undo whitespace change
---
clang/lib/CodeGen/ItaniumCXXABI.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index df12425ee46f9..d7f8fd82fc159 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -795,9 +795,9 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
// In the non-virtual path, the function pointer is actually a
// function pointer.
CGF.EmitBlock(FnNonVirtual);
-
llvm::Value *NonVirtualFn =
Builder.CreateIntToPtr(FnAsInt, CGF.UnqualPtrTy, "memptr.nonvirtualfn");
+
// Check the function pointer if CFI on member function pointers is enabled.
if (ShouldEmitCFICheck) {
CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl();
>From dfc3919acb799b7ebb0b99f7003b3cd6097d8ea7 Mon Sep 17 00:00:00 2001
From: Thurston Dang <thurston at google.com>
Date: Tue, 13 May 2025 23:43:38 +0000
Subject: [PATCH 3/4] Sanitize labels
---
clang/lib/CodeGen/CGExpr.cpp | 7 ++++++-
clang/test/CodeGen/bounds-checking-debuginfo.c | 12 ++++++------
clang/test/CodeGen/cfi-check-fail-debuginfo.c | 2 +-
clang/test/CodeGen/cfi-icall-generalize-debuginfo.c | 4 ++--
clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c | 2 +-
5 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 8519584c1f081..2dad704802115 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -1219,7 +1219,7 @@ void CodeGenFunction::EmitBoundsCheck(const Expr *E, const Expr *Base,
llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo(
SanitizerKind::SanitizerOrdinal CheckKindOrdinal) {
- StringRef Label;
+ std::string Label;
switch (CheckKindOrdinal) {
#define SANITIZER(NAME, ID) \
case SanitizerKind::SO_##ID: \
@@ -1230,6 +1230,11 @@ llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo(
llvm_unreachable("unexpected sanitizer kind");
}
+ // Sanitize label
+ for (unsigned int i = 0; i < Label.length(); i++)
+ if (!std::isalpha(Label[i]))
+ Label[i] = '_';
+
llvm::DILocation *CheckDI = Builder.getCurrentDebugLocation();
// TODO: deprecate ClArrayBoundsPseudoFn
if (((ClArrayBoundsPseudoFn &&
diff --git a/clang/test/CodeGen/bounds-checking-debuginfo.c b/clang/test/CodeGen/bounds-checking-debuginfo.c
index 1549b02938697..43762eed9e2fe 100644
--- a/clang/test/CodeGen/bounds-checking-debuginfo.c
+++ b/clang/test/CodeGen/bounds-checking-debuginfo.c
@@ -68,9 +68,9 @@ double f1(int b, int i) {
//.
// CHECK-TRAP: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
-// CHECK-TRAP: [[META1]] = !DIFile(filename: "<stdin>", directory: {{.*}})
+// CHECK-TRAP: [[META1]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}})
// CHECK-TRAP: [[DBG4]] = distinct !DISubprogram(name: "f1", scope: [[META5:![0-9]+]], file: [[META5]], line: 63, type: [[META6:![0-9]+]], scopeLine: 63, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META10]])
-// CHECK-TRAP: [[META5]] = !DIFile(filename: "bounds-checking-debuginfo.c", directory: {{.*}})
+// CHECK-TRAP: [[META5]] = !DIFile(filename: "{{.*}}bounds-checking-debuginfo.c", directory: {{.*}})
// CHECK-TRAP: [[META6]] = !DISubroutineType(types: [[META7:![0-9]+]])
// CHECK-TRAP: [[META7]] = !{[[META8:![0-9]+]], [[META9:![0-9]+]], [[META9]]}
// CHECK-TRAP: [[META8]] = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)
@@ -89,16 +89,16 @@ double f1(int b, int i) {
// CHECK-TRAP: [[DBG21]] = !DILocation(line: 65, column: 3, scope: [[DBG4]])
// CHECK-TRAP: [[DBG22]] = !DILocation(line: 66, column: 12, scope: [[DBG4]])
// CHECK-TRAP: [[DBG23]] = !DILocation(line: 0, scope: [[META24:![0-9]+]], inlinedAt: [[DBG26]])
-// CHECK-TRAP: [[META24]] = distinct !DISubprogram(name: "__ubsan_check_array-bounds", scope: [[META5]], file: [[META5]], type: [[META25:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// CHECK-TRAP: [[META24]] = distinct !DISubprogram(name: "__ubsan_check_array_bounds", scope: [[META5]], file: [[META5]], type: [[META25:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// CHECK-TRAP: [[META25]] = !DISubroutineType(types: null)
// CHECK-TRAP: [[DBG26]] = !DILocation(line: 66, column: 10, scope: [[DBG4]])
// CHECK-TRAP: [[PROF27]] = !{!"branch_weights", i32 1048575, i32 1}
// CHECK-TRAP: [[DBG28]] = !DILocation(line: 66, column: 3, scope: [[DBG4]])
//.
// CHECK-NOTRAP: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
-// CHECK-NOTRAP: [[META1]] = !DIFile(filename: "<stdin>", directory: {{.*}})
+// CHECK-NOTRAP: [[META1]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}})
// CHECK-NOTRAP: [[DBG4]] = distinct !DISubprogram(name: "f1", scope: [[META5:![0-9]+]], file: [[META5]], line: 63, type: [[META6:![0-9]+]], scopeLine: 63, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META10]])
-// CHECK-NOTRAP: [[META5]] = !DIFile(filename: "bounds-checking-debuginfo.c", directory: {{.*}})
+// CHECK-NOTRAP: [[META5]] = !DIFile(filename: "{{.*}}bounds-checking-debuginfo.c", directory: {{.*}})
// CHECK-NOTRAP: [[META6]] = !DISubroutineType(types: [[META7:![0-9]+]])
// CHECK-NOTRAP: [[META7]] = !{[[META8:![0-9]+]], [[META9:![0-9]+]], [[META9]]}
// CHECK-NOTRAP: [[META8]] = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)
@@ -117,7 +117,7 @@ double f1(int b, int i) {
// CHECK-NOTRAP: [[DBG21]] = !DILocation(line: 65, column: 3, scope: [[DBG4]])
// CHECK-NOTRAP: [[DBG22]] = !DILocation(line: 66, column: 12, scope: [[DBG4]])
// CHECK-NOTRAP: [[DBG23]] = !DILocation(line: 0, scope: [[META24:![0-9]+]], inlinedAt: [[DBG26]])
-// CHECK-NOTRAP: [[META24]] = distinct !DISubprogram(name: "__ubsan_check_array-bounds", scope: [[META5]], file: [[META5]], type: [[META25:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// CHECK-NOTRAP: [[META24]] = distinct !DISubprogram(name: "__ubsan_check_array_bounds", scope: [[META5]], file: [[META5]], type: [[META25:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// CHECK-NOTRAP: [[META25]] = !DISubroutineType(types: null)
// CHECK-NOTRAP: [[DBG26]] = !DILocation(line: 66, column: 10, scope: [[DBG4]])
// CHECK-NOTRAP: [[PROF27]] = !{!"branch_weights", i32 1048575, i32 1}
diff --git a/clang/test/CodeGen/cfi-check-fail-debuginfo.c b/clang/test/CodeGen/cfi-check-fail-debuginfo.c
index 7100a42fef886..74ed5564ec704 100644
--- a/clang/test/CodeGen/cfi-check-fail-debuginfo.c
+++ b/clang/test/CodeGen/cfi-check-fail-debuginfo.c
@@ -39,7 +39,7 @@ void caller(void (*f)(void)) {
// CHECK: [[META18]] = !{i64 0, i64 2451761621477796417}
// CHECK: [[META19]] = !DILocation(line: 0, scope: [[DBG7]])
// CHECK: [[DBG20]] = !DILocation(line: 0, scope: [[META21:![0-9]+]], inlinedAt: [[DBG23]])
-// CHECK: [[META21]] = distinct !DISubprogram(name: "__ubsan_check_cfi-icall", scope: [[META8]], file: [[META8]], type: [[META22:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// CHECK: [[META21]] = distinct !DISubprogram(name: "__ubsan_check_cfi_icall", scope: [[META8]], file: [[META8]], type: [[META22:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// CHECK: [[META22]] = !DISubroutineType(types: null)
// CHECK: [[DBG23]] = !DILocation(line: 23, column: 3, scope: [[DBG7]])
// CHECK: [[META24]] = !{}
diff --git a/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c b/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c
index e47f058e2c633..304b60539c3d1 100644
--- a/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c
+++ b/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c
@@ -85,7 +85,7 @@ void g(int** (*fp)(const char *, const char **)) {
// UNGENERALIZED: [[META32]] = !{i64 0, !"_ZTSFvPvE.generalized"}
// UNGENERALIZED: [[META33]] = !DILocation(line: 0, scope: [[DBG25]])
// UNGENERALIZED: [[DBG34]] = !DILocation(line: 0, scope: [[META35:![0-9]+]], inlinedAt: [[DBG37]])
-// UNGENERALIZED: [[META35]] = distinct !DISubprogram(name: "__ubsan_check_cfi-icall", scope: [[META11]], file: [[META11]], type: [[META36:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// UNGENERALIZED: [[META35]] = distinct !DISubprogram(name: "__ubsan_check_cfi_icall", scope: [[META11]], file: [[META11]], type: [[META36:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// UNGENERALIZED: [[META36]] = !DISubroutineType(types: null)
// UNGENERALIZED: [[DBG37]] = !DILocation(line: 53, column: 3, scope: [[DBG25]])
// UNGENERALIZED: [[META38]] = !{}
@@ -123,7 +123,7 @@ void g(int** (*fp)(const char *, const char **)) {
// GENERALIZED: [[META32]] = !{i64 0, !"_ZTSFvPvE.generalized"}
// GENERALIZED: [[META33]] = !DILocation(line: 0, scope: [[DBG25]])
// GENERALIZED: [[DBG34]] = !DILocation(line: 0, scope: [[META35:![0-9]+]], inlinedAt: [[DBG37]])
-// GENERALIZED: [[META35]] = distinct !DISubprogram(name: "__ubsan_check_cfi-icall", scope: [[META11]], file: [[META11]], type: [[META36:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// GENERALIZED: [[META35]] = distinct !DISubprogram(name: "__ubsan_check_cfi_icall", scope: [[META11]], file: [[META11]], type: [[META36:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// GENERALIZED: [[META36]] = !DISubroutineType(types: null)
// GENERALIZED: [[DBG37]] = !DILocation(line: 53, column: 3, scope: [[DBG25]])
// GENERALIZED: [[META38]] = !{}
diff --git a/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c b/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
index 2c1574b646087..a2f6ee0c6805c 100644
--- a/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
+++ b/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
@@ -82,7 +82,7 @@ void baz(void (*fn)(int, int, int), int arg1, int arg2, int arg3) {
// CHECK: [[META19]] = !{i64 0, !"_ZTSFvPvu3i32E.normalized.generalized"}
// CHECK: [[META20]] = !DILocation(line: 0, scope: [[DBG7]])
// CHECK: [[DBG21]] = !DILocation(line: 0, scope: [[META22:![0-9]+]], inlinedAt: [[DBG24]])
-// CHECK: [[META22]] = distinct !DISubprogram(name: "__ubsan_check_cfi-icall", scope: [[META8]], file: [[META8]], type: [[META23:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
+// CHECK: [[META22]] = distinct !DISubprogram(name: "__ubsan_check_cfi_icall", scope: [[META8]], file: [[META8]], type: [[META23:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// CHECK: [[META23]] = !DISubroutineType(types: null)
// CHECK: [[DBG24]] = !DILocation(line: 25, column: 5, scope: [[DBG7]])
// CHECK: [[META25]] = !{}
>From fd3fd98add4cfadda22059dc6f175c08627ac282 Mon Sep 17 00:00:00 2001
From: Thurston Dang <thurston at google.com>
Date: Tue, 13 May 2025 23:53:19 +0000
Subject: [PATCH 4/4] static std::pair<SanitizerKind::SanitizerOrdinal,
llvm::SanitizerStatKind> ParseCFITypeCheckKind(CFITypeCheckKind TCK);
---
clang/lib/CodeGen/CGClass.cpp | 23 +++++++++++------------
clang/lib/CodeGen/CodeGenFunction.h | 5 ++---
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index 232965f8f0a84..5a243216ccd11 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -2779,9 +2779,11 @@ void CodeGenFunction::EmitTypeMetadataCodeForVCall(const CXXRecordDecl *RD,
}
}
-void CodeGenFunction::ParseCFITypeCheckKind(CFITypeCheckKind TCK,
- SanitizerKind::SanitizerOrdinal &M,
- llvm::SanitizerStatKind &SSK) {
+std::pair<SanitizerKind::SanitizerOrdinal, llvm::SanitizerStatKind>
+CodeGenFunction::ParseCFITypeCheckKind(CFITypeCheckKind TCK) {
+ SanitizerKind::SanitizerOrdinal M;
+ llvm::SanitizerStatKind SSK;
+
switch (TCK) {
case CFITCK_VCall:
M = SanitizerKind::SO_CFIVCall;
@@ -2807,6 +2809,8 @@ void CodeGenFunction::ParseCFITypeCheckKind(CFITypeCheckKind TCK,
case CFITCK_VMFCall:
llvm_unreachable("unexpected sanitizer kind");
}
+
+ return std::make_pair(M, SSK);
}
void CodeGenFunction::EmitVTablePtrCheckForCall(const CXXRecordDecl *RD,
@@ -2816,10 +2820,9 @@ void CodeGenFunction::EmitVTablePtrCheckForCall(const CXXRecordDecl *RD,
if (!SanOpts.has(SanitizerKind::CFICastStrict))
RD = LeastDerivedClassWithSameLayout(RD);
- SanitizerKind::SanitizerOrdinal Ordinal;
- llvm::SanitizerStatKind SSK;
- ParseCFITypeCheckKind(TCK, Ordinal, SSK);
+ auto [Ordinal, SSK] = ParseCFITypeCheckKind(TCK);
ApplyDebugLocation ApplyTrapDI(*this, SanitizerAnnotateDebugInfo(Ordinal));
+
EmitVTablePtrCheck(RD, VTable, TCK, Loc);
}
@@ -2842,9 +2845,7 @@ void CodeGenFunction::EmitVTablePtrCheckForCast(QualType T, Address Derived,
if (!SanOpts.has(SanitizerKind::CFICastStrict))
ClassDecl = LeastDerivedClassWithSameLayout(ClassDecl);
- SanitizerKind::SanitizerOrdinal Ordinal;
- llvm::SanitizerStatKind SSK;
- ParseCFITypeCheckKind(TCK, Ordinal, SSK);
+ auto [Ordinal, SSK] = ParseCFITypeCheckKind(TCK);
ApplyDebugLocation ApplyTrapDI(*this, SanitizerAnnotateDebugInfo(Ordinal));
llvm::BasicBlock *ContBlock = nullptr;
@@ -2881,9 +2882,7 @@ void CodeGenFunction::EmitVTablePtrCheck(const CXXRecordDecl *RD,
!CGM.HasHiddenLTOVisibility(RD))
return;
- SanitizerKind::SanitizerOrdinal M;
- llvm::SanitizerStatKind SSK;
- ParseCFITypeCheckKind(TCK, M, SSK);
+ auto [M, SSK] = ParseCFITypeCheckKind(TCK);
switch (TCK) {
case CFITCK_VCall:
case CFITCK_NVCall:
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index ab36e0965d6fe..0a7a3936cf4fb 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -3360,9 +3360,8 @@ class CodeGenFunction : public CodeGenTypeCache {
/// Converts the CFITypeCheckKind into SanitizerKind::SanitizerOrdinal and
/// llvm::SanitizerStatKind.
- void ParseCFITypeCheckKind(CFITypeCheckKind TCK,
- SanitizerKind::SanitizerOrdinal &M,
- llvm::SanitizerStatKind &SSK);
+ static std::pair<SanitizerKind::SanitizerOrdinal, llvm::SanitizerStatKind>
+ ParseCFITypeCheckKind(CFITypeCheckKind TCK);
/// Emit a check that \p Base points into an array object, which
/// we can access at index \p Index. \p Accessed should be \c false if we
More information about the cfe-commits
mailing list