зеркало из https://github.com/microsoft/clang-1.git
Make Sema::ReferencedSelectors lazily deserialized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136357 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
8451ec7e70
Коммит
5b9dc7caae
|
@ -125,7 +125,17 @@ public:
|
||||||
/// to introduce the same declarations repeatedly.
|
/// to introduce the same declarations repeatedly.
|
||||||
virtual void ReadLocallyScopedExternalDecls(
|
virtual void ReadLocallyScopedExternalDecls(
|
||||||
SmallVectorImpl<NamedDecl *> &Decls) {}
|
SmallVectorImpl<NamedDecl *> &Decls) {}
|
||||||
|
|
||||||
|
/// \brief Read the set of referenced selectors known to the
|
||||||
|
/// external Sema source.
|
||||||
|
///
|
||||||
|
/// The external source should append its own referenced selectors to the
|
||||||
|
/// given vector of declarations. Note that this routine
|
||||||
|
/// may be invoked multiple times; the external source should take care not
|
||||||
|
/// to introduce the same selectors repeatedly.
|
||||||
|
virtual void ReadReferencedSelectors(
|
||||||
|
SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels) {}
|
||||||
|
|
||||||
// isa/cast/dyn_cast support
|
// isa/cast/dyn_cast support
|
||||||
static bool classof(const ExternalASTSource *Source) {
|
static bool classof(const ExternalASTSource *Source) {
|
||||||
return Source->SemaSource;
|
return Source->SemaSource;
|
||||||
|
|
|
@ -1391,6 +1391,9 @@ public:
|
||||||
virtual void ReadLocallyScopedExternalDecls(
|
virtual void ReadLocallyScopedExternalDecls(
|
||||||
SmallVectorImpl<NamedDecl *> &Decls);
|
SmallVectorImpl<NamedDecl *> &Decls);
|
||||||
|
|
||||||
|
virtual void ReadReferencedSelectors(
|
||||||
|
SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels);
|
||||||
|
|
||||||
/// \brief Load a selector from disk, registering its ID if it exists.
|
/// \brief Load a selector from disk, registering its ID if it exists.
|
||||||
void LoadSelector(Selector Sel);
|
void LoadSelector(Selector Sel);
|
||||||
|
|
||||||
|
|
|
@ -2765,6 +2765,14 @@ void Sema::CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI,
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::DiagnoseUseOfUnimplementedSelectors() {
|
void Sema::DiagnoseUseOfUnimplementedSelectors() {
|
||||||
|
// Load referenced selectors from the external source.
|
||||||
|
if (ExternalSource) {
|
||||||
|
SmallVector<std::pair<Selector, SourceLocation>, 4> Sels;
|
||||||
|
ExternalSource->ReadReferencedSelectors(Sels);
|
||||||
|
for (unsigned I = 0, N = Sels.size(); I != N; ++I)
|
||||||
|
ReferencedSelectors[Sels[I].first] = Sels[I].second;
|
||||||
|
}
|
||||||
|
|
||||||
// Warning will be issued only when selector table is
|
// Warning will be issued only when selector table is
|
||||||
// generated (which means there is at lease one implementation
|
// generated (which means there is at lease one implementation
|
||||||
// in the TU). This is to match gcc's behavior.
|
// in the TU). This is to match gcc's behavior.
|
||||||
|
|
|
@ -4366,19 +4366,6 @@ void ASTReader::InitializeSema(Sema &S) {
|
||||||
SemaObj->StdBadAlloc = SemaDeclRefs[1];
|
SemaObj->StdBadAlloc = SemaDeclRefs[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are @selector references added them to its pool. This is for
|
|
||||||
// implementation of -Wselector.
|
|
||||||
if (!ReferencedSelectorsData.empty()) {
|
|
||||||
unsigned int DataSize = ReferencedSelectorsData.size()-1;
|
|
||||||
unsigned I = 0;
|
|
||||||
while (I < DataSize) {
|
|
||||||
Selector Sel = DecodeSelector(ReferencedSelectorsData[I++]);
|
|
||||||
SourceLocation SelLoc
|
|
||||||
= SourceLocation::getFromRawEncoding(ReferencedSelectorsData[I++]);
|
|
||||||
SemaObj->ReferencedSelectors.insert(std::make_pair(Sel, SelLoc));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The special data sets below always come from the most recent PCH,
|
// The special data sets below always come from the most recent PCH,
|
||||||
// which is at the front of the chain.
|
// which is at the front of the chain.
|
||||||
Module &F = ModuleMgr.getPrimaryModule();
|
Module &F = ModuleMgr.getPrimaryModule();
|
||||||
|
@ -4617,6 +4604,24 @@ ASTReader::ReadLocallyScopedExternalDecls(SmallVectorImpl<NamedDecl *> &Decls) {
|
||||||
LocallyScopedExternalDecls.clear();
|
LocallyScopedExternalDecls.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ASTReader::ReadReferencedSelectors(
|
||||||
|
SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels) {
|
||||||
|
if (ReferencedSelectorsData.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// If there are @selector references added them to its pool. This is for
|
||||||
|
// implementation of -Wselector.
|
||||||
|
unsigned int DataSize = ReferencedSelectorsData.size()-1;
|
||||||
|
unsigned I = 0;
|
||||||
|
while (I < DataSize) {
|
||||||
|
Selector Sel = DecodeSelector(ReferencedSelectorsData[I++]);
|
||||||
|
SourceLocation SelLoc
|
||||||
|
= SourceLocation::getFromRawEncoding(ReferencedSelectorsData[I++]);
|
||||||
|
Sels.push_back(std::make_pair(Sel, SelLoc));
|
||||||
|
}
|
||||||
|
ReferencedSelectorsData.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void ASTReader::LoadSelector(Selector Sel) {
|
void ASTReader::LoadSelector(Selector Sel) {
|
||||||
// It would be complicated to avoid reading the methods anyway. So don't.
|
// It would be complicated to avoid reading the methods anyway. So don't.
|
||||||
ReadMethodPool(Sel);
|
ReadMethodPool(Sel);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче