forked from OSchip/llvm-project
Avoid writing a VTABLE_USES record in PCH if there are no entries.
llvm-svn: 110122
This commit is contained in:
parent
052c23cd2f
commit
edee67f335
|
@ -3133,13 +3133,15 @@ void PCHReader::InitializeSema(Sema &S) {
|
|||
|
||||
// If there were any VTable uses, deserialize the information and add it
|
||||
// to Sema's vector and map of VTable uses.
|
||||
unsigned Idx = 0;
|
||||
for (unsigned I = 0, N = VTableUses[Idx++]; I != N; ++I) {
|
||||
CXXRecordDecl *Class = cast<CXXRecordDecl>(GetDecl(VTableUses[Idx++]));
|
||||
SourceLocation Loc = ReadSourceLocation(VTableUses, Idx);
|
||||
bool DefinitionRequired = VTableUses[Idx++];
|
||||
SemaObj->VTableUses.push_back(std::make_pair(Class, Loc));
|
||||
SemaObj->VTablesUsed[Class] = DefinitionRequired;
|
||||
if (!VTableUses.empty()) {
|
||||
unsigned Idx = 0;
|
||||
for (unsigned I = 0, N = VTableUses[Idx++]; I != N; ++I) {
|
||||
CXXRecordDecl *Class = cast<CXXRecordDecl>(GetDecl(VTableUses[Idx++]));
|
||||
SourceLocation Loc = ReadSourceLocation(VTableUses, Idx);
|
||||
bool DefinitionRequired = VTableUses[Idx++];
|
||||
SemaObj->VTableUses.push_back(std::make_pair(Class, Loc));
|
||||
SemaObj->VTablesUsed[Class] = DefinitionRequired;
|
||||
}
|
||||
}
|
||||
|
||||
// If there were any dynamic classes declarations, deserialize them
|
||||
|
|
|
@ -2196,11 +2196,13 @@ void PCHWriter::WritePCHCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
|
|||
|
||||
// Build a record containing all of the VTable uses information.
|
||||
RecordData VTableUses;
|
||||
VTableUses.push_back(SemaRef.VTableUses.size());
|
||||
for (unsigned I = 0, N = SemaRef.VTableUses.size(); I != N; ++I) {
|
||||
AddDeclRef(SemaRef.VTableUses[I].first, VTableUses);
|
||||
AddSourceLocation(SemaRef.VTableUses[I].second, VTableUses);
|
||||
VTableUses.push_back(SemaRef.VTablesUsed[SemaRef.VTableUses[I].first]);
|
||||
if (!SemaRef.VTableUses.empty()) {
|
||||
VTableUses.push_back(SemaRef.VTableUses.size());
|
||||
for (unsigned I = 0, N = SemaRef.VTableUses.size(); I != N; ++I) {
|
||||
AddDeclRef(SemaRef.VTableUses[I].first, VTableUses);
|
||||
AddSourceLocation(SemaRef.VTableUses[I].second, VTableUses);
|
||||
VTableUses.push_back(SemaRef.VTablesUsed[SemaRef.VTableUses[I].first]);
|
||||
}
|
||||
}
|
||||
|
||||
// Build a record containing all of dynamic classes declarations.
|
||||
|
|
Loading…
Reference in New Issue