Skip to content

Commit 0794d5c

Browse files
[clang][Sema] Fix typo in 'offsetof' diagnostics (#133448)
Before: ``` offset of on non-POD type ``` After: ``` offsetof on non-POD type ``` --------- Co-authored-by: Aaron Ballman <[email protected]>
1 parent ab7cee8 commit 0794d5c

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7031,10 +7031,10 @@ def err_offsetof_incomplete_type : Error<
70317031
def err_offsetof_record_type : Error<
70327032
"offsetof requires struct, union, or class type, %0 invalid">;
70337033
def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
7034-
def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
7034+
def ext_offsetof_non_pod_type : ExtWarn<"'offsetof' on non-POD type %0">,
70357035
InGroup<InvalidOffsetof>;
70367036
def ext_offsetof_non_standardlayout_type : ExtWarn<
7037-
"offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
7037+
"'offsetof' on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
70387038
def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
70397039
def err_offsetof_field_of_virtual_base : Error<
70407040
"invalid application of 'offsetof' to a field of a virtual base">;

clang/test/SemaCXX/ms_struct.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct B : public A {
2525

2626
static_assert(__builtin_offsetof(B, d) == 12,
2727
"We can't allocate the bitfield into the padding under ms_struct");
28-
// expected-warning@-2 {{offset of on non-standard-layout type 'B'}}
28+
// expected-warning@-2 {{'offsetof' on non-standard-layout type 'B'}}
2929

3030
struct C {
3131
#ifdef TEST_FOR_ERROR
@@ -39,5 +39,5 @@ struct C {
3939

4040
static_assert(__builtin_offsetof(C, n) == 8,
4141
"long long field in ms_struct should be 8-byte aligned");
42-
// expected-warning@-2 {{offset of on non-standard-layout type 'C'}}
42+
// expected-warning@-2 {{'offsetof' on non-standard-layout type 'C'}}
4343

clang/test/SemaCXX/offsetof-0x.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct P {
1111
};
1212

1313
void f() {
14-
int i = __builtin_offsetof(P, fieldThatPointsToANonPODType.m); // expected-warning{{offset of on non-standard-layout type 'P'}}
14+
int i = __builtin_offsetof(P, fieldThatPointsToANonPODType.m); // expected-warning{{'offsetof' on non-standard-layout type 'P'}}
1515
}
1616

1717
struct StandardLayout {

clang/test/SemaCXX/offsetof.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ struct P {
1111
};
1212

1313
void f() {
14-
int i = __builtin_offsetof(P, fieldThatPointsToANonPODType.m); // expected-warning{{offset of on non-POD type 'P'}}
14+
int i = __builtin_offsetof(P, fieldThatPointsToANonPODType.m); // expected-warning{{'offsetof' on non-POD type 'P'}}
1515
}
1616

1717
struct Base { int x; };
1818
struct Derived : Base { int y; };
19-
int o = __builtin_offsetof(Derived, x); // expected-warning{{offset of on non-POD type}}
19+
int o = __builtin_offsetof(Derived, x); // expected-warning{{'offsetof' on non-POD type}}
2020

2121
const int o2 = sizeof(__builtin_offsetof(Derived, x));
2222

@@ -51,9 +51,9 @@ struct Derived2 : public Base1, public Base2 {
5151
int z;
5252
};
5353

54-
int derived1[__builtin_offsetof(Derived2, x) == 0? 1 : -1]; // expected-warning{{offset of on non-POD type 'Derived2'}}
55-
int derived2[__builtin_offsetof(Derived2, y) == 4? 1 : -1]; // expected-warning{{offset of on non-POD type 'Derived2'}}
56-
int derived3[__builtin_offsetof(Derived2, z) == 8? 1 : -1]; // expected-warning{{offset of on non-POD type 'Derived2'}}
54+
int derived1[__builtin_offsetof(Derived2, x) == 0? 1 : -1]; // expected-warning{{'offsetof' on non-POD type 'Derived2'}}
55+
int derived2[__builtin_offsetof(Derived2, y) == 4? 1 : -1]; // expected-warning{{'offsetof' on non-POD type 'Derived2'}}
56+
int derived3[__builtin_offsetof(Derived2, z) == 8? 1 : -1]; // expected-warning{{'offsetof' on non-POD type 'Derived2'}}
5757

5858
// offsetof referring to anonymous struct in base.
5959
// PR7769
@@ -66,7 +66,7 @@ struct foo {
6666
struct bar : public foo {
6767
};
6868

69-
int anonstruct[__builtin_offsetof(bar, x) == 0 ? 1 : -1]; // expected-warning{{offset of on non-POD type 'bar'}}
69+
int anonstruct[__builtin_offsetof(bar, x) == 0 ? 1 : -1]; // expected-warning{{'offsetof' on non-POD type 'bar'}}
7070

7171

7272
struct LtoRCheck {
@@ -81,7 +81,7 @@ struct Base {
8181
int Field;
8282
};
8383
struct Derived : virtual Base {
84-
void Fun() { (void)__builtin_offsetof(Derived, Field); } // expected-warning {{offset of on non-POD type}} \
84+
void Fun() { (void)__builtin_offsetof(Derived, Field); } // expected-warning {{'offsetof' on non-POD type}} \
8585
expected-error {{invalid application of 'offsetof' to a field of a virtual base}}
8686
};
8787
}

0 commit comments

Comments
 (0)