With the old approach we were updating ObjCInterfaceType.Decl to the
last encountered definition. But during loading modules
ASTDeclReader::VisitObjCInterfaceDecl keeps the *first* encountered
definition. So with multiple definitions imported there would be a
disagreement between expected definition in ObjCInterfaceType.Decl and
actual definition ObjCInterfaceDecl::getDefinition which can lead to
incorrect diagnostic.
Fix by not tracking definition in ObjCInterfaceType explicitly but by
getting it from redeclaration chain.
Partially reverted 919fc50034b44c48aae8b80283f253ec2ee17f45 keeping the
modified test case as the correct behavior is achieved in a different
way.
Tracking a type per decl is complementary to tracking decl per type and it looks potentially bug-prone. But I haven't noticed any problems with it and haven't tried to remove TypeForDecl. If anybody has any extra information on it, we can schedule subsequent fixes.