[Modules] Cope better with top-level declarations loaded after being declared in...
authorDouglas Gregor <dgregor@apple.com>
Mon, 11 Feb 2013 18:16:18 +0000 (18:16 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 11 Feb 2013 18:16:18 +0000 (18:16 +0000)
commitdcf25087917305dec7fc0d7ff7d438882a6cb727
treeeb8a305bb272cb6d5472dca02f3c6712a4325936
parentc92c8f06ec0dcee0bf6cc035bcd3eba34d15cb44
[Modules] Cope better with top-level declarations loaded after being declared in the current translation unit <rdar://problem/13189985>.

These two related tweaks to keep the information associated with a
given identifier correct when the identifier has been given some
top-level information (say, a top-level declaration) and more
information is then loaded from a module. The first ensures that an
identifier that was "interesting" before being loaded from an AST is
considered to be different from its on-disk counterpart. Otherwise, we
lose such changes when writing the current translation unit as a
module.

Second, teach the code that injects AST-loaded names into the
identifier chain for name lookup to keep the most recent declaration,
so that we don't end up confusing our declaration chains by having a
different declaration in there.

llvm-svn: 174895
clang/lib/Sema/IdentifierResolver.cpp
clang/lib/Serialization/ASTReader.cpp
clang/test/Modules/Inputs/module.map
clang/test/Modules/Inputs/redecl-merge-bottom-prefix.h [new file with mode: 0644]
clang/test/Modules/Inputs/redecl-merge-bottom.h
clang/test/Modules/Inputs/redecl-merge-left.h
clang/test/Modules/redecl-merge2.m [new file with mode: 0644]