10b57cec5SDimitry Andric //===--- MultiplexExternalSemaSource.cpp ---------------------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This file implements the event dispatching to the subscribed clients.
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric #include "clang/Sema/MultiplexExternalSemaSource.h"
130b57cec5SDimitry Andric #include "clang/Sema/Lookup.h"
140b57cec5SDimitry Andric
150b57cec5SDimitry Andric using namespace clang;
160b57cec5SDimitry Andric
17480093f4SDimitry Andric char MultiplexExternalSemaSource::ID;
18480093f4SDimitry Andric
190b57cec5SDimitry Andric /// Constructs a new multiplexing external sema source and appends the
200b57cec5SDimitry Andric /// given element to it.
210b57cec5SDimitry Andric ///
MultiplexExternalSemaSource(ExternalSemaSource * S1,ExternalSemaSource * S2)22bdd1243dSDimitry Andric MultiplexExternalSemaSource::MultiplexExternalSemaSource(
23bdd1243dSDimitry Andric ExternalSemaSource *S1, ExternalSemaSource *S2) {
24bdd1243dSDimitry Andric S1->Retain();
25bdd1243dSDimitry Andric S2->Retain();
26bdd1243dSDimitry Andric Sources.push_back(S1);
27bdd1243dSDimitry Andric Sources.push_back(S2);
280b57cec5SDimitry Andric }
290b57cec5SDimitry Andric
300b57cec5SDimitry Andric // pin the vtable here.
~MultiplexExternalSemaSource()31bdd1243dSDimitry Andric MultiplexExternalSemaSource::~MultiplexExternalSemaSource() {
32bdd1243dSDimitry Andric for (auto *S : Sources)
33bdd1243dSDimitry Andric S->Release();
34bdd1243dSDimitry Andric }
350b57cec5SDimitry Andric
360b57cec5SDimitry Andric /// Appends new source to the source list.
370b57cec5SDimitry Andric ///
380b57cec5SDimitry Andric ///\param[in] source - An ExternalSemaSource.
390b57cec5SDimitry Andric ///
AddSource(ExternalSemaSource * Source)40bdd1243dSDimitry Andric void MultiplexExternalSemaSource::AddSource(ExternalSemaSource *Source) {
41bdd1243dSDimitry Andric Source->Retain();
42bdd1243dSDimitry Andric Sources.push_back(Source);
430b57cec5SDimitry Andric }
440b57cec5SDimitry Andric
450b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
460b57cec5SDimitry Andric // ExternalASTSource.
470b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
480b57cec5SDimitry Andric
GetExternalDecl(GlobalDeclID ID)49*0fca6ea1SDimitry Andric Decl *MultiplexExternalSemaSource::GetExternalDecl(GlobalDeclID ID) {
500b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
510b57cec5SDimitry Andric if (Decl *Result = Sources[i]->GetExternalDecl(ID))
520b57cec5SDimitry Andric return Result;
530b57cec5SDimitry Andric return nullptr;
540b57cec5SDimitry Andric }
550b57cec5SDimitry Andric
CompleteRedeclChain(const Decl * D)560b57cec5SDimitry Andric void MultiplexExternalSemaSource::CompleteRedeclChain(const Decl *D) {
570b57cec5SDimitry Andric for (size_t i = 0; i < Sources.size(); ++i)
580b57cec5SDimitry Andric Sources[i]->CompleteRedeclChain(D);
590b57cec5SDimitry Andric }
600b57cec5SDimitry Andric
GetExternalSelector(uint32_t ID)610b57cec5SDimitry Andric Selector MultiplexExternalSemaSource::GetExternalSelector(uint32_t ID) {
620b57cec5SDimitry Andric Selector Sel;
630b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i) {
640b57cec5SDimitry Andric Sel = Sources[i]->GetExternalSelector(ID);
650b57cec5SDimitry Andric if (!Sel.isNull())
660b57cec5SDimitry Andric return Sel;
670b57cec5SDimitry Andric }
680b57cec5SDimitry Andric return Sel;
690b57cec5SDimitry Andric }
700b57cec5SDimitry Andric
GetNumExternalSelectors()710b57cec5SDimitry Andric uint32_t MultiplexExternalSemaSource::GetNumExternalSelectors() {
720b57cec5SDimitry Andric uint32_t total = 0;
730b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
740b57cec5SDimitry Andric total += Sources[i]->GetNumExternalSelectors();
750b57cec5SDimitry Andric return total;
760b57cec5SDimitry Andric }
770b57cec5SDimitry Andric
GetExternalDeclStmt(uint64_t Offset)780b57cec5SDimitry Andric Stmt *MultiplexExternalSemaSource::GetExternalDeclStmt(uint64_t Offset) {
790b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
800b57cec5SDimitry Andric if (Stmt *Result = Sources[i]->GetExternalDeclStmt(Offset))
810b57cec5SDimitry Andric return Result;
820b57cec5SDimitry Andric return nullptr;
830b57cec5SDimitry Andric }
840b57cec5SDimitry Andric
GetExternalCXXBaseSpecifiers(uint64_t Offset)850b57cec5SDimitry Andric CXXBaseSpecifier *MultiplexExternalSemaSource::GetExternalCXXBaseSpecifiers(
860b57cec5SDimitry Andric uint64_t Offset){
870b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
880b57cec5SDimitry Andric if (CXXBaseSpecifier *R = Sources[i]->GetExternalCXXBaseSpecifiers(Offset))
890b57cec5SDimitry Andric return R;
900b57cec5SDimitry Andric return nullptr;
910b57cec5SDimitry Andric }
920b57cec5SDimitry Andric
930b57cec5SDimitry Andric CXXCtorInitializer **
GetExternalCXXCtorInitializers(uint64_t Offset)940b57cec5SDimitry Andric MultiplexExternalSemaSource::GetExternalCXXCtorInitializers(uint64_t Offset) {
950b57cec5SDimitry Andric for (auto *S : Sources)
960b57cec5SDimitry Andric if (auto *R = S->GetExternalCXXCtorInitializers(Offset))
970b57cec5SDimitry Andric return R;
980b57cec5SDimitry Andric return nullptr;
990b57cec5SDimitry Andric }
1000b57cec5SDimitry Andric
1010b57cec5SDimitry Andric ExternalASTSource::ExtKind
hasExternalDefinitions(const Decl * D)1020b57cec5SDimitry Andric MultiplexExternalSemaSource::hasExternalDefinitions(const Decl *D) {
1030b57cec5SDimitry Andric for (const auto &S : Sources)
1040b57cec5SDimitry Andric if (auto EK = S->hasExternalDefinitions(D))
1050b57cec5SDimitry Andric if (EK != EK_ReplyHazy)
1060b57cec5SDimitry Andric return EK;
1070b57cec5SDimitry Andric return EK_ReplyHazy;
1080b57cec5SDimitry Andric }
1090b57cec5SDimitry Andric
1100b57cec5SDimitry Andric bool MultiplexExternalSemaSource::
FindExternalVisibleDeclsByName(const DeclContext * DC,DeclarationName Name)1110b57cec5SDimitry Andric FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) {
1120b57cec5SDimitry Andric bool AnyDeclsFound = false;
1130b57cec5SDimitry Andric for (size_t i = 0; i < Sources.size(); ++i)
1140b57cec5SDimitry Andric AnyDeclsFound |= Sources[i]->FindExternalVisibleDeclsByName(DC, Name);
1150b57cec5SDimitry Andric return AnyDeclsFound;
1160b57cec5SDimitry Andric }
1170b57cec5SDimitry Andric
completeVisibleDeclsMap(const DeclContext * DC)1180b57cec5SDimitry Andric void MultiplexExternalSemaSource::completeVisibleDeclsMap(const DeclContext *DC){
1190b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1200b57cec5SDimitry Andric Sources[i]->completeVisibleDeclsMap(DC);
1210b57cec5SDimitry Andric }
1220b57cec5SDimitry Andric
FindExternalLexicalDecls(const DeclContext * DC,llvm::function_ref<bool (Decl::Kind)> IsKindWeWant,SmallVectorImpl<Decl * > & Result)1230b57cec5SDimitry Andric void MultiplexExternalSemaSource::FindExternalLexicalDecls(
1240b57cec5SDimitry Andric const DeclContext *DC, llvm::function_ref<bool(Decl::Kind)> IsKindWeWant,
1250b57cec5SDimitry Andric SmallVectorImpl<Decl *> &Result) {
1260b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1270b57cec5SDimitry Andric Sources[i]->FindExternalLexicalDecls(DC, IsKindWeWant, Result);
1280b57cec5SDimitry Andric }
1290b57cec5SDimitry Andric
FindFileRegionDecls(FileID File,unsigned Offset,unsigned Length,SmallVectorImpl<Decl * > & Decls)1300b57cec5SDimitry Andric void MultiplexExternalSemaSource::FindFileRegionDecls(FileID File,
1310b57cec5SDimitry Andric unsigned Offset,
1320b57cec5SDimitry Andric unsigned Length,
1330b57cec5SDimitry Andric SmallVectorImpl<Decl *> &Decls){
1340b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1350b57cec5SDimitry Andric Sources[i]->FindFileRegionDecls(File, Offset, Length, Decls);
1360b57cec5SDimitry Andric }
1370b57cec5SDimitry Andric
CompleteType(TagDecl * Tag)1380b57cec5SDimitry Andric void MultiplexExternalSemaSource::CompleteType(TagDecl *Tag) {
1390b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1400b57cec5SDimitry Andric Sources[i]->CompleteType(Tag);
1410b57cec5SDimitry Andric }
1420b57cec5SDimitry Andric
CompleteType(ObjCInterfaceDecl * Class)1430b57cec5SDimitry Andric void MultiplexExternalSemaSource::CompleteType(ObjCInterfaceDecl *Class) {
1440b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1450b57cec5SDimitry Andric Sources[i]->CompleteType(Class);
1460b57cec5SDimitry Andric }
1470b57cec5SDimitry Andric
ReadComments()1480b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadComments() {
1490b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1500b57cec5SDimitry Andric Sources[i]->ReadComments();
1510b57cec5SDimitry Andric }
1520b57cec5SDimitry Andric
StartedDeserializing()1530b57cec5SDimitry Andric void MultiplexExternalSemaSource::StartedDeserializing() {
1540b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1550b57cec5SDimitry Andric Sources[i]->StartedDeserializing();
1560b57cec5SDimitry Andric }
1570b57cec5SDimitry Andric
FinishedDeserializing()1580b57cec5SDimitry Andric void MultiplexExternalSemaSource::FinishedDeserializing() {
1590b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1600b57cec5SDimitry Andric Sources[i]->FinishedDeserializing();
1610b57cec5SDimitry Andric }
1620b57cec5SDimitry Andric
StartTranslationUnit(ASTConsumer * Consumer)1630b57cec5SDimitry Andric void MultiplexExternalSemaSource::StartTranslationUnit(ASTConsumer *Consumer) {
1640b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1650b57cec5SDimitry Andric Sources[i]->StartTranslationUnit(Consumer);
1660b57cec5SDimitry Andric }
1670b57cec5SDimitry Andric
PrintStats()1680b57cec5SDimitry Andric void MultiplexExternalSemaSource::PrintStats() {
1690b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1700b57cec5SDimitry Andric Sources[i]->PrintStats();
1710b57cec5SDimitry Andric }
1720b57cec5SDimitry Andric
getModule(unsigned ID)1730b57cec5SDimitry Andric Module *MultiplexExternalSemaSource::getModule(unsigned ID) {
1740b57cec5SDimitry Andric for (size_t i = 0; i < Sources.size(); ++i)
1750b57cec5SDimitry Andric if (auto M = Sources[i]->getModule(ID))
1760b57cec5SDimitry Andric return M;
1770b57cec5SDimitry Andric return nullptr;
1780b57cec5SDimitry Andric }
1790b57cec5SDimitry Andric
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)1800b57cec5SDimitry Andric bool MultiplexExternalSemaSource::layoutRecordType(const RecordDecl *Record,
1810b57cec5SDimitry Andric uint64_t &Size,
1820b57cec5SDimitry Andric uint64_t &Alignment,
1830b57cec5SDimitry Andric llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets,
1840b57cec5SDimitry Andric llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets,
1850b57cec5SDimitry Andric llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets){
1860b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1870b57cec5SDimitry Andric if (Sources[i]->layoutRecordType(Record, Size, Alignment, FieldOffsets,
1880b57cec5SDimitry Andric BaseOffsets, VirtualBaseOffsets))
1890b57cec5SDimitry Andric return true;
1900b57cec5SDimitry Andric return false;
1910b57cec5SDimitry Andric }
1920b57cec5SDimitry Andric
1930b57cec5SDimitry Andric void MultiplexExternalSemaSource::
getMemoryBufferSizes(MemoryBufferSizes & sizes) const1940b57cec5SDimitry Andric getMemoryBufferSizes(MemoryBufferSizes &sizes) const {
1950b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
1960b57cec5SDimitry Andric Sources[i]->getMemoryBufferSizes(sizes);
1970b57cec5SDimitry Andric
1980b57cec5SDimitry Andric }
1990b57cec5SDimitry Andric
2000b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
2010b57cec5SDimitry Andric // ExternalSemaSource.
2020b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
2030b57cec5SDimitry Andric
2040b57cec5SDimitry Andric
InitializeSema(Sema & S)2050b57cec5SDimitry Andric void MultiplexExternalSemaSource::InitializeSema(Sema &S) {
2060b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2070b57cec5SDimitry Andric Sources[i]->InitializeSema(S);
2080b57cec5SDimitry Andric }
2090b57cec5SDimitry Andric
ForgetSema()2100b57cec5SDimitry Andric void MultiplexExternalSemaSource::ForgetSema() {
2110b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2120b57cec5SDimitry Andric Sources[i]->ForgetSema();
2130b57cec5SDimitry Andric }
2140b57cec5SDimitry Andric
ReadMethodPool(Selector Sel)2150b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadMethodPool(Selector Sel) {
2160b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2170b57cec5SDimitry Andric Sources[i]->ReadMethodPool(Sel);
2180b57cec5SDimitry Andric }
2190b57cec5SDimitry Andric
updateOutOfDateSelector(Selector Sel)2200b57cec5SDimitry Andric void MultiplexExternalSemaSource::updateOutOfDateSelector(Selector Sel) {
2210b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2220b57cec5SDimitry Andric Sources[i]->updateOutOfDateSelector(Sel);
2230b57cec5SDimitry Andric }
2240b57cec5SDimitry Andric
ReadKnownNamespaces(SmallVectorImpl<NamespaceDecl * > & Namespaces)2250b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadKnownNamespaces(
2260b57cec5SDimitry Andric SmallVectorImpl<NamespaceDecl*> &Namespaces){
2270b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2280b57cec5SDimitry Andric Sources[i]->ReadKnownNamespaces(Namespaces);
2290b57cec5SDimitry Andric }
2300b57cec5SDimitry Andric
ReadUndefinedButUsed(llvm::MapVector<NamedDecl *,SourceLocation> & Undefined)2310b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadUndefinedButUsed(
2320b57cec5SDimitry Andric llvm::MapVector<NamedDecl *, SourceLocation> &Undefined) {
2330b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2340b57cec5SDimitry Andric Sources[i]->ReadUndefinedButUsed(Undefined);
2350b57cec5SDimitry Andric }
2360b57cec5SDimitry Andric
ReadMismatchingDeleteExpressions(llvm::MapVector<FieldDecl *,llvm::SmallVector<std::pair<SourceLocation,bool>,4>> & Exprs)2370b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadMismatchingDeleteExpressions(
2380b57cec5SDimitry Andric llvm::MapVector<FieldDecl *,
2390b57cec5SDimitry Andric llvm::SmallVector<std::pair<SourceLocation, bool>, 4>> &
2400b57cec5SDimitry Andric Exprs) {
2410b57cec5SDimitry Andric for (auto &Source : Sources)
2420b57cec5SDimitry Andric Source->ReadMismatchingDeleteExpressions(Exprs);
2430b57cec5SDimitry Andric }
2440b57cec5SDimitry Andric
LookupUnqualified(LookupResult & R,Scope * S)2450b57cec5SDimitry Andric bool MultiplexExternalSemaSource::LookupUnqualified(LookupResult &R, Scope *S){
2460b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2470b57cec5SDimitry Andric Sources[i]->LookupUnqualified(R, S);
2480b57cec5SDimitry Andric
2490b57cec5SDimitry Andric return !R.empty();
2500b57cec5SDimitry Andric }
2510b57cec5SDimitry Andric
ReadTentativeDefinitions(SmallVectorImpl<VarDecl * > & TentativeDefs)2520b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadTentativeDefinitions(
2530b57cec5SDimitry Andric SmallVectorImpl<VarDecl*> &TentativeDefs) {
2540b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2550b57cec5SDimitry Andric Sources[i]->ReadTentativeDefinitions(TentativeDefs);
2560b57cec5SDimitry Andric }
2570b57cec5SDimitry Andric
ReadUnusedFileScopedDecls(SmallVectorImpl<const DeclaratorDecl * > & Decls)2580b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadUnusedFileScopedDecls(
2590b57cec5SDimitry Andric SmallVectorImpl<const DeclaratorDecl*> &Decls) {
2600b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2610b57cec5SDimitry Andric Sources[i]->ReadUnusedFileScopedDecls(Decls);
2620b57cec5SDimitry Andric }
2630b57cec5SDimitry Andric
ReadDelegatingConstructors(SmallVectorImpl<CXXConstructorDecl * > & Decls)2640b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadDelegatingConstructors(
2650b57cec5SDimitry Andric SmallVectorImpl<CXXConstructorDecl*> &Decls) {
2660b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2670b57cec5SDimitry Andric Sources[i]->ReadDelegatingConstructors(Decls);
2680b57cec5SDimitry Andric }
2690b57cec5SDimitry Andric
ReadExtVectorDecls(SmallVectorImpl<TypedefNameDecl * > & Decls)2700b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadExtVectorDecls(
2710b57cec5SDimitry Andric SmallVectorImpl<TypedefNameDecl*> &Decls) {
2720b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2730b57cec5SDimitry Andric Sources[i]->ReadExtVectorDecls(Decls);
2740b57cec5SDimitry Andric }
2750b57cec5SDimitry Andric
ReadDeclsToCheckForDeferredDiags(llvm::SmallSetVector<Decl *,4> & Decls)2765ffd83dbSDimitry Andric void MultiplexExternalSemaSource::ReadDeclsToCheckForDeferredDiags(
277fe6060f1SDimitry Andric llvm::SmallSetVector<Decl *, 4> &Decls) {
2785ffd83dbSDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2795ffd83dbSDimitry Andric Sources[i]->ReadDeclsToCheckForDeferredDiags(Decls);
2805ffd83dbSDimitry Andric }
2815ffd83dbSDimitry Andric
ReadUnusedLocalTypedefNameCandidates(llvm::SmallSetVector<const TypedefNameDecl *,4> & Decls)2820b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadUnusedLocalTypedefNameCandidates(
2830b57cec5SDimitry Andric llvm::SmallSetVector<const TypedefNameDecl *, 4> &Decls) {
2840b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2850b57cec5SDimitry Andric Sources[i]->ReadUnusedLocalTypedefNameCandidates(Decls);
2860b57cec5SDimitry Andric }
2870b57cec5SDimitry Andric
ReadReferencedSelectors(SmallVectorImpl<std::pair<Selector,SourceLocation>> & Sels)2880b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadReferencedSelectors(
2890b57cec5SDimitry Andric SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels) {
2900b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2910b57cec5SDimitry Andric Sources[i]->ReadReferencedSelectors(Sels);
2920b57cec5SDimitry Andric }
2930b57cec5SDimitry Andric
ReadWeakUndeclaredIdentifiers(SmallVectorImpl<std::pair<IdentifierInfo *,WeakInfo>> & WI)2940b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadWeakUndeclaredIdentifiers(
2950b57cec5SDimitry Andric SmallVectorImpl<std::pair<IdentifierInfo*, WeakInfo> > &WI) {
2960b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
2970b57cec5SDimitry Andric Sources[i]->ReadWeakUndeclaredIdentifiers(WI);
2980b57cec5SDimitry Andric }
2990b57cec5SDimitry Andric
ReadUsedVTables(SmallVectorImpl<ExternalVTableUse> & VTables)3000b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadUsedVTables(
3010b57cec5SDimitry Andric SmallVectorImpl<ExternalVTableUse> &VTables) {
3020b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
3030b57cec5SDimitry Andric Sources[i]->ReadUsedVTables(VTables);
3040b57cec5SDimitry Andric }
3050b57cec5SDimitry Andric
ReadPendingInstantiations(SmallVectorImpl<std::pair<ValueDecl *,SourceLocation>> & Pending)3060b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadPendingInstantiations(
3070b57cec5SDimitry Andric SmallVectorImpl<std::pair<ValueDecl*,
3080b57cec5SDimitry Andric SourceLocation> > &Pending) {
3090b57cec5SDimitry Andric for(size_t i = 0; i < Sources.size(); ++i)
3100b57cec5SDimitry Andric Sources[i]->ReadPendingInstantiations(Pending);
3110b57cec5SDimitry Andric }
3120b57cec5SDimitry Andric
ReadLateParsedTemplates(llvm::MapVector<const FunctionDecl *,std::unique_ptr<LateParsedTemplate>> & LPTMap)3130b57cec5SDimitry Andric void MultiplexExternalSemaSource::ReadLateParsedTemplates(
3140b57cec5SDimitry Andric llvm::MapVector<const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
3150b57cec5SDimitry Andric &LPTMap) {
3160b57cec5SDimitry Andric for (size_t i = 0; i < Sources.size(); ++i)
3170b57cec5SDimitry Andric Sources[i]->ReadLateParsedTemplates(LPTMap);
3180b57cec5SDimitry Andric }
3190b57cec5SDimitry Andric
CorrectTypo(const DeclarationNameInfo & Typo,int LookupKind,Scope * S,CXXScopeSpec * SS,CorrectionCandidateCallback & CCC,DeclContext * MemberContext,bool EnteringContext,const ObjCObjectPointerType * OPT)3200b57cec5SDimitry Andric TypoCorrection MultiplexExternalSemaSource::CorrectTypo(
3210b57cec5SDimitry Andric const DeclarationNameInfo &Typo,
3220b57cec5SDimitry Andric int LookupKind, Scope *S, CXXScopeSpec *SS,
3230b57cec5SDimitry Andric CorrectionCandidateCallback &CCC,
3240b57cec5SDimitry Andric DeclContext *MemberContext,
3250b57cec5SDimitry Andric bool EnteringContext,
3260b57cec5SDimitry Andric const ObjCObjectPointerType *OPT) {
3270b57cec5SDimitry Andric for (size_t I = 0, E = Sources.size(); I < E; ++I) {
3280b57cec5SDimitry Andric if (TypoCorrection C = Sources[I]->CorrectTypo(Typo, LookupKind, S, SS, CCC,
3290b57cec5SDimitry Andric MemberContext,
3300b57cec5SDimitry Andric EnteringContext, OPT))
3310b57cec5SDimitry Andric return C;
3320b57cec5SDimitry Andric }
3330b57cec5SDimitry Andric return TypoCorrection();
3340b57cec5SDimitry Andric }
3350b57cec5SDimitry Andric
MaybeDiagnoseMissingCompleteType(SourceLocation Loc,QualType T)3360b57cec5SDimitry Andric bool MultiplexExternalSemaSource::MaybeDiagnoseMissingCompleteType(
3370b57cec5SDimitry Andric SourceLocation Loc, QualType T) {
3380b57cec5SDimitry Andric for (size_t I = 0, E = Sources.size(); I < E; ++I) {
3390b57cec5SDimitry Andric if (Sources[I]->MaybeDiagnoseMissingCompleteType(Loc, T))
3400b57cec5SDimitry Andric return true;
3410b57cec5SDimitry Andric }
3420b57cec5SDimitry Andric return false;
3430b57cec5SDimitry Andric }
34406c3fb27SDimitry Andric
AssignedLambdaNumbering(const CXXRecordDecl * Lambda)34506c3fb27SDimitry Andric void MultiplexExternalSemaSource::AssignedLambdaNumbering(
34606c3fb27SDimitry Andric const CXXRecordDecl *Lambda) {
34706c3fb27SDimitry Andric for (auto *Source : Sources)
34806c3fb27SDimitry Andric Source->AssignedLambdaNumbering(Lambda);
34906c3fb27SDimitry Andric }
350