diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-08-03 17:29:52 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-08-03 17:29:52 +0000 |
commit | edee67f335b53f53e7939034f0bd3025b0fc9c9d (patch) | |
tree | d30a79f3825e9dac26858ef0160ab1dfe6f179a8 /clang/lib/Frontend | |
parent | 052c23cd2f1d1083a8c73be7d4d1b7c0e79e19f4 (diff) | |
download | bcm5719-llvm-edee67f335b53f53e7939034f0bd3025b0fc9c9d.tar.gz bcm5719-llvm-edee67f335b53f53e7939034f0bd3025b0fc9c9d.zip |
Avoid writing a VTABLE_USES record in PCH if there are no entries.
llvm-svn: 110122
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r-- | clang/lib/Frontend/PCHReader.cpp | 16 | ||||
-rw-r--r-- | clang/lib/Frontend/PCHWriter.cpp | 12 |
2 files changed, 16 insertions, 12 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp index d5cf75ce3ba..b415f8dea54 100644 --- a/clang/lib/Frontend/PCHReader.cpp +++ b/clang/lib/Frontend/PCHReader.cpp @@ -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 diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp index 971f5e8fb2c..75592a41c85 100644 --- a/clang/lib/Frontend/PCHWriter.cpp +++ b/clang/lib/Frontend/PCHWriter.cpp @@ -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. |