@@ -9589,19 +9589,12 @@ void ASTReader::diagnoseOdrViolations() {
95899589 Other
95909590 };
95919591
9592- // Used with err_module_odr_violation_mismatch_decl_diff and
9593- // note_module_odr_violation_mismatch_decl_diff
9594- enum ODRMismatchDeclDifference {
9592+ // Used with err_module_odr_violation_record and
9593+ // note_module_odr_violation_record
9594+ enum ODRCXXRecordDifference {
95959595 StaticAssertCondition,
95969596 StaticAssertMessage,
95979597 StaticAssertOnlyMessage,
9598- FieldName,
9599- FieldTypeName,
9600- FieldSingleBitField,
9601- FieldDifferentWidthBitField,
9602- FieldSingleMutable,
9603- FieldSingleInitializer,
9604- FieldDifferentInitializers,
96059598 MethodName,
96069599 MethodDeleted,
96079600 MethodDefaulted,
@@ -9620,13 +9613,6 @@ void ASTReader::diagnoseOdrViolations() {
96209613 MethodDifferentTemplateArgument,
96219614 MethodSingleBody,
96229615 MethodDifferentBody,
9623- TypedefName,
9624- TypedefType,
9625- VarName,
9626- VarType,
9627- VarSingleInitializer,
9628- VarDifferentInitializer,
9629- VarConstexpr,
96309616 FriendTypeFunction,
96319617 FriendType,
96329618 FriendFunction,
@@ -9646,17 +9632,27 @@ void ASTReader::diagnoseOdrViolations() {
96469632 NamedDecl *FirstRecord, StringRef FirstModule,
96479633 StringRef SecondModule, FieldDecl *FirstField,
96489634 FieldDecl *SecondField) {
9635+ enum ODRFieldDifference {
9636+ FieldName,
9637+ FieldTypeName,
9638+ FieldSingleBitField,
9639+ FieldDifferentWidthBitField,
9640+ FieldSingleMutable,
9641+ FieldSingleInitializer,
9642+ FieldDifferentInitializers,
9643+ };
9644+
96499645 auto DiagError = [FirstRecord, FirstField, FirstModule,
9650- this ](ODRMismatchDeclDifference DiffType) {
9646+ this ](ODRFieldDifference DiffType) {
96519647 return Diag (FirstField->getLocation (),
9652- diag::err_module_odr_violation_mismatch_decl_diff )
9648+ diag::err_module_odr_violation_field )
96539649 << FirstRecord << FirstModule.empty () << FirstModule
96549650 << FirstField->getSourceRange () << DiffType;
96559651 };
96569652 auto DiagNote = [SecondField, SecondModule,
9657- this ](ODRMismatchDeclDifference DiffType) {
9653+ this ](ODRFieldDifference DiffType) {
96589654 return Diag (SecondField->getLocation (),
9659- diag::note_module_odr_violation_mismatch_decl_diff )
9655+ diag::note_module_odr_violation_field )
96609656 << SecondModule << SecondField->getSourceRange () << DiffType;
96619657 };
96629658
@@ -9744,17 +9740,22 @@ void ASTReader::diagnoseOdrViolations() {
97449740 NamedDecl *FirstRecord, StringRef FirstModule, StringRef SecondModule,
97459741 TypedefNameDecl *FirstTD, TypedefNameDecl *SecondTD,
97469742 bool IsTypeAlias) {
9743+ enum ODRTypedefDifference {
9744+ TypedefName,
9745+ TypedefType,
9746+ };
9747+
97479748 auto DiagError = [FirstRecord, FirstTD, FirstModule,
9748- this ](ODRMismatchDeclDifference DiffType) {
9749+ this ](ODRTypedefDifference DiffType) {
97499750 return Diag (FirstTD->getLocation (),
9750- diag::err_module_odr_violation_mismatch_decl_diff )
9751+ diag::err_module_odr_violation_typedef )
97519752 << FirstRecord << FirstModule.empty () << FirstModule
97529753 << FirstTD->getSourceRange () << DiffType;
97539754 };
97549755 auto DiagNote = [SecondTD, SecondModule,
9755- this ](ODRMismatchDeclDifference DiffType) {
9756+ this ](ODRTypedefDifference DiffType) {
97569757 return Diag (SecondTD->getLocation (),
9757- diag::note_module_odr_violation_mismatch_decl_diff )
9758+ diag::note_module_odr_violation_typedef )
97589759 << SecondModule << SecondTD->getSourceRange () << DiffType;
97599760 };
97609761
@@ -9782,17 +9783,24 @@ void ASTReader::diagnoseOdrViolations() {
97829783 this ](NamedDecl *FirstRecord, StringRef FirstModule,
97839784 StringRef SecondModule, VarDecl *FirstVD,
97849785 VarDecl *SecondVD) {
9786+ enum ODRVarDifference {
9787+ VarName,
9788+ VarType,
9789+ VarSingleInitializer,
9790+ VarDifferentInitializer,
9791+ VarConstexpr,
9792+ };
9793+
97859794 auto DiagError = [FirstRecord, FirstVD, FirstModule,
9786- this ](ODRMismatchDeclDifference DiffType) {
9795+ this ](ODRVarDifference DiffType) {
97879796 return Diag (FirstVD->getLocation (),
9788- diag::err_module_odr_violation_mismatch_decl_diff )
9797+ diag::err_module_odr_violation_variable )
97899798 << FirstRecord << FirstModule.empty () << FirstModule
97909799 << FirstVD->getSourceRange () << DiffType;
97919800 };
9792- auto DiagNote = [SecondVD, SecondModule,
9793- this ](ODRMismatchDeclDifference DiffType) {
9801+ auto DiagNote = [SecondVD, SecondModule, this ](ODRVarDifference DiffType) {
97949802 return Diag (SecondVD->getLocation (),
9795- diag::note_module_odr_violation_mismatch_decl_diff )
9803+ diag::note_module_odr_violation_variable )
97969804 << SecondModule << SecondVD->getSourceRange () << DiffType;
97979805 };
97989806
@@ -10005,15 +10013,15 @@ void ASTReader::diagnoseOdrViolations() {
1000510013 std::string SecondModule = getOwningModuleNameForDiagnostic (SecondRecord);
1000610014 auto ODRDiagDeclError = [FirstRecord, &FirstModule,
1000710015 this ](SourceLocation Loc, SourceRange Range,
10008- ODRMismatchDeclDifference DiffType) {
10009- return Diag (Loc, diag::err_module_odr_violation_mismatch_decl_diff )
10016+ ODRCXXRecordDifference DiffType) {
10017+ return Diag (Loc, diag::err_module_odr_violation_record )
1001010018 << FirstRecord << FirstModule.empty () << FirstModule << Range
1001110019 << DiffType;
1001210020 };
1001310021 auto ODRDiagDeclNote = [&SecondModule,
1001410022 this ](SourceLocation Loc, SourceRange Range,
10015- ODRMismatchDeclDifference DiffType) {
10016- return Diag (Loc, diag::note_module_odr_violation_mismatch_decl_diff )
10023+ ODRCXXRecordDifference DiffType) {
10024+ return Diag (Loc, diag::note_module_odr_violation_record )
1001710025 << SecondModule << Range << DiffType;
1001810026 };
1001910027
@@ -10340,13 +10348,13 @@ void ASTReader::diagnoseOdrViolations() {
1034010348 DeclarationName FirstName = FirstMethod->getDeclName ();
1034110349 DeclarationName SecondName = SecondMethod->getDeclName ();
1034210350 auto DiagMethodError = [&ODRDiagDeclError, FirstMethod, FirstMethodType,
10343- FirstName](ODRMismatchDeclDifference DiffType) {
10351+ FirstName](ODRCXXRecordDifference DiffType) {
1034410352 return ODRDiagDeclError (FirstMethod->getLocation (),
1034510353 FirstMethod->getSourceRange (), DiffType)
1034610354 << FirstMethodType << FirstName;
1034710355 };
1034810356 auto DiagMethodNote = [&ODRDiagDeclNote, SecondMethod, SecondMethodType,
10349- SecondName](ODRMismatchDeclDifference DiffType) {
10357+ SecondName](ODRCXXRecordDifference DiffType) {
1035010358 return ODRDiagDeclNote (SecondMethod->getLocation (),
1035110359 SecondMethod->getSourceRange (), DiffType)
1035210360 << SecondMethodType << SecondName;
@@ -10681,13 +10689,13 @@ void ASTReader::diagnoseOdrViolations() {
1068110689 SecondTemplate->getTemplateParameters ();
1068210690
1068310691 auto DiagTemplateError = [&ODRDiagDeclError, FirstTemplate](
10684- ODRMismatchDeclDifference DiffType) {
10692+ ODRCXXRecordDifference DiffType) {
1068510693 return ODRDiagDeclError (FirstTemplate->getLocation (),
1068610694 FirstTemplate->getSourceRange (), DiffType)
1068710695 << FirstTemplate;
1068810696 };
1068910697 auto DiagTemplateNote = [&ODRDiagDeclNote, SecondTemplate](
10690- ODRMismatchDeclDifference DiffType) {
10698+ ODRCXXRecordDifference DiffType) {
1069110699 return ODRDiagDeclNote (SecondTemplate->getLocation (),
1069210700 SecondTemplate->getSourceRange (), DiffType)
1069310701 << SecondTemplate;
0 commit comments