diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-22 21:40:42 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-22 21:40:42 +0000 |
commit | 464b0ca61a558d359795a3e4aa1ae5924ac571d5 (patch) | |
tree | e664a409d2686a5594f04b6172aba4aacad3d488 /clang/lib/Serialization/ASTReader.cpp | |
parent | 6ca42c5be376d466d9f268dd2ada5a7438bc66d7 (diff) | |
download | bcm5719-llvm-464b0ca61a558d359795a3e4aa1ae5924ac571d5.tar.gz bcm5719-llvm-464b0ca61a558d359795a3e4aa1ae5924ac571d5.zip |
Serialize the AST reader's mapping from canonical declarations to the
set of (previously-canonical) declaration IDs to the module file, so
that future AST reader instances that load the module know which
declarations are merged. This is important in the fairly tricky case
where a declaration of an entity, e.g.,
@class X;
occurs before the import of a module that also declares that
entity. We merge the declarations, and record the fact that the
declaration of X loaded from the module was merged into the (now
canonical) declaration of X that we parsed.
llvm-svn: 147181
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 2ac1908ee2f..440474b587a 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2407,6 +2407,16 @@ ASTReader::ReadASTBlock(ModuleFile &F) { F.RedeclarationsInfo = (const LocalRedeclarationsInfo *)BlobStart; break; } + + case MERGED_DECLARATIONS: { + for (unsigned Idx = 0; Idx < Record.size(); /* increment in loop */) { + GlobalDeclID CanonID = getGlobalDeclID(F, Record[Idx++]); + SmallVectorImpl<GlobalDeclID> &Decls = StoredMergedDecls[CanonID]; + for (unsigned N = Record[Idx++]; N > 0; --N) + Decls.push_back(getGlobalDeclID(F, Record[Idx++])); + } + break; + } } } Error("premature end of bitstream in AST file"); |