[modules] Defer setting up the lookup table for a DeclContext until we can
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 6 Aug 2015 04:23:48 +0000 (04:23 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 6 Aug 2015 04:23:48 +0000 (04:23 +0000)
commit0f4e2c4d0f46b5edb4159b2d982327475b797efe
treec893a8277ae403c41609130361a3d4d2fe141a6c
parent9b000812a44316016abe214ae98212b3cdd079fc
[modules] Defer setting up the lookup table for a DeclContext until we can
determine the primary context, rather than sometimes registering the lookup
table on the wrong context.

This exposed a couple of bugs:
 * the odr violation check didn't deal properly with mergeable declarations
   if the declaration retained by name lookup wasn't in the canonical
   definition of the class
 * the (broken) RewriteDecl mechanism would emit two name lookup tables for
   the same DeclContext into the same module file (one as part of the
   rewritten declaration and one as a visible update for the old declaration)
These are both fixed too.

llvm-svn: 244192
clang/include/clang/Serialization/ASTReader.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriter.cpp