]> granicus.if.org Git - clang/commit
[modules] Fix bug where an anonymous namespace could cause the containing
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 17 Mar 2015 02:23:11 +0000 (02:23 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 17 Mar 2015 02:23:11 +0000 (02:23 +0000)
commite146d8df5bebd293af10c6513319106f0b3713f1
tree38a10f21cff1df4f70b8fde7186feada9cc4f768
parent55d9d4a934eacffbcfbd3073b71aeacf6c576d38
[modules] Fix bug where an anonymous namespace could cause the containing
namespace to not merge properly.

We have an invariant here: after a declaration reads its canonical declaration,
it can assume the canonical declaration is fully merged. This invariant can be
violated if deserializing some declaration triggers the deserialization of a
later declaration, because that later declaration can in turn deserialize a
redeclaration of that first declaration before it is fully merged.

The anonymous namespace for a namespace gets stored with the first declaration
of that namespace, which may be before its parent namespace, so defer loading
it until after we've finished merging the surrounding namespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232455 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Serialization/ASTReaderDecl.cpp
test/Modules/Inputs/anon-namespace/a.h [new file with mode: 0644]
test/Modules/Inputs/anon-namespace/b1.h [new file with mode: 0644]
test/Modules/Inputs/anon-namespace/b2.h [new file with mode: 0644]
test/Modules/Inputs/anon-namespace/c.h [new file with mode: 0644]
test/Modules/Inputs/anon-namespace/module.modulemap [new file with mode: 0644]
test/Modules/anon-namespace.cpp [new file with mode: 0644]