Skip to content

Commit a39b02e

Browse files
committed
refactored overloaded select to enum_select
1 parent 2f403ee commit a39b02e

File tree

1 file changed

+47
-33
lines changed

1 file changed

+47
-33
lines changed

clang/include/clang/Basic/DiagnosticASTKinds.td

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,21 @@ def note_constexpr_past_end : Note<
131131
"dereferenced pointer past the end of %select{|subobject of }0"
132132
"%select{temporary|%2}1 is not a constant expression">;
133133
def note_constexpr_past_end_subobject : Note<
134-
"cannot %select{access base class of|access derived class of|access field of|"
135-
"access array element of|ERROR|"
136-
"access real component of|access imaginary component of}0 "
137-
"pointer past the end of object">;
134+
"cannot %enum_select<AccessType>{"
135+
"%BaseClassAccess{access base class of}|%DerivedClassAccess{access derived class of}|"
136+
"%FieldAccess{access field of}|%ArrayElementAccess{access array element of}|"
137+
"%ErrorAccess{ERROR}|"
138+
"%RealComponentAccess{access real component of}|%ImaginaryComponentAccess{access imaginary component of}"
139+
"}0 pointer past the end of object">;
138140
def note_non_null_attribute_failed : Note<
139141
"null passed to a callee that requires a non-null argument">;
140142
def note_constexpr_null_subobject : Note<
141-
"cannot %select{access base class of|access derived class of|access field of|"
142-
"access array element of|perform pointer arithmetic on|"
143-
"access real component of|"
144-
"access imaginary component of}0 null pointer">;
143+
"cannot %enum_select<NullSubobjectAccess>{"
144+
"%BaseClassAccess{access base class of}|%DerivedClassAccess{access derived class of}|"
145+
"%FieldAccess{access field of}|%ArrayElementAccess{access array element of}|"
146+
"%PointerArithmetic{perform pointer arithmetic on}|"
147+
"%RealComponentAccess{access real component of}|%ImaginaryComponentAccess{access imaginary component of}"
148+
"}0 null pointer">;
145149
def note_constexpr_null_callee : Note<
146150
"'%0' evaluates to a null function pointer">;
147151
def note_constexpr_function_param_value_unknown : Note<
@@ -174,16 +178,22 @@ def note_constexpr_this : Note<
174178
"%select{|implicit }0use of 'this' pointer is only allowed within the "
175179
"evaluation of a call to a 'constexpr' member function">;
176180
def access_kind : TextSubstitution<
177-
"%select{read of|read of|assignment to|increment of|decrement of|"
178-
"member call on|dynamic_cast of|typeid applied to|construction of|"
179-
"destruction of|read of}0">;
181+
"%enum_select<AccessKind>{"
182+
"%ReadOf{read of}|%AssignmentTo{assignment to}|%IncrementOf{increment of}|"
183+
"%DecrementOf{decrement of}|%MemberCallOn{member call on}|"
184+
"%DynamicCast{dynamic_cast of}|%TypeIdApplied{typeid applied to}|"
185+
"%ConstructionOf{construction of}|%DestructionOf{destruction of}|"
186+
"%ReadOfAgain{read of}"
187+
"}0">;
180188
def access_kind_subobject : TextSubstitution<
181-
"%select{read of|read of|assignment to|increment of|decrement of|"
182-
"member call on|dynamic_cast of|typeid applied to|"
183-
"construction of subobject of|destruction of|read of}0">;
189+
"%enum_select<AccessKind>{%ReadOf{read of}|%AssignmentTo{assignment to}|"
190+
"%IncrementOf{increment of}|%DecrementOf{decrement of}|"
191+
"%MemberCallOn{member call on}|%DynamicCastOf{dynamic_cast of}|"
192+
"%TypeidAppliedTo{typeid applied to}|%ConstructionOfSubobject{construction of subobject of}|"
193+
"%DestructionOf{destruction of}|%ReadOf{read of}}0">;
184194
def access_kind_volatile : TextSubstitution<
185-
"%select{read of|read of|assignment to|increment of|decrement of|"
186-
"<ERROR>|<ERROR>|<ERROR>|<ERROR>|<ERROR>|<ERROR>}0">;
195+
"%enum_select<AccessKindVolatile>{%ReadOf{read of}|%AssignmentTo{assignment to}|"
196+
"%IncrementOf{increment of}|%DecrementOf{decrement of}|%Error{<ERROR>}}0">;
187197
def note_constexpr_lifetime_ended : Note<
188198
"%sub{access_kind}0 %select{temporary|variable}1 whose "
189199
"%plural{8:storage duration|:lifetime}0 has ended">;
@@ -313,8 +323,8 @@ def note_constexpr_bit_cast_unsupported_bitfield : Note<
313323
"constexpr bit_cast involving bit-field is not yet supported">;
314324
def note_constexpr_bit_cast_invalid_type : Note<
315325
"bit_cast %select{from|to}0 a %select{|type with a }1"
316-
"%select{union|pointer|member pointer|volatile|reference}2 "
317-
"%select{type|member}1 is not allowed in a constant expression">;
326+
"%enum_select<CastType>{%Union{union}|%Pointer{pointer}|%MemberPointer{member pointer}|"
327+
"%Volatile{volatile}|%Reference{reference}}2 is not allowed in a constant expression">;
318328
def note_constexpr_bit_cast_invalid_subtype : Note<
319329
"invalid type %0 is a %select{member|base}1 of %2">;
320330
def note_constexpr_bit_cast_invalid_vector : Note<
@@ -485,7 +495,9 @@ def warn_odr_tag_type_inconsistent
485495
"units">,
486496
InGroup<ODR>;
487497
def note_odr_tag_kind_here: Note<
488-
"%0 is a %select{struct|interface|union|class|enum}1 here">;
498+
"%0 is a %enum_select<ODRTagKind>{"
499+
"%Struct{struct}|%Interface{interface}|%Union{union}|"
500+
"%Class{class}|%Enum{enum}" "}1 here">;
489501
def note_odr_field : Note<"field %0 has type %1 here">;
490502
def note_odr_field_name : Note<"field has name %0 here">;
491503
def note_odr_missing_field : Note<"no corresponding field here">;
@@ -623,23 +635,25 @@ def note_second_module_difference : Note<
623635
def err_module_odr_violation_definition_data : Error <
624636
"%q0 has different definitions in different modules; first difference is "
625637
"%select{definition in module '%2'|defined here}1 found "
626-
"%select{"
627-
"%4 base %plural{1:class|:classes}4|"
628-
"%4 virtual base %plural{1:class|:classes}4|"
629-
"%ordinal4 base class with type %5|"
630-
"%ordinal4 %select{non-virtual|virtual}5 base class %6|"
631-
"%ordinal4 base class %5 with "
632-
"%select{public|protected|private|no}6 access specifier}3">;
638+
"%enum_select<BaseClassType>{"
639+
"%BaseClass{base %plural{1:class|:classes}}|"
640+
"%VirtualBase{virtual base %plural{1:class|:classes}}|"
641+
"%OrdinalBaseClassWithType{ordinal base class with type %5}|"
642+
"%OrdinalVirtualBaseClass{ordinal %select{non-virtual|virtual}5 base class %6}|"
643+
"%OrdinalBaseClassWithAccess{ordinal base class %5 with "
644+
"%select{public|protected|private|no}6 access specifier}"
645+
"}3">;
633646

634647
def note_module_odr_violation_definition_data : Note <
635648
"but in '%0' found "
636-
"%select{"
637-
"%2 base %plural{1:class|:classes}2|"
638-
"%2 virtual base %plural{1:class|:classes}2|"
639-
"%ordinal2 base class with different type %3|"
640-
"%ordinal2 %select{non-virtual|virtual}3 base class %4|"
641-
"%ordinal2 base class %3 with "
642-
"%select{public|protected|private|no}4 access specifier}1">;
649+
"%enum_select<BaseClassType>{"
650+
"%BaseClass{base %plural{1:class|:classes}}|"
651+
"%VirtualBase{virtual base %plural{1:class|:classes}}|"
652+
"%OrdinalBaseClassWithDifferentType{ordinal base class with different type %3}|"
653+
"%OrdinalBaseClassWithAccess{ordinal %select{non-virtual|virtual}3 base class %4}|"
654+
"%OrdinalBaseClassWithAccessSpecifier{ordinal base class %3 with "
655+
"%select{public|protected|private|no}4 access specifier}"
656+
"}1">;
643657

644658
def err_module_odr_violation_objc_interface : Error <
645659
"%0 has different definitions in different modules; first difference is "

0 commit comments

Comments
 (0)