xref: /minix3/external/bsd/llvm/dist/clang/lib/Sema/MultiplexExternalSemaSource.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc //===--- MultiplexExternalSemaSource.cpp  ---------------------------------===//
2f4a2713aSLionel Sambuc //
3f4a2713aSLionel Sambuc //                     The LLVM Compiler Infrastructure
4f4a2713aSLionel Sambuc //
5f4a2713aSLionel Sambuc // This file is distributed under the University of Illinois Open Source
6f4a2713aSLionel Sambuc // License. See LICENSE.TXT for details.
7f4a2713aSLionel Sambuc //
8f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
9f4a2713aSLionel Sambuc //
10f4a2713aSLionel Sambuc // This file implements the event dispatching to the subscribed clients.
11f4a2713aSLionel Sambuc //
12f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
13f4a2713aSLionel Sambuc #include "clang/Sema/MultiplexExternalSemaSource.h"
14f4a2713aSLionel Sambuc #include "clang/AST/DeclContextInternals.h"
15f4a2713aSLionel Sambuc #include "clang/Sema/Lookup.h"
16f4a2713aSLionel Sambuc 
17f4a2713aSLionel Sambuc using namespace clang;
18f4a2713aSLionel Sambuc 
19f4a2713aSLionel Sambuc ///\brief Constructs a new multiplexing external sema source and appends the
20f4a2713aSLionel Sambuc /// given element to it.
21f4a2713aSLionel Sambuc ///
22f4a2713aSLionel Sambuc ///\param[in] source - An ExternalSemaSource.
23f4a2713aSLionel Sambuc ///
MultiplexExternalSemaSource(ExternalSemaSource & s1,ExternalSemaSource & s2)24f4a2713aSLionel Sambuc MultiplexExternalSemaSource::MultiplexExternalSemaSource(ExternalSemaSource &s1,
25f4a2713aSLionel Sambuc                                                         ExternalSemaSource &s2){
26f4a2713aSLionel Sambuc   Sources.push_back(&s1);
27f4a2713aSLionel Sambuc   Sources.push_back(&s2);
28f4a2713aSLionel Sambuc }
29f4a2713aSLionel Sambuc 
30f4a2713aSLionel Sambuc // pin the vtable here.
~MultiplexExternalSemaSource()31f4a2713aSLionel Sambuc MultiplexExternalSemaSource::~MultiplexExternalSemaSource() {}
32f4a2713aSLionel Sambuc 
33f4a2713aSLionel Sambuc ///\brief Appends new source to the source list.
34f4a2713aSLionel Sambuc ///
35f4a2713aSLionel Sambuc ///\param[in] source - An ExternalSemaSource.
36f4a2713aSLionel Sambuc ///
addSource(ExternalSemaSource & source)37f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::addSource(ExternalSemaSource &source) {
38f4a2713aSLionel Sambuc   Sources.push_back(&source);
39f4a2713aSLionel Sambuc }
40f4a2713aSLionel Sambuc 
41f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
42f4a2713aSLionel Sambuc // ExternalASTSource.
43f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
44f4a2713aSLionel Sambuc 
GetExternalDecl(uint32_t ID)45f4a2713aSLionel Sambuc Decl *MultiplexExternalSemaSource::GetExternalDecl(uint32_t ID) {
46f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
47f4a2713aSLionel Sambuc     if (Decl *Result = Sources[i]->GetExternalDecl(ID))
48f4a2713aSLionel Sambuc       return Result;
49*0a6a1f1dSLionel Sambuc   return nullptr;
50*0a6a1f1dSLionel Sambuc }
51*0a6a1f1dSLionel Sambuc 
CompleteRedeclChain(const Decl * D)52*0a6a1f1dSLionel Sambuc void MultiplexExternalSemaSource::CompleteRedeclChain(const Decl *D) {
53*0a6a1f1dSLionel Sambuc   for (size_t i = 0; i < Sources.size(); ++i)
54*0a6a1f1dSLionel Sambuc     Sources[i]->CompleteRedeclChain(D);
55f4a2713aSLionel Sambuc }
56f4a2713aSLionel Sambuc 
GetExternalSelector(uint32_t ID)57f4a2713aSLionel Sambuc Selector MultiplexExternalSemaSource::GetExternalSelector(uint32_t ID) {
58f4a2713aSLionel Sambuc   Selector Sel;
59f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i) {
60f4a2713aSLionel Sambuc     Sel = Sources[i]->GetExternalSelector(ID);
61f4a2713aSLionel Sambuc     if (!Sel.isNull())
62f4a2713aSLionel Sambuc       return Sel;
63f4a2713aSLionel Sambuc   }
64f4a2713aSLionel Sambuc   return Sel;
65f4a2713aSLionel Sambuc }
66f4a2713aSLionel Sambuc 
GetNumExternalSelectors()67f4a2713aSLionel Sambuc uint32_t MultiplexExternalSemaSource::GetNumExternalSelectors() {
68f4a2713aSLionel Sambuc   uint32_t total = 0;
69f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
70f4a2713aSLionel Sambuc     total += Sources[i]->GetNumExternalSelectors();
71f4a2713aSLionel Sambuc   return total;
72f4a2713aSLionel Sambuc }
73f4a2713aSLionel Sambuc 
GetExternalDeclStmt(uint64_t Offset)74f4a2713aSLionel Sambuc Stmt *MultiplexExternalSemaSource::GetExternalDeclStmt(uint64_t Offset) {
75f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
76f4a2713aSLionel Sambuc     if (Stmt *Result = Sources[i]->GetExternalDeclStmt(Offset))
77f4a2713aSLionel Sambuc       return Result;
78*0a6a1f1dSLionel Sambuc   return nullptr;
79f4a2713aSLionel Sambuc }
80f4a2713aSLionel Sambuc 
GetExternalCXXBaseSpecifiers(uint64_t Offset)81f4a2713aSLionel Sambuc CXXBaseSpecifier *MultiplexExternalSemaSource::GetExternalCXXBaseSpecifiers(
82f4a2713aSLionel Sambuc                                                                uint64_t Offset){
83f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
84f4a2713aSLionel Sambuc     if (CXXBaseSpecifier *R = Sources[i]->GetExternalCXXBaseSpecifiers(Offset))
85f4a2713aSLionel Sambuc       return R;
86*0a6a1f1dSLionel Sambuc   return nullptr;
87f4a2713aSLionel Sambuc }
88f4a2713aSLionel Sambuc 
89f4a2713aSLionel Sambuc bool MultiplexExternalSemaSource::
FindExternalVisibleDeclsByName(const DeclContext * DC,DeclarationName Name)90f4a2713aSLionel Sambuc FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) {
91f4a2713aSLionel Sambuc   bool AnyDeclsFound = false;
92f4a2713aSLionel Sambuc   for (size_t i = 0; i < Sources.size(); ++i)
93f4a2713aSLionel Sambuc     AnyDeclsFound |= Sources[i]->FindExternalVisibleDeclsByName(DC, Name);
94f4a2713aSLionel Sambuc   return AnyDeclsFound;
95f4a2713aSLionel Sambuc }
96f4a2713aSLionel Sambuc 
completeVisibleDeclsMap(const DeclContext * DC)97f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::completeVisibleDeclsMap(const DeclContext *DC){
98f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
99f4a2713aSLionel Sambuc     Sources[i]->completeVisibleDeclsMap(DC);
100f4a2713aSLionel Sambuc }
101f4a2713aSLionel Sambuc 
102f4a2713aSLionel Sambuc ExternalLoadResult MultiplexExternalSemaSource::
FindExternalLexicalDecls(const DeclContext * DC,bool (* isKindWeWant)(Decl::Kind),SmallVectorImpl<Decl * > & Result)103f4a2713aSLionel Sambuc FindExternalLexicalDecls(const DeclContext *DC,
104f4a2713aSLionel Sambuc                          bool (*isKindWeWant)(Decl::Kind),
105f4a2713aSLionel Sambuc                          SmallVectorImpl<Decl*> &Result) {
106f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
107f4a2713aSLionel Sambuc     // FIXME: The semantics of the return result is unclear to me...
108f4a2713aSLionel Sambuc     Sources[i]->FindExternalLexicalDecls(DC, isKindWeWant, Result);
109f4a2713aSLionel Sambuc 
110f4a2713aSLionel Sambuc   return ELR_Success;
111f4a2713aSLionel Sambuc }
112f4a2713aSLionel Sambuc 
FindFileRegionDecls(FileID File,unsigned Offset,unsigned Length,SmallVectorImpl<Decl * > & Decls)113f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::FindFileRegionDecls(FileID File,
114f4a2713aSLionel Sambuc                                                       unsigned Offset,
115f4a2713aSLionel Sambuc                                                       unsigned Length,
116f4a2713aSLionel Sambuc                                                 SmallVectorImpl<Decl *> &Decls){
117f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
118f4a2713aSLionel Sambuc     Sources[i]->FindFileRegionDecls(File, Offset, Length, Decls);
119f4a2713aSLionel Sambuc }
120f4a2713aSLionel Sambuc 
CompleteType(TagDecl * Tag)121f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::CompleteType(TagDecl *Tag) {
122f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
123f4a2713aSLionel Sambuc     Sources[i]->CompleteType(Tag);
124f4a2713aSLionel Sambuc }
125f4a2713aSLionel Sambuc 
CompleteType(ObjCInterfaceDecl * Class)126f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::CompleteType(ObjCInterfaceDecl *Class) {
127f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
128f4a2713aSLionel Sambuc     Sources[i]->CompleteType(Class);
129f4a2713aSLionel Sambuc }
130f4a2713aSLionel Sambuc 
ReadComments()131f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadComments() {
132f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
133f4a2713aSLionel Sambuc     Sources[i]->ReadComments();
134f4a2713aSLionel Sambuc }
135f4a2713aSLionel Sambuc 
StartedDeserializing()136f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::StartedDeserializing() {
137f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
138f4a2713aSLionel Sambuc     Sources[i]->StartedDeserializing();
139f4a2713aSLionel Sambuc }
140f4a2713aSLionel Sambuc 
FinishedDeserializing()141f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::FinishedDeserializing() {
142f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
143f4a2713aSLionel Sambuc     Sources[i]->FinishedDeserializing();
144f4a2713aSLionel Sambuc }
145f4a2713aSLionel Sambuc 
StartTranslationUnit(ASTConsumer * Consumer)146f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::StartTranslationUnit(ASTConsumer *Consumer) {
147f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
148f4a2713aSLionel Sambuc     Sources[i]->StartTranslationUnit(Consumer);
149f4a2713aSLionel Sambuc }
150f4a2713aSLionel Sambuc 
PrintStats()151f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::PrintStats() {
152f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
153f4a2713aSLionel Sambuc     Sources[i]->PrintStats();
154f4a2713aSLionel Sambuc }
155f4a2713aSLionel Sambuc 
layoutRecordType(const RecordDecl * Record,uint64_t & Size,uint64_t & Alignment,llvm::DenseMap<const FieldDecl *,uint64_t> & FieldOffsets,llvm::DenseMap<const CXXRecordDecl *,CharUnits> & BaseOffsets,llvm::DenseMap<const CXXRecordDecl *,CharUnits> & VirtualBaseOffsets)156f4a2713aSLionel Sambuc bool MultiplexExternalSemaSource::layoutRecordType(const RecordDecl *Record,
157f4a2713aSLionel Sambuc                                                    uint64_t &Size,
158f4a2713aSLionel Sambuc                                                    uint64_t &Alignment,
159f4a2713aSLionel Sambuc                       llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets,
160f4a2713aSLionel Sambuc                   llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets,
161f4a2713aSLionel Sambuc           llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets){
162f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
163f4a2713aSLionel Sambuc     if (Sources[i]->layoutRecordType(Record, Size, Alignment, FieldOffsets,
164f4a2713aSLionel Sambuc                                      BaseOffsets, VirtualBaseOffsets))
165f4a2713aSLionel Sambuc       return true;
166f4a2713aSLionel Sambuc   return false;
167f4a2713aSLionel Sambuc }
168f4a2713aSLionel Sambuc 
169f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::
getMemoryBufferSizes(MemoryBufferSizes & sizes) const170f4a2713aSLionel Sambuc getMemoryBufferSizes(MemoryBufferSizes &sizes) const {
171f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
172f4a2713aSLionel Sambuc     Sources[i]->getMemoryBufferSizes(sizes);
173f4a2713aSLionel Sambuc 
174f4a2713aSLionel Sambuc }
175f4a2713aSLionel Sambuc 
176f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
177f4a2713aSLionel Sambuc // ExternalSemaSource.
178f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
179f4a2713aSLionel Sambuc 
180f4a2713aSLionel Sambuc 
InitializeSema(Sema & S)181f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::InitializeSema(Sema &S) {
182f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
183f4a2713aSLionel Sambuc     Sources[i]->InitializeSema(S);
184f4a2713aSLionel Sambuc }
185f4a2713aSLionel Sambuc 
ForgetSema()186f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ForgetSema() {
187f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
188f4a2713aSLionel Sambuc     Sources[i]->ForgetSema();
189f4a2713aSLionel Sambuc }
190f4a2713aSLionel Sambuc 
ReadMethodPool(Selector Sel)191f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadMethodPool(Selector Sel) {
192f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
193f4a2713aSLionel Sambuc     Sources[i]->ReadMethodPool(Sel);
194f4a2713aSLionel Sambuc }
195f4a2713aSLionel Sambuc 
ReadKnownNamespaces(SmallVectorImpl<NamespaceDecl * > & Namespaces)196f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadKnownNamespaces(
197f4a2713aSLionel Sambuc                                    SmallVectorImpl<NamespaceDecl*> &Namespaces){
198f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
199f4a2713aSLionel Sambuc     Sources[i]->ReadKnownNamespaces(Namespaces);
200f4a2713aSLionel Sambuc }
201f4a2713aSLionel Sambuc 
ReadUndefinedButUsed(llvm::DenseMap<NamedDecl *,SourceLocation> & Undefined)202f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadUndefinedButUsed(
203f4a2713aSLionel Sambuc                          llvm::DenseMap<NamedDecl*, SourceLocation> &Undefined){
204f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
205f4a2713aSLionel Sambuc     Sources[i]->ReadUndefinedButUsed(Undefined);
206f4a2713aSLionel Sambuc }
207f4a2713aSLionel Sambuc 
LookupUnqualified(LookupResult & R,Scope * S)208f4a2713aSLionel Sambuc bool MultiplexExternalSemaSource::LookupUnqualified(LookupResult &R, Scope *S){
209f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
210f4a2713aSLionel Sambuc     Sources[i]->LookupUnqualified(R, S);
211f4a2713aSLionel Sambuc 
212f4a2713aSLionel Sambuc   return !R.empty();
213f4a2713aSLionel Sambuc }
214f4a2713aSLionel Sambuc 
ReadTentativeDefinitions(SmallVectorImpl<VarDecl * > & TentativeDefs)215f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadTentativeDefinitions(
216f4a2713aSLionel Sambuc                                      SmallVectorImpl<VarDecl*> &TentativeDefs) {
217f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
218f4a2713aSLionel Sambuc     Sources[i]->ReadTentativeDefinitions(TentativeDefs);
219f4a2713aSLionel Sambuc }
220f4a2713aSLionel Sambuc 
ReadUnusedFileScopedDecls(SmallVectorImpl<const DeclaratorDecl * > & Decls)221f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadUnusedFileScopedDecls(
222f4a2713aSLionel Sambuc                                 SmallVectorImpl<const DeclaratorDecl*> &Decls) {
223f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
224f4a2713aSLionel Sambuc     Sources[i]->ReadUnusedFileScopedDecls(Decls);
225f4a2713aSLionel Sambuc }
226f4a2713aSLionel Sambuc 
ReadDelegatingConstructors(SmallVectorImpl<CXXConstructorDecl * > & Decls)227f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadDelegatingConstructors(
228f4a2713aSLionel Sambuc                                   SmallVectorImpl<CXXConstructorDecl*> &Decls) {
229f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
230f4a2713aSLionel Sambuc     Sources[i]->ReadDelegatingConstructors(Decls);
231f4a2713aSLionel Sambuc }
232f4a2713aSLionel Sambuc 
ReadExtVectorDecls(SmallVectorImpl<TypedefNameDecl * > & Decls)233f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadExtVectorDecls(
234f4a2713aSLionel Sambuc                                      SmallVectorImpl<TypedefNameDecl*> &Decls) {
235f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
236f4a2713aSLionel Sambuc     Sources[i]->ReadExtVectorDecls(Decls);
237f4a2713aSLionel Sambuc }
238f4a2713aSLionel Sambuc 
ReadDynamicClasses(SmallVectorImpl<CXXRecordDecl * > & Decls)239f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadDynamicClasses(
240f4a2713aSLionel Sambuc                                        SmallVectorImpl<CXXRecordDecl*> &Decls) {
241f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
242f4a2713aSLionel Sambuc     Sources[i]->ReadDynamicClasses(Decls);
243f4a2713aSLionel Sambuc }
244f4a2713aSLionel Sambuc 
ReadUnusedLocalTypedefNameCandidates(llvm::SmallSetVector<const TypedefNameDecl *,4> & Decls)245*0a6a1f1dSLionel Sambuc void MultiplexExternalSemaSource::ReadUnusedLocalTypedefNameCandidates(
246*0a6a1f1dSLionel Sambuc     llvm::SmallSetVector<const TypedefNameDecl *, 4> &Decls) {
247*0a6a1f1dSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
248*0a6a1f1dSLionel Sambuc     Sources[i]->ReadUnusedLocalTypedefNameCandidates(Decls);
249*0a6a1f1dSLionel Sambuc }
250*0a6a1f1dSLionel Sambuc 
ReadLocallyScopedExternCDecls(SmallVectorImpl<NamedDecl * > & Decls)251f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadLocallyScopedExternCDecls(
252f4a2713aSLionel Sambuc                                            SmallVectorImpl<NamedDecl*> &Decls) {
253f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
254f4a2713aSLionel Sambuc     Sources[i]->ReadLocallyScopedExternCDecls(Decls);
255f4a2713aSLionel Sambuc }
256f4a2713aSLionel Sambuc 
ReadReferencedSelectors(SmallVectorImpl<std::pair<Selector,SourceLocation>> & Sels)257f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadReferencedSelectors(
258f4a2713aSLionel Sambuc                   SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels) {
259f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
260f4a2713aSLionel Sambuc     Sources[i]->ReadReferencedSelectors(Sels);
261f4a2713aSLionel Sambuc }
262f4a2713aSLionel Sambuc 
ReadWeakUndeclaredIdentifiers(SmallVectorImpl<std::pair<IdentifierInfo *,WeakInfo>> & WI)263f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadWeakUndeclaredIdentifiers(
264f4a2713aSLionel Sambuc                    SmallVectorImpl<std::pair<IdentifierInfo*, WeakInfo> > &WI) {
265f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
266f4a2713aSLionel Sambuc     Sources[i]->ReadWeakUndeclaredIdentifiers(WI);
267f4a2713aSLionel Sambuc }
268f4a2713aSLionel Sambuc 
ReadUsedVTables(SmallVectorImpl<ExternalVTableUse> & VTables)269f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadUsedVTables(
270f4a2713aSLionel Sambuc                                   SmallVectorImpl<ExternalVTableUse> &VTables) {
271f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
272f4a2713aSLionel Sambuc     Sources[i]->ReadUsedVTables(VTables);
273f4a2713aSLionel Sambuc }
274f4a2713aSLionel Sambuc 
ReadPendingInstantiations(SmallVectorImpl<std::pair<ValueDecl *,SourceLocation>> & Pending)275f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadPendingInstantiations(
276f4a2713aSLionel Sambuc                                            SmallVectorImpl<std::pair<ValueDecl*,
277f4a2713aSLionel Sambuc                                                    SourceLocation> > &Pending) {
278f4a2713aSLionel Sambuc   for(size_t i = 0; i < Sources.size(); ++i)
279f4a2713aSLionel Sambuc     Sources[i]->ReadPendingInstantiations(Pending);
280f4a2713aSLionel Sambuc }
281f4a2713aSLionel Sambuc 
ReadLateParsedTemplates(llvm::DenseMap<const FunctionDecl *,LateParsedTemplate * > & LPTMap)282f4a2713aSLionel Sambuc void MultiplexExternalSemaSource::ReadLateParsedTemplates(
283f4a2713aSLionel Sambuc     llvm::DenseMap<const FunctionDecl *, LateParsedTemplate *> &LPTMap) {
284f4a2713aSLionel Sambuc   for (size_t i = 0; i < Sources.size(); ++i)
285f4a2713aSLionel Sambuc     Sources[i]->ReadLateParsedTemplates(LPTMap);
286f4a2713aSLionel Sambuc }
287f4a2713aSLionel Sambuc 
CorrectTypo(const DeclarationNameInfo & Typo,int LookupKind,Scope * S,CXXScopeSpec * SS,CorrectionCandidateCallback & CCC,DeclContext * MemberContext,bool EnteringContext,const ObjCObjectPointerType * OPT)288f4a2713aSLionel Sambuc TypoCorrection MultiplexExternalSemaSource::CorrectTypo(
289f4a2713aSLionel Sambuc                                      const DeclarationNameInfo &Typo,
290f4a2713aSLionel Sambuc                                      int LookupKind, Scope *S, CXXScopeSpec *SS,
291f4a2713aSLionel Sambuc                                      CorrectionCandidateCallback &CCC,
292f4a2713aSLionel Sambuc                                      DeclContext *MemberContext,
293f4a2713aSLionel Sambuc                                      bool EnteringContext,
294f4a2713aSLionel Sambuc                                      const ObjCObjectPointerType *OPT) {
295f4a2713aSLionel Sambuc   for (size_t I = 0, E = Sources.size(); I < E; ++I) {
296f4a2713aSLionel Sambuc     if (TypoCorrection C = Sources[I]->CorrectTypo(Typo, LookupKind, S, SS, CCC,
297f4a2713aSLionel Sambuc                                                    MemberContext,
298f4a2713aSLionel Sambuc                                                    EnteringContext, OPT))
299f4a2713aSLionel Sambuc       return C;
300f4a2713aSLionel Sambuc   }
301f4a2713aSLionel Sambuc   return TypoCorrection();
302f4a2713aSLionel Sambuc }
303f4a2713aSLionel Sambuc 
MaybeDiagnoseMissingCompleteType(SourceLocation Loc,QualType T)304f4a2713aSLionel Sambuc bool MultiplexExternalSemaSource::MaybeDiagnoseMissingCompleteType(
305f4a2713aSLionel Sambuc     SourceLocation Loc, QualType T) {
306f4a2713aSLionel Sambuc   for (size_t I = 0, E = Sources.size(); I < E; ++I) {
307f4a2713aSLionel Sambuc     if (Sources[I]->MaybeDiagnoseMissingCompleteType(Loc, T))
308f4a2713aSLionel Sambuc       return true;
309f4a2713aSLionel Sambuc   }
310f4a2713aSLionel Sambuc   return false;
311f4a2713aSLionel Sambuc }
312