diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-08-07 21:17:33 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-08-07 21:17:33 +0000 |
| commit | acfbbd77f80c012707c6ed5ebe1a5be35778c41d (patch) | |
| tree | fb6b44fc9f6c1c7f08e92f47e9ed74832b3c836a /clang/lib/Serialization | |
| parent | 7af8baf678f7e9590f80d82327676aa3b43ba7a7 (diff) | |
| download | bcm5719-llvm-acfbbd77f80c012707c6ed5ebe1a5be35778c41d.tar.gz bcm5719-llvm-acfbbd77f80c012707c6ed5ebe1a5be35778c41d.zip | |
[PCH] Fix a PCH serialization crash, with invalid code related to forward enum references.
The problem was that an enum without closing semicolon could be associated as a forward enum
in an erroneous declaration, leading to the identifier being associated with the enum decl but
without a declaration actually referencing it.
This resulted in not having it serialized before serializing the identifier that is associated with.
Also prevent the ASTUnit from querying the serialized DeclID for an invalid top-level decl; it may not
have been serialized.
rdar://14539667
llvm-svn: 187914
Diffstat (limited to 'clang/lib/Serialization')
| -rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 142e7b12671..ad3e42bce77 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -4047,6 +4047,21 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, GetDeclRef(*I); } + // Make sure all decls associated with an identifier are registered for + // serialization. + for (IdentifierTable::iterator ID = PP.getIdentifierTable().begin(), + IDEnd = PP.getIdentifierTable().end(); + ID != IDEnd; ++ID) { + const IdentifierInfo *II = ID->second; + if (!Chain || !II->isFromAST() || II->hasChangedSinceDeserialization()) { + for (IdentifierResolver::iterator D = SemaRef.IdResolver.begin(II), + DEnd = SemaRef.IdResolver.end(); + D != DEnd; ++D) { + GetDeclRef(*D); + } + } + } + // Resolve any declaration pointers within the declaration updates block. ResolveDeclUpdatesBlocks(); |

