aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-07-27 00:17:23 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-07-27 00:17:23 +0000
commit681d7237e1014bf64dd5ead6bf74ae55cdd19e61 (patch)
treeea54ca8f9269e79c717882fd7aef9d6473a71894 /lib/Frontend/PCHReader.cpp
parent3e15e0a7b4da6d906357b00b1bd2bba5ec3195ed (diff)
- Fix recording of offsets of types in dependent PCHs.
- Stop reading in (and thus deserializing) every declaration in the TU when creating a dependent PCH. - Switch the storage of a decl context's lexical declarations to a blob containing the IDs instead of a record. This is the only sane way of supporting update records later on. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReader.cpp')
-rw-r--r--lib/Frontend/PCHReader.cpp29
1 files changed, 7 insertions, 22 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 8a6108951d..f454477c50 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -1634,8 +1634,8 @@ PCHReader::ReadPCHBlock(PerFileData &F) {
unsigned int numEl = Record[0]*2;
for (unsigned int i = 1; i <= numEl; i++)
F.ReferencedSelectorsData.push_back(Record[i]);
- }
break;
+ }
case pch::PP_COUNTER_VALUE:
if (!Record.empty() && Listener)
@@ -2896,30 +2896,15 @@ bool PCHReader::FindExternalLexicalDecls(const DeclContext *DC,
DeclContextInfos &Infos = DeclContextOffsets[DC];
for (DeclContextInfos::iterator I = Infos.begin(), E = Infos.end();
I != E; ++I) {
- uint64_t Offset = I->OffsetToLexicalDecls;
- // Offset can be 0 if this file only contains visible decls.
- if (Offset == 0)
+ // IDs can be 0 if this context doesn't contain declarations.
+ if (!I->LexicalDecls)
continue;
- llvm::BitstreamCursor &DeclsCursor = *I->Stream;
-
- // Keep track of where we are in the stream, then jump back there
- // after reading this context.
- SavedStreamPosition SavedPosition(DeclsCursor);
-
- // Load the record containing all of the declarations lexically in
- // this context.
- DeclsCursor.JumpToBit(Offset);
- RecordData Record;
- unsigned Code = DeclsCursor.ReadCode();
- unsigned RecCode = DeclsCursor.ReadRecord(Code, Record);
- if (RecCode != pch::DECL_CONTEXT_LEXICAL) {
- Error("Expected lexical block");
- return true;
- }
// Load all of the declaration IDs
- for (RecordData::iterator J = Record.begin(), F = Record.end(); J != F; ++J)
- Decls.push_back(GetDecl(*J));
+ for (const pch::DeclID *ID = I->LexicalDecls,
+ *IDE = ID + I->NumLexicalDecls;
+ ID != IDE; ++ID)
+ Decls.push_back(GetDecl(*ID));
}
++NumLexicalDeclContextsRead;