@@ -9637,19 +9637,12 @@ void ASTReader::diagnoseOdrViolations() {
9637
9637
Other
9638
9638
};
9639
9639
9640
- // Used with err_module_odr_violation_mismatch_decl_diff and
9641
- // note_module_odr_violation_mismatch_decl_diff
9642
- enum ODRMismatchDeclDifference {
9640
+ // Used with err_module_odr_violation_record and
9641
+ // note_module_odr_violation_record
9642
+ enum ODRCXXRecordDifference {
9643
9643
StaticAssertCondition,
9644
9644
StaticAssertMessage,
9645
9645
StaticAssertOnlyMessage,
9646
- FieldName,
9647
- FieldTypeName,
9648
- FieldSingleBitField,
9649
- FieldDifferentWidthBitField,
9650
- FieldSingleMutable,
9651
- FieldSingleInitializer,
9652
- FieldDifferentInitializers,
9653
9646
MethodName,
9654
9647
MethodDeleted,
9655
9648
MethodDefaulted,
@@ -9668,13 +9661,6 @@ void ASTReader::diagnoseOdrViolations() {
9668
9661
MethodDifferentTemplateArgument,
9669
9662
MethodSingleBody,
9670
9663
MethodDifferentBody,
9671
- TypedefName,
9672
- TypedefType,
9673
- VarName,
9674
- VarType,
9675
- VarSingleInitializer,
9676
- VarDifferentInitializer,
9677
- VarConstexpr,
9678
9664
FriendTypeFunction,
9679
9665
FriendType,
9680
9666
FriendFunction,
@@ -9694,17 +9680,27 @@ void ASTReader::diagnoseOdrViolations() {
9694
9680
NamedDecl *FirstRecord, StringRef FirstModule,
9695
9681
StringRef SecondModule, FieldDecl *FirstField,
9696
9682
FieldDecl *SecondField) {
9683
+ enum ODRFieldDifference {
9684
+ FieldName,
9685
+ FieldTypeName,
9686
+ FieldSingleBitField,
9687
+ FieldDifferentWidthBitField,
9688
+ FieldSingleMutable,
9689
+ FieldSingleInitializer,
9690
+ FieldDifferentInitializers,
9691
+ };
9692
+
9697
9693
auto DiagError = [FirstRecord, FirstField, FirstModule,
9698
- this ](ODRMismatchDeclDifference DiffType) {
9694
+ this ](ODRFieldDifference DiffType) {
9699
9695
return Diag (FirstField->getLocation (),
9700
- diag::err_module_odr_violation_mismatch_decl_diff )
9696
+ diag::err_module_odr_violation_field )
9701
9697
<< FirstRecord << FirstModule.empty () << FirstModule
9702
9698
<< FirstField->getSourceRange () << DiffType;
9703
9699
};
9704
9700
auto DiagNote = [SecondField, SecondModule,
9705
- this ](ODRMismatchDeclDifference DiffType) {
9701
+ this ](ODRFieldDifference DiffType) {
9706
9702
return Diag (SecondField->getLocation (),
9707
- diag::note_module_odr_violation_mismatch_decl_diff )
9703
+ diag::note_module_odr_violation_field )
9708
9704
<< SecondModule << SecondField->getSourceRange () << DiffType;
9709
9705
};
9710
9706
@@ -9792,17 +9788,22 @@ void ASTReader::diagnoseOdrViolations() {
9792
9788
NamedDecl *FirstRecord, StringRef FirstModule, StringRef SecondModule,
9793
9789
TypedefNameDecl *FirstTD, TypedefNameDecl *SecondTD,
9794
9790
bool IsTypeAlias) {
9791
+ enum ODRTypedefDifference {
9792
+ TypedefName,
9793
+ TypedefType,
9794
+ };
9795
+
9795
9796
auto DiagError = [FirstRecord, FirstTD, FirstModule,
9796
- this ](ODRMismatchDeclDifference DiffType) {
9797
+ this ](ODRTypedefDifference DiffType) {
9797
9798
return Diag (FirstTD->getLocation (),
9798
- diag::err_module_odr_violation_mismatch_decl_diff )
9799
+ diag::err_module_odr_violation_typedef )
9799
9800
<< FirstRecord << FirstModule.empty () << FirstModule
9800
9801
<< FirstTD->getSourceRange () << DiffType;
9801
9802
};
9802
9803
auto DiagNote = [SecondTD, SecondModule,
9803
- this ](ODRMismatchDeclDifference DiffType) {
9804
+ this ](ODRTypedefDifference DiffType) {
9804
9805
return Diag (SecondTD->getLocation (),
9805
- diag::note_module_odr_violation_mismatch_decl_diff )
9806
+ diag::note_module_odr_violation_typedef )
9806
9807
<< SecondModule << SecondTD->getSourceRange () << DiffType;
9807
9808
};
9808
9809
@@ -9830,17 +9831,24 @@ void ASTReader::diagnoseOdrViolations() {
9830
9831
this ](NamedDecl *FirstRecord, StringRef FirstModule,
9831
9832
StringRef SecondModule, VarDecl *FirstVD,
9832
9833
VarDecl *SecondVD) {
9834
+ enum ODRVarDifference {
9835
+ VarName,
9836
+ VarType,
9837
+ VarSingleInitializer,
9838
+ VarDifferentInitializer,
9839
+ VarConstexpr,
9840
+ };
9841
+
9833
9842
auto DiagError = [FirstRecord, FirstVD, FirstModule,
9834
- this ](ODRMismatchDeclDifference DiffType) {
9843
+ this ](ODRVarDifference DiffType) {
9835
9844
return Diag (FirstVD->getLocation (),
9836
- diag::err_module_odr_violation_mismatch_decl_diff )
9845
+ diag::err_module_odr_violation_variable )
9837
9846
<< FirstRecord << FirstModule.empty () << FirstModule
9838
9847
<< FirstVD->getSourceRange () << DiffType;
9839
9848
};
9840
- auto DiagNote = [SecondVD, SecondModule,
9841
- this ](ODRMismatchDeclDifference DiffType) {
9849
+ auto DiagNote = [SecondVD, SecondModule, this ](ODRVarDifference DiffType) {
9842
9850
return Diag (SecondVD->getLocation (),
9843
- diag::note_module_odr_violation_mismatch_decl_diff )
9851
+ diag::note_module_odr_violation_variable )
9844
9852
<< SecondModule << SecondVD->getSourceRange () << DiffType;
9845
9853
};
9846
9854
@@ -10053,15 +10061,15 @@ void ASTReader::diagnoseOdrViolations() {
10053
10061
std::string SecondModule = getOwningModuleNameForDiagnostic (SecondRecord);
10054
10062
auto ODRDiagDeclError = [FirstRecord, &FirstModule,
10055
10063
this ](SourceLocation Loc, SourceRange Range,
10056
- ODRMismatchDeclDifference DiffType) {
10057
- return Diag (Loc, diag::err_module_odr_violation_mismatch_decl_diff )
10064
+ ODRCXXRecordDifference DiffType) {
10065
+ return Diag (Loc, diag::err_module_odr_violation_record )
10058
10066
<< FirstRecord << FirstModule.empty () << FirstModule << Range
10059
10067
<< DiffType;
10060
10068
};
10061
10069
auto ODRDiagDeclNote = [&SecondModule,
10062
10070
this ](SourceLocation Loc, SourceRange Range,
10063
- ODRMismatchDeclDifference DiffType) {
10064
- return Diag (Loc, diag::note_module_odr_violation_mismatch_decl_diff )
10071
+ ODRCXXRecordDifference DiffType) {
10072
+ return Diag (Loc, diag::note_module_odr_violation_record )
10065
10073
<< SecondModule << Range << DiffType;
10066
10074
};
10067
10075
@@ -10388,13 +10396,13 @@ void ASTReader::diagnoseOdrViolations() {
10388
10396
DeclarationName FirstName = FirstMethod->getDeclName ();
10389
10397
DeclarationName SecondName = SecondMethod->getDeclName ();
10390
10398
auto DiagMethodError = [&ODRDiagDeclError, FirstMethod, FirstMethodType,
10391
- FirstName](ODRMismatchDeclDifference DiffType) {
10399
+ FirstName](ODRCXXRecordDifference DiffType) {
10392
10400
return ODRDiagDeclError (FirstMethod->getLocation (),
10393
10401
FirstMethod->getSourceRange (), DiffType)
10394
10402
<< FirstMethodType << FirstName;
10395
10403
};
10396
10404
auto DiagMethodNote = [&ODRDiagDeclNote, SecondMethod, SecondMethodType,
10397
- SecondName](ODRMismatchDeclDifference DiffType) {
10405
+ SecondName](ODRCXXRecordDifference DiffType) {
10398
10406
return ODRDiagDeclNote (SecondMethod->getLocation (),
10399
10407
SecondMethod->getSourceRange (), DiffType)
10400
10408
<< SecondMethodType << SecondName;
@@ -10729,13 +10737,13 @@ void ASTReader::diagnoseOdrViolations() {
10729
10737
SecondTemplate->getTemplateParameters ();
10730
10738
10731
10739
auto DiagTemplateError = [&ODRDiagDeclError, FirstTemplate](
10732
- ODRMismatchDeclDifference DiffType) {
10740
+ ODRCXXRecordDifference DiffType) {
10733
10741
return ODRDiagDeclError (FirstTemplate->getLocation (),
10734
10742
FirstTemplate->getSourceRange (), DiffType)
10735
10743
<< FirstTemplate;
10736
10744
};
10737
10745
auto DiagTemplateNote = [&ODRDiagDeclNote, SecondTemplate](
10738
- ODRMismatchDeclDifference DiffType) {
10746
+ ODRCXXRecordDifference DiffType) {
10739
10747
return ODRDiagDeclNote (SecondTemplate->getLocation (),
10740
10748
SecondTemplate->getSourceRange (), DiffType)
10741
10749
<< SecondTemplate;
0 commit comments