VisitRecordDecl(D);
+ if (D->DefinitionData) {
+ // Synchronize the DefinitionData pointer among all redeclarations.
+ // This synchronization ends up being done multiple times but it's necessary
+ // because a chained PCH may introduce a definition that earlier
+ // redeclarations in another PCH have no information about.
+ llvm::SmallPtrSet<CXXRecordDecl *, 16> PrevRedecls;
+ PrevRedecls.insert(D);
+ CXXRecordDecl *Redecl = cast<CXXRecordDecl>(D->RedeclLink.getNext());
+ while (!PrevRedecls.count(Redecl)) {
+ PrevRedecls.insert(Redecl);
+ assert((!Redecl->DefinitionData ||
+ Redecl->DefinitionData == D->DefinitionData) &&
+ "Multiple definitions in the redeclaration chain ?");
+ Redecl->DefinitionData = D->DefinitionData;
+ Redecl = cast<CXXRecordDecl>(Redecl->RedeclLink.getNext());
+ }
+ }
+
if (OwnsDefinitionData) {
assert(D->DefinitionData);
struct CXXRecordDecl::DefinitionData &Data = *D->DefinitionData;
template <typename T>
struct S<T *> { typedef int H; };
+template <typename T> struct TS2;
+typedef TS2<int> TS2int;
+
//===----------------------------------------------------------------------===//
#elif not defined(HEADER2)
#define HEADER2
template <>
struct S<int &> { typedef int L; };
+template <typename T> struct TS2 { };
+
//===----------------------------------------------------------------------===//
#else
//===----------------------------------------------------------------------===//
typedef S<double &>::J T4;
typedef S<int *>::K T5;
typedef S<int &>::L T6;
+
+ TS2int ts2;
}
//===----------------------------------------------------------------------===//