This revision was automatically updated to reflect the committed changes.
Closed by commit rGc5931267db26: [modules] While merging ObjCInterfaceDecl
definitions, merge them as decl… (authored by vsapsai).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110287/new/
https://reviews.llvm.org/D110287
Files:
clang/lib/Serialization/ASTReaderDecl.cpp
clang/test/Modules/odr_hash.mm
Index: clang/test/Modules/odr_hash.mm
===================================================================
--- clang/test/Modules/odr_hash.mm
+++ clang/test/Modules/odr_hash.mm
@@ -241,12 +241,12 @@
@end
@interface Interface5 <T : I1 *> {
@public
- T<P1> x;
+ T<P1> y;
}
@end
@interface Interface6 <T1 : I1 *, T2 : I2 *> {
@public
- T1 x;
+ T1 z;
}
@end
#elif defined(SECOND)
@@ -257,14 +257,21 @@
@end
@interface Interface5 <T : I1 *> {
@public
- T<P1, P2> x;
+ T<P1, P2> y;
}
@end
@interface Interface6 <T1 : I1 *, T2 : I2 *> {
@public
- T2 x;
+ T2 z;
}
@end
+#else
+// [email protected]:* {{'Interface4::x' from module 'FirstModule' is not
present in definition of 'Interface4' in module 'SecondModule'}}
+// [email protected]:* {{declaration of 'x' does not match}}
+// [email protected]:* {{'Interface5::y' from module 'FirstModule' is not
present in definition of 'Interface5' in module 'SecondModule'}}
+// [email protected]:* {{declaration of 'y' does not match}}
+// [email protected]:* {{'Interface6::z' from module 'FirstModule' is not
present in definition of 'Interface6' in module 'SecondModule'}}
+// [email protected]:* {{declaration of 'z' does not match}}
#endif
namespace Types {
@@ -276,22 +283,22 @@
};
struct Invalid2 {
Interface5 *I;
- decltype(I->x) x;
+ decltype(I->y) y;
};
struct Invalid3 {
Interface6 *I;
- decltype(I->x) x;
+ decltype(I->z) z;
};
#else
Invalid1 i1;
// [email protected]:* {{'Types::ObjCTypeParam::Invalid1::x' from module
'FirstModule' is not present in definition of 'Types::ObjCTypeParam::Invalid1'
in module 'SecondModule'}}
// [email protected]:* {{declaration of 'x' does not match}}
Invalid2 i2;
-// [email protected]:* {{'Types::ObjCTypeParam::Invalid2::x' from module
'FirstModule' is not present in definition of 'Types::ObjCTypeParam::Invalid2'
in module 'SecondModule'}}
-// [email protected]:* {{declaration of 'x' does not match}}
+// [email protected]:* {{'Types::ObjCTypeParam::Invalid2::y' from module
'FirstModule' is not present in definition of 'Types::ObjCTypeParam::Invalid2'
in module 'SecondModule'}}
+// [email protected]:* {{declaration of 'y' does not match}}
Invalid3 i3;
-// [email protected]:* {{'Types::ObjCTypeParam::Invalid3::x' from module
'FirstModule' is not present in definition of 'Types::ObjCTypeParam::Invalid3'
in module 'SecondModule'}}
-// [email protected]:* {{declaration of 'x' does not match}}
+// [email protected]:* {{'Types::ObjCTypeParam::Invalid3::z' from module
'FirstModule' is not present in definition of 'Types::ObjCTypeParam::Invalid3'
in module 'SecondModule'}}
+// [email protected]:* {{declaration of 'z' does not match}}
#endif
} // namespace ObjCTypeParam
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===================================================================
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1177,6 +1177,12 @@
void ASTDeclReader::MergeDefinitionData(ObjCInterfaceDecl *D,
struct ObjCInterfaceDecl::DefinitionData &&NewDD) {
+ struct ObjCInterfaceDecl::DefinitionData &DD = D->data();
+ if (DD.Definition != NewDD.Definition) {
+ Reader.MergedDeclContexts.insert(
+ std::make_pair(NewDD.Definition, DD.Definition));
+ }
+
// FIXME: odr checking?
}
Index: clang/test/Modules/odr_hash.mm
===================================================================
--- clang/test/Modules/odr_hash.mm
+++ clang/test/Modules/odr_hash.mm
@@ -241,12 +241,12 @@
@end
@interface Interface5 <T : I1 *> {
@public
- T<P1> x;
+ T<P1> y;
}
@end
@interface Interface6 <T1 : I1 *, T2 : I2 *> {
@public
- T1 x;
+ T1 z;
}
@end
#elif defined(SECOND)
@@ -257,14 +257,21 @@
@end
@interface Interface5 <T : I1 *> {
@public
- T<P1, P2> x;
+ T<P1, P2> y;
}
@end
@interface Interface6 <T1 : I1 *, T2 : I2 *> {
@public
- T2 x;
+ T2 z;
}
@end
+#else
+// [email protected]:* {{'Interface4::x' from module 'FirstModule' is not present in definition of 'Interface4' in module 'SecondModule'}}
+// [email protected]:* {{declaration of 'x' does not match}}
+// [email protected]:* {{'Interface5::y' from module 'FirstModule' is not present in definition of 'Interface5' in module 'SecondModule'}}
+// [email protected]:* {{declaration of 'y' does not match}}
+// [email protected]:* {{'Interface6::z' from module 'FirstModule' is not present in definition of 'Interface6' in module 'SecondModule'}}
+// [email protected]:* {{declaration of 'z' does not match}}
#endif
namespace Types {
@@ -276,22 +283,22 @@
};
struct Invalid2 {
Interface5 *I;
- decltype(I->x) x;
+ decltype(I->y) y;
};
struct Invalid3 {
Interface6 *I;
- decltype(I->x) x;
+ decltype(I->z) z;
};
#else
Invalid1 i1;
// [email protected]:* {{'Types::ObjCTypeParam::Invalid1::x' from module 'FirstModule' is not present in definition of 'Types::ObjCTypeParam::Invalid1' in module 'SecondModule'}}
// [email protected]:* {{declaration of 'x' does not match}}
Invalid2 i2;
-// [email protected]:* {{'Types::ObjCTypeParam::Invalid2::x' from module 'FirstModule' is not present in definition of 'Types::ObjCTypeParam::Invalid2' in module 'SecondModule'}}
-// [email protected]:* {{declaration of 'x' does not match}}
+// [email protected]:* {{'Types::ObjCTypeParam::Invalid2::y' from module 'FirstModule' is not present in definition of 'Types::ObjCTypeParam::Invalid2' in module 'SecondModule'}}
+// [email protected]:* {{declaration of 'y' does not match}}
Invalid3 i3;
-// [email protected]:* {{'Types::ObjCTypeParam::Invalid3::x' from module 'FirstModule' is not present in definition of 'Types::ObjCTypeParam::Invalid3' in module 'SecondModule'}}
-// [email protected]:* {{declaration of 'x' does not match}}
+// [email protected]:* {{'Types::ObjCTypeParam::Invalid3::z' from module 'FirstModule' is not present in definition of 'Types::ObjCTypeParam::Invalid3' in module 'SecondModule'}}
+// [email protected]:* {{declaration of 'z' does not match}}
#endif
} // namespace ObjCTypeParam
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===================================================================
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1177,6 +1177,12 @@
void ASTDeclReader::MergeDefinitionData(ObjCInterfaceDecl *D,
struct ObjCInterfaceDecl::DefinitionData &&NewDD) {
+ struct ObjCInterfaceDecl::DefinitionData &DD = D->data();
+ if (DD.Definition != NewDD.Definition) {
+ Reader.MergedDeclContexts.insert(
+ std::make_pair(NewDD.Definition, DD.Definition));
+ }
+
// FIXME: odr checking?
}
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits