@@ -76,6 +76,10 @@ class DelegatingDeserializationListener : public ASTDeserializationListener {
76
76
if (Previous)
77
77
Previous->IdentifierRead (ID, II);
78
78
}
79
+ void MacroRead (serialization::MacroID ID, MacroInfo *MI) override {
80
+ if (Previous)
81
+ Previous->MacroRead (ID, MI);
82
+ }
79
83
void TypeRead (serialization::TypeIdx Idx, QualType T) override {
80
84
if (Previous)
81
85
Previous->TypeRead (Idx, T);
@@ -93,6 +97,19 @@ class DelegatingDeserializationListener : public ASTDeserializationListener {
93
97
if (Previous)
94
98
Previous->MacroDefinitionRead (PPID, MD);
95
99
}
100
+ void ModuleRead (serialization::SubmoduleID ID, Module *Mod) override {
101
+ if (Previous)
102
+ Previous->ModuleRead (ID, Mod);
103
+ }
104
+ void ModuleImportRead (serialization::SubmoduleID ID,
105
+ SourceLocation ImportLoc) override {
106
+ if (Previous)
107
+ Previous->ModuleImportRead (ID, ImportLoc);
108
+ }
109
+ void FinishedDeserializing () override {
110
+ if (Previous)
111
+ Previous->FinishedDeserializing ();
112
+ }
96
113
};
97
114
98
115
// / Dumps deserialized declarations.
@@ -103,15 +120,30 @@ class DeserializedDeclsDumper : public DelegatingDeserializationListener {
103
120
: DelegatingDeserializationListener(Previous, DeletePrevious) {}
104
121
105
122
void DeclRead (GlobalDeclID ID, const Decl *D) override {
106
- llvm::outs () << " PCH DECL: " << D->getDeclKindName ();
107
- if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
108
- llvm::outs () << " - " ;
109
- ND->printQualifiedName (llvm::outs ());
123
+ PendingDecls.push_back (D);
124
+ DelegatingDeserializationListener::DeclRead (ID, D);
125
+ }
126
+ void FinishedDeserializing () override {
127
+ auto Decls = std::move (PendingDecls);
128
+ for (const auto *D : Decls) {
129
+ llvm::outs () << " PCH DECL: " << D->getDeclKindName ();
130
+ if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
131
+ llvm::outs () << " - " ;
132
+ ND->printQualifiedName (llvm::outs ());
133
+ }
134
+ llvm::outs () << " \n " ;
110
135
}
111
- llvm::outs () << " \n " ;
112
136
113
- DelegatingDeserializationListener::DeclRead (ID, D);
137
+ if (!PendingDecls.empty ()) {
138
+ llvm::errs () << " Deserialized more decls while printing, total of "
139
+ << PendingDecls.size () << " \n " ;
140
+ PendingDecls.clear ();
141
+ }
142
+ DelegatingDeserializationListener::FinishedDeserializing ();
114
143
}
144
+
145
+ private:
146
+ std::vector<const Decl *> PendingDecls;
115
147
};
116
148
117
149
// / Checks deserialized declarations and emits error if a name
0 commit comments