Skip to content

Commit 6032297

Browse files
authored
Merge pull request #10528 from hnrklssn/eng/PR-149359009
In fceb9ce (llvm#134769) upstream changed the diagnostic engine to always wrap expressions in single quotes. We already had manual wrapping for most of those, so the manual single quotes needed to be removed. In other placed the test cases needed to be updated to reflect the new output. rdar://149359009
2 parents 2083e9f + 44527f3 commit 6032297

20 files changed

+210
-236
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12587,7 +12587,7 @@ let CategoryName = "BoundsSafety Pointer Attributes Issue" in {
1258712587
def err_bounds_safety_conflicting_pointer_attributes : Error<
1258812588
"%select{array|pointer}0 cannot have more than one %select{bound|type|count|end|terminator}1 attribute">;
1258912589
def note_bounds_safety_conflicting_pointer_attribute_args : Note<
12590-
"conflicting arguments for %select{count|end|terminator}0 were '%1' and '%2'">;
12590+
"conflicting arguments for %select{count|end|terminator}0 were %1 and %2">;
1259112591
def warn_bounds_safety_duplicate_pointer_attributes : Warning<
1259212592
"%select{array|pointer}0 annotated with %select{__unsafe_indexable|__bidi_indexable|__indexable|__single|__terminated_by}1 "
1259312593
"multiple times. Annotate only once to remove this warning">, InGroup<BoundsSafetyRedundantAttribute>;
@@ -12609,7 +12609,7 @@ def err_bounds_safety_dynamic_count_function_call : Error<
1260912609
"argument of '%select{__counted_by|__sized_by|__counted_by_or_null|__sized_by_or_null}0' attribute can only reference "
1261012610
"function with 'const' attribute">;
1261112611
def err_bounds_safety_dynamic_count_function_call_argument : Error<
12612-
"argument of function call '%0' in '%select{__counted_by|__sized_by|__counted_by_or_null|__sized_by_or_null}1' attribute is not a constant expression">;
12612+
"argument of function call %0 in '%select{__counted_by|__sized_by|__counted_by_or_null|__sized_by_or_null}1' attribute is not a constant expression">;
1261312613
def err_attribute_invalid_argument_expression_for_pointer_bounds_attribute : Error<
1261412614
"invalid argument expression to bounds attribute">;
1261512615
def err_invalid_decl_kind_bounds_safety_dynamic_count : Error<
@@ -12767,7 +12767,7 @@ def warn_bounds_safety_conv_single_to_implicit_indexable_unsafe_zeroth_element :
1276712767
"returning|" // UnsafeOpKind::Return
1276812768
"passing|" // UnsafeOpKind::CallArg
1276912769
"UNUSED" // UnsafeOpKind::Cast
12770-
"}0 __bidi_indexable '%1'"
12770+
"}0 __bidi_indexable %1"
1277112771
"%select{"
1277212772
" at any index|||||||}0 "
1277312773
"will %select{"
@@ -12780,7 +12780,7 @@ def warn_bounds_safety_conv_single_to_implicit_indexable_unsafe_zeroth_element :
1278012780
"pass an out-of-bounds pointer|" // UnsafeOpKind::CallArg
1278112781
"UNUSED" // UnsafeOpKind::Cast
1278212782
"}0. At runtime %4 is assigned a __single pointer that"
12783-
" results in '%1' having bounds smaller than a single %2 (%3 byte%s3)">,
12783+
" results in %1 having bounds smaller than a single %2 (%3 byte%s3)">,
1278412784
InGroup<BoundsSafetyConvSingleToImplicitIndexableThenConvertToLargerType>;
1278512785

1278612786
def warn_bounds_safety_conv_single_to_implicit_indexable_unsafely_cast :
@@ -12806,7 +12806,7 @@ def note_single_entity_assigned_here_with_pointee_sizes : Note<
1280612806
"struct member|" // AssignmentSourceKind::StructMember
1280712807
"union member" // AssignmentSourceKind::UnionMember
1280812808
"}0 %1 %select{assigned to|used to initialize}9 %2 here results in %2 having the bounds of a single %3 "
12809-
"(%4 bytes) but %select{'%8'|cast of %2 to %8}7 has pointee type %5 (%6 bytes)">;
12809+
"(%4 bytes) but %select{%8|cast of %2 to %8}7 has pointee type %5 (%6 bytes)">;
1281012810

1281112811
def warn_bounds_safety_conv_single_to_implicit_indexable_dynamic_count_conversion :
1281212812
Warning<
@@ -12905,7 +12905,7 @@ def err_bounds_safety_typeof_dbpt : Error<
1290512905
"__typeof__ on an expression of type %0 is not yet supported">;
1290612906

1290712907
def err_bounds_safety_single_pointer_arithmetic : Error<
12908-
"pointer arithmetic on single pointer '%0' is out of bounds%select{|; consider adding '__counted_by' to '%2'}1">;
12908+
"pointer arithmetic on single pointer %0 is out of bounds%select{|; consider adding '__counted_by' to '%2'}1">;
1290912909
def err_bounds_safety_flexible_array_member_record_pointer_arithmetic : Error<
1291012910
"-fbounds-safety forbids arithmetic on pointers to types with a flexible array "
1291112911
"member">;
@@ -12971,16 +12971,16 @@ def err_bounds_safety_counted_by_on_incomplete_type_on_var_decl : Error<
1297112971
>;
1297212972

1297312973
def err_bounds_safety_pointer_subscript : Error<
12974-
"array subscript on %select{single|'__terminated_by'}0 pointer '%1' "
12974+
"array subscript on %select{single|'__terminated_by'}0 pointer %1 "
1297512975
"%select{must use a constant index of 0 to be in bounds|is not allowed}0">;
1297612976
def err_bounds_safety_indexable_pointer_arithmetic : Error<
12977-
"decremented indexable pointer '%0' is out of bounds">;
12977+
"decremented indexable pointer %0 is out of bounds">;
1297812978
def err_bounds_safety_indexable_pointer_subscript : Error<
12979-
"array subscript with a negative index on indexable pointer '%0' is out of bounds">;
12979+
"array subscript with a negative index on indexable pointer %0 is out of bounds">;
1298012980
def err_bounds_safety_terminated_by_pointer_arithmetic_dec : Error<
12981-
"cannot decrement '__terminated_by' pointer '%0'">;
12981+
"cannot decrement '__terminated_by' pointer %0">;
1298212982
def err_bounds_safety_terminated_by_pointer_arithmetic : Error<
12983-
"pointer arithmetic on '__terminated_by' pointer '%0' can only increase the "
12983+
"pointer arithmetic on '__terminated_by' pointer %0 can only increase the "
1298412984
"value by one">;
1298512985

1298612986
def err_bounds_safety_dynamic_bound_pointer_unary_arithmetic : Error<
@@ -13079,7 +13079,7 @@ def err_bounds_safety_dependent_assignments_order : Error<
1307913079
def note_bounds_safety_decl_assignment : Note<
1308013080
"'%0' has been assigned here">;
1308113081
def err_bounds_safety_dependent_struct_assignment : Error<
13082-
"cannot assign '%0' because it contains field %1 referred to by flexible array member %2">;
13082+
"cannot assign %0 because it contains field %1 referred to by flexible array member %2">;
1308313083
def note_bounds_safety_count_param_loc : Note<
1308413084
"referred to by count parameter here">;
1308513085
def err_bounds_safety_dependent_field_duplicates : Error<
@@ -13089,7 +13089,7 @@ def note_bounds_safety_struct_fields_only_in_fam : Note<
1308913089
def error_bounds_safety_no_arrow_members : Error<
1309013090
"arrow notation not allowed for struct member in count parameter">;
1309113091
def error_bounds_safety_no_count_in_unions : Error<
13092-
"count parameter refers to union '%0' of type %1">;
13092+
"count parameter refers to union %0 of type %1">;
1309313093

1309413094
def err_bounds_safety_taking_address_dynamic_bound_dependent : Error<
1309513095
"%select{variable|field}1 referred to by '%select{__counted_by|__sized_by|__counted_by_or_null|__sized_by_or_null|__ended_by}0' "
@@ -13111,7 +13111,7 @@ def err_bounds_safety_incompatible_dynamic_bound_argument: Error<
1311113111
def err_bounds_safety_mismatching_count_type_argument: Error<
1311213112
"incompatible pointer types assigning %0 with an expression with mismatching size attributes %1">;
1311313113
def err_bounds_safety_incompatible_count_expression: Error<
13114-
"incompatible count expression (%0) vs. (%1) in argument to function">;
13114+
"incompatible count expression %0 vs. %1 in argument to function">;
1311513115
def err_bounds_safety_unsynchronized_indirect_param: Error<
1311613116
"passing%select{| address of}1 %0 as an indirect parameter; "
1311713117
"must also pass %2 %select{|or its address }3because the type of %select{%0|%2}4, "
@@ -13196,7 +13196,7 @@ def note_bounds_safety_consider_adding_to_return : Note<
1319613196

1319713197
def warn_bounds_safety_initlist_range_partial_null : Warning<
1319813198
"%select{|implicitly }0initializing field %1 of type %2 to NULL while "
13199-
"'%3' is initialized with a value rarely succeeds">, InGroup<BoundsSafetyInitListPartialNull>;
13199+
"%3 is initialized with a value rarely succeeds">, InGroup<BoundsSafetyInitListPartialNull>;
1320013200

1320113201
def err_bounds_safety_dynamic_bound_init_side_effect : Error<
1320213202
"initalizer for %select{count|size|'__counted_by' pointer|'__sized_by' pointer|'__counted_by_or_null' pointer|'__sized_by_or_null' pointer|'__ended_by' pointer|end pointer}0 with side effects is not yet supported">;
@@ -13212,7 +13212,7 @@ def err_bounds_safety_flexible_global_wrong_count : Error<
1321213212
def err_bounds_safety_flexible_global_not_counted : Error<
1321313213
"flexible array member is initialized without a count">;
1321413214
def err_bounds_safety_flexible_global_non_int_count_init : Error<
13215-
"count '%0' has non-integer value '%1' of type %2">;
13215+
"count %0 has non-integer value %1 of type %2">;
1321613216

1321713217
def err_bounds_safety_local_external_dynamic_count : Error<
1321813218
"attribute %0 is not allowed for local variables with external storage">;
@@ -13405,7 +13405,7 @@ def err_bounds_safety_terminated_by_wrong_initializer_kind : Error<
1340513405
"string literal or an initializer list">;
1340613406
def err_bounds_safety_terminated_by_terminator_mismatch : Error<
1340713407
"array '%0' with '__terminated_by' attribute is initialized with an "
13408-
"incorrect terminator (expected: %1; got %2)">;
13408+
"incorrect terminator (expected: %quoted1; got %quoted2)">;
1340913409

1341013410
def err_bounds_safety_irrecoverable_attr : Error<
1341113411
"bounds attribute '%select{__bidi_indexable|__indexable|__single|__unsafe_indexable}0' cannot be applied to attributed type %1 in this context%select{| due to the surrounding 'typeof' specifier}2">;

clang/test/BoundsSafety/AST/struct-init-with-side-effects.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void test_count_annot() {
9898
struct s_count_annot s1 = {
9999
.len = 10,
100100
.ptr = arr,
101-
// expected-warning@+1{{initializer getlen() has a side effect; this may lead to an unexpected result because the evaluation order of initialization list expressions is indeterminate}}
101+
// expected-warning@+1{{initializer 'getlen()' has a side effect; this may lead to an unexpected result because the evaluation order of initialization list expressions is indeterminate}}
102102
.dummy = getlen()
103103
};
104104
struct s_count_annot s2;
@@ -157,7 +157,7 @@ void test_range_annot() {
157157
struct s_range_annot s1 = {
158158
.end = arr + 10,
159159
.start = arr,
160-
// expected-warning@+1{{initializer getlen() has a side effect; this may lead to an unexpected result because the evaluation order of initialization list expressions is indeterminate}}
160+
// expected-warning@+1{{initializer 'getlen()' has a side effect; this may lead to an unexpected result because the evaluation order of initialization list expressions is indeterminate}}
161161
.dummy = getlen()
162162
};
163163
struct s_count_annot s2;

clang/test/BoundsSafety/CodeGen/bounds-attributed-in-return-null-system-header-O2.c

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,10 @@ void consume(int* __bidi_indexable);
2525
// LEGACY-SAME: i32 noundef [[COUNT:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
2626
// LEGACY-NEXT: [[ENTRY:.*:]]
2727
// LEGACY-NEXT: [[BYVAL_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8
28-
// LEGACY-NEXT: [[IDX_EXT:%.*]] = sext i32 [[COUNT]] to i64
29-
// LEGACY-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr null, i64 [[IDX_EXT]]
30-
// LEGACY-NEXT: call void @llvm.lifetime.start.p0(i64 24, ptr nonnull [[BYVAL_TEMP]]) #[[ATTR3:[0-9]+]]
31-
// LEGACY-NEXT: store ptr null, ptr [[BYVAL_TEMP]], align 8
32-
// LEGACY-NEXT: [[PTR_SROA_4_0_BYVAL_TEMP_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BYVAL_TEMP]], i64 8
33-
// LEGACY-NEXT: store ptr [[ADD_PTR]], ptr [[PTR_SROA_4_0_BYVAL_TEMP_SROA_IDX]], align 8
34-
// LEGACY-NEXT: [[PTR_SROA_5_0_BYVAL_TEMP_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BYVAL_TEMP]], i64 16
35-
// LEGACY-NEXT: store ptr null, ptr [[PTR_SROA_5_0_BYVAL_TEMP_SROA_IDX]], align 8, !tbaa [[TBAA2:![0-9]+]]
36-
// LEGACY-NEXT: call void @consume(ptr noundef nonnull [[BYVAL_TEMP]]) #[[ATTR3]]
37-
// LEGACY-NEXT: call void @llvm.lifetime.end.p0(i64 24, ptr nonnull [[BYVAL_TEMP]]) #[[ATTR3]]
28+
// LEGACY-NEXT: call void @llvm.lifetime.start.p0(i64 24, ptr nonnull [[BYVAL_TEMP]]) #[[ATTR4:[0-9]+]]
29+
// LEGACY-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) [[BYVAL_TEMP]], i8 0, i64 24, i1 false)
30+
// LEGACY-NEXT: call void @consume(ptr noundef nonnull [[BYVAL_TEMP]]) #[[ATTR4]]
31+
// LEGACY-NEXT: call void @llvm.lifetime.end.p0(i64 24, ptr nonnull [[BYVAL_TEMP]]) #[[ATTR4]]
3832
// LEGACY-NEXT: ret void
3933
//
4034
void use_inline_header_func_unspecified_ptr(int count) {
@@ -62,16 +56,10 @@ void use_inline_header_func_unspecified_ptr(int count) {
6256
// LEGACY-SAME: i32 noundef [[COUNT:%.*]]) local_unnamed_addr #[[ATTR0]] {
6357
// LEGACY-NEXT: [[ENTRY:.*:]]
6458
// LEGACY-NEXT: [[BYVAL_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8
65-
// LEGACY-NEXT: [[IDX_EXT:%.*]] = sext i32 [[COUNT]] to i64
66-
// LEGACY-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr null, i64 [[IDX_EXT]]
67-
// LEGACY-NEXT: call void @llvm.lifetime.start.p0(i64 24, ptr nonnull [[BYVAL_TEMP]]) #[[ATTR3]]
68-
// LEGACY-NEXT: store ptr null, ptr [[BYVAL_TEMP]], align 8
69-
// LEGACY-NEXT: [[PTR_SROA_4_0_BYVAL_TEMP_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BYVAL_TEMP]], i64 8
70-
// LEGACY-NEXT: store ptr [[ADD_PTR]], ptr [[PTR_SROA_4_0_BYVAL_TEMP_SROA_IDX]], align 8
71-
// LEGACY-NEXT: [[PTR_SROA_5_0_BYVAL_TEMP_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BYVAL_TEMP]], i64 16
72-
// LEGACY-NEXT: store ptr null, ptr [[PTR_SROA_5_0_BYVAL_TEMP_SROA_IDX]], align 8, !tbaa [[TBAA2]]
73-
// LEGACY-NEXT: call void @consume(ptr noundef nonnull [[BYVAL_TEMP]]) #[[ATTR3]]
74-
// LEGACY-NEXT: call void @llvm.lifetime.end.p0(i64 24, ptr nonnull [[BYVAL_TEMP]]) #[[ATTR3]]
59+
// LEGACY-NEXT: call void @llvm.lifetime.start.p0(i64 24, ptr nonnull [[BYVAL_TEMP]]) #[[ATTR4]]
60+
// LEGACY-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) [[BYVAL_TEMP]], i8 0, i64 24, i1 false)
61+
// LEGACY-NEXT: call void @consume(ptr noundef nonnull [[BYVAL_TEMP]]) #[[ATTR4]]
62+
// LEGACY-NEXT: call void @llvm.lifetime.end.p0(i64 24, ptr nonnull [[BYVAL_TEMP]]) #[[ATTR4]]
7563
// LEGACY-NEXT: ret void
7664
//
7765
void use_inline_header_func_unsafe_indexable_ptr(int count) {
@@ -82,9 +70,3 @@ void use_inline_header_func_unsafe_indexable_ptr(int count) {
8270
// CHECK: [[META2]] = !{!"bounds-safety-generic"}
8371
// CHECK: [[PROF3]] = !{!"branch_weights", i32 1048575, i32 1}
8472
//.
85-
// LEGACY: [[TBAA2]] = !{[[META3:![0-9]+]], [[META3]], i64 0}
86-
// LEGACY: [[META3]] = !{!"p1 int", [[META4:![0-9]+]], i64 0}
87-
// LEGACY: [[META4]] = !{!"any pointer", [[META5:![0-9]+]], i64 0}
88-
// LEGACY: [[META5]] = !{!"omnipotent char", [[META6:![0-9]+]], i64 0}
89-
// LEGACY: [[META6]] = !{!"Simple C/C++ TBAA"}
90-
//.

clang/test/BoundsSafety/CodeGen/nested-struct-member-count-O2.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,21 @@ char access(struct Outer *bar, int index) {
4242

4343

4444

45-
// CHECK-LABEL: define dso_local ptr @assign(
45+
// CHECK-LABEL: define dso_local noundef nonnull ptr @assign(
4646
// CHECK-SAME: ptr noundef readonly captures(none) [[BAR:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR0]] {
4747
// CHECK-NEXT: entry:
48-
// CHECK-NEXT: [[AGG_TEMP1_SROA_0_0_COPYLOAD:%.*]] = load ptr, ptr [[BAR]], align 8
48+
// CHECK-NEXT: [[AGG_TEMP1_SROA_0_0_COPYLOAD:%.*]] = load ptr, ptr [[BAR]], align 8, !nonnull {{![0-9]+}}, !noundef {{![0-9]+}}
4949
// CHECK-NEXT: [[AGG_TEMP1_SROA_2_0_BAR_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BAR]], i64 8
5050
// CHECK-NEXT: [[AGG_TEMP1_SROA_2_0_COPYLOAD:%.*]] = load ptr, ptr [[AGG_TEMP1_SROA_2_0_BAR_SROA_IDX]], align 8
51-
// CHECK-NEXT: [[AGG_TEMP1_SROA_3_0_BAR_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BAR]], i64 16
52-
// CHECK-NEXT: [[AGG_TEMP1_SROA_3_0_COPYLOAD:%.*]] = load ptr, ptr [[AGG_TEMP1_SROA_3_0_BAR_SROA_IDX]], align 8, !tbaa {{![0-9]+}}
53-
// CHECK-NEXT: [[FLEX_BASE_NULL_CHECK_NOT:%.*]] = icmp eq ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], null, !annotation {{![0-9]+}}
54-
// CHECK-NEXT: br i1 [[FLEX_BASE_NULL_CHECK_NOT]], label [[BOUNDSCHECK_CONT_THREAD:%.*]], label [[FLEX_BASE_NONNULL:%.*]], !annotation {{![0-9]+}}
55-
// CHECK: flex.base.nonnull:
5651
// CHECK-NEXT: [[TMP0:%.*]] = getelementptr i8, ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], i64 8
5752
// CHECK-NEXT: [[DOTNOT:%.*]] = icmp ugt ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], [[TMP0]], !annotation {{![0-9]+}}
5853
// CHECK-NEXT: br i1 [[DOTNOT]], label [[TRAP:%.*]], label [[CONT:%.*]], !prof {{![0-9]+}}, !annotation {{![0-9]+}}
5954
// CHECK: trap:
6055
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation {{![0-9]+}}
6156
// CHECK-NEXT: unreachable, !annotation {{![0-9]+}}
6257
// CHECK: cont:
58+
// CHECK-NEXT: [[AGG_TEMP1_SROA_3_0_BAR_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BAR]], i64 16
59+
// CHECK-NEXT: [[AGG_TEMP1_SROA_3_0_COPYLOAD:%.*]] = load ptr, ptr [[AGG_TEMP1_SROA_3_0_BAR_SROA_IDX]], align 8, !tbaa {{![0-9]+}}
6360
// CHECK-NEXT: [[TMP1:%.*]] = icmp ule ptr [[TMP0]], [[AGG_TEMP1_SROA_2_0_COPYLOAD]], !annotation {{![0-9]+}}
6461
// CHECK-NEXT: [[TMP2:%.*]] = icmp ule ptr [[AGG_TEMP1_SROA_3_0_COPYLOAD]], [[AGG_TEMP1_SROA_0_0_COPYLOAD]], !annotation {{![0-9]+}}
6562
// CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[TMP1]], i1 [[TMP2]], i1 false, !annotation {{![0-9]+}}
@@ -75,14 +72,9 @@ char access(struct Outer *bar, int index) {
7572
// CHECK-NEXT: [[TMP3:%.*]] = icmp ult ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], [[AGG_TEMP1_SROA_2_0_COPYLOAD]], !annotation {{![0-9]+}}
7673
// CHECK-NEXT: [[OR_COND60:%.*]] = select i1 [[OR_COND49]], i1 [[TMP3]], i1 false, !annotation {{![0-9]+}}
7774
// CHECK-NEXT: br i1 [[OR_COND60]], label [[BOUNDSCHECK_CONT:%.*]], label [[TRAP]], !prof {{![0-9]+}}, !annotation {{![0-9]+}}
78-
// CHECK: boundscheck.cont.thread:
79-
// CHECK-NEXT: store i32 [[LEN]], ptr inttoptr (i64 4 to ptr), align 4, !tbaa {{![0-9]+}}
80-
// CHECK-NEXT: br label [[CONT46:%.*]]
8175
// CHECK: boundscheck.cont:
8276
// CHECK-NEXT: [[LEN31:%.*]] = getelementptr inbounds nuw i8, ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], i64 4
8377
// CHECK-NEXT: store i32 [[LEN]], ptr [[LEN31]], align 4, !tbaa {{![0-9]+}}
84-
// CHECK-NEXT: br label [[CONT46]], !annotation {{![0-9]+}}
85-
// CHECK: cont46:
8678
// CHECK-NEXT: ret ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]]
8779
//
8880
struct Outer * assign(void * __bidi_indexable bar, int len) {

clang/test/BoundsSafety/CodeGen/terminated-by-to-indexable-trivial-O2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ const char *__indexable good_chars_unsafe(void) {
4141
}
4242

4343
// CHECK-LABEL: @bad_null(
44-
// CHECK-NEXT: entry:
45-
// CHECK-NEXT: unreachable
44+
// CHECK-NEXT: terminated_by.loop_end:
45+
// CHECK-NEXT: ret { ptr, ptr } zeroinitializer
4646
//
4747
int *__indexable bad_null(void) {
4848
int *__null_terminated p = 0;
4949
return __terminated_by_to_indexable(p);
5050
}
5151

5252
// CHECK-LABEL: @bad_null_unsafe(
53-
// CHECK-NEXT: entry:
54-
// CHECK-NEXT: unreachable
53+
// CHECK-NEXT: terminated_by.loop_end:
54+
// CHECK-NEXT: ret { ptr, ptr } zeroinitializer
5555
//
5656
int *__indexable bad_null_unsafe(void) {
5757
int *__null_terminated p = 0;

clang/test/BoundsSafety/Sema/address-taken-dynamic-count-decls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ int main() {
9797

9898
foo(&s.len, &s.buf);
9999
foo(&local_len, &s.buf); // expected-error{{incompatible dynamic count pointer argument to parameter of type}}
100-
foo(&t.len, &t.buf); // expected-error{{incompatible count expression (*out_len) vs. (len + 1) in argument to function}}
100+
foo(&t.len, &t.buf); // expected-error{{incompatible count expression '*out_len' vs. 'len + 1' in argument to function}}
101101
// expected-error@+1{{passing address of 'len' as an indirect parameter; must also pass 'buf2' or its address because the type of 'buf2', 'int *__single __counted_by(len)' (aka 'int *__single'), refers to 'len'}}
102102
foo(&u.len, &u.buf);
103103
bar(&s.len, &s.buf); // expected-error{{passing address of 'len' referred to by '__counted_by' to a parameter that is not referred to by the same attribute}}

0 commit comments

Comments
 (0)