When deserializing the definition of a C++ class/ObjC class/ObjC
protocol, record the definition pointer in the canonical declaration
for that entity, and then propagate that definition pointer from the
canonical declaration to all other deserialized declarations. This
approach works well even when deserializing declarations that didn't
know about the original definition, which can occur with modules.

A nice bonus from this definition-deserialization approach is that we
no longer need update records when a definition is added, because the
redeclaration chains ensure that the if any declaration is loaded, the
definition will also get loaded.

llvm-svn: 148223
diff --git a/clang/test/Modules/Inputs/redecl-merge-left-left.h b/clang/test/Modules/Inputs/redecl-merge-left-left.h
index 6126081..79c4d62 100644
--- a/clang/test/Modules/Inputs/redecl-merge-left-left.h
+++ b/clang/test/Modules/Inputs/redecl-merge-left-left.h
@@ -3,3 +3,5 @@
 @class C4;
 void accept_a_C4(C4*);
 
+@class ClassWithDef;
+
diff --git a/clang/test/Modules/Inputs/redecl-merge-right.h b/clang/test/Modules/Inputs/redecl-merge-right.h
index 86a3993..113ff22 100644
--- a/clang/test/Modules/Inputs/redecl-merge-right.h
+++ b/clang/test/Modules/Inputs/redecl-merge-right.h
@@ -88,3 +88,7 @@
 int ONE;
 @import redecl_merge_top.Explicit;
 const int one = ONE;
+
+@interface ClassWithDef 
+- (void)method;
+@end
diff --git a/clang/test/Modules/redecl-merge.m b/clang/test/Modules/redecl-merge.m
index cb44a13..591c4a2 100644
--- a/clang/test/Modules/redecl-merge.m
+++ b/clang/test/Modules/redecl-merge.m
@@ -110,6 +110,9 @@
 }
 
 C4 *global_C4;
+
+ClassWithDef *cwd1;
+
 @import redecl_merge_left_left;
 
 void test_C4a(C4 *c4) {
@@ -117,6 +120,10 @@
   accept_a_C4(c4);
 }
 
+void test_ClassWithDef(ClassWithDef *cwd) {
+  [cwd method];
+}
+
 @import redecl_merge_bottom;
 
 void test_C4b() {