Without the fix ivars with anonymous types can trigger errors like
error: 'TestClass::structIvar' from module 'Target' is not present in definition of 'TestClass' provided earlier
[...]
note: declaration of 'structIvar' does not match
It happens because types of ivars from different modules are considered
to be different. And it is caused by not merging anonymous TagDecl
from different modules.
To fix that I've changed serialization::needsAnonymousDeclarationNumber
to handle anonymous TagDecl inside ObjCInterfaceDecl. But that's not
sufficient as C code inside ObjCInterfaceDecl doesn't use interface
decl as a decl context but switches to its parent (TranslationUnit in
most cases). I'm changing that to make ObjCContainerDecl the lexical
decl context but keeping the semantic decl context intact.
Test "check-dup-decls-inside-objc.m" doesn't reflect a change in
functionality but captures the existing behavior to prevent regressions.
rdar://85563013
clang-format: please reformat the code