]> granicus.if.org Git - clang/commit
[PCH] Make sure that all newly introduced visible decls in a DeclContext
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 2 Jul 2012 19:19:01 +0000 (19:19 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 2 Jul 2012 19:19:01 +0000 (19:19 +0000)
commit7518b3784ed2176aad8dcabe0685c6e02c5f1043
treeb9782da9740af265c7b04c60195cd689fe1ebb4a
parent139be7007eba3bd491ca50297888be507753a95d
[PCH] Make sure that all newly introduced visible decls in a DeclContext
coming from an AST file are registered for serialization.

A static data member instantiation of in a chained PCH could be missed
when serializing decls; the result was that when emitting the visible decls
map of its DeclContext, we would use a DeclID that was not actually emitted,
leading to crashes or hangs.

Fix this by making sure such decls are always registered for serialization.
Also introduce extra sanity checks to make sure we don't register new
declarations or types after we have serialized the types/decls block.

rdar://11728990

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159550 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Serialization/ASTWriter.h
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTWriter.cpp
test/PCH/chain-staticvar-instantiation.cpp [new file with mode: 0644]