[ODRHash] Add IdentiferInfo and FieldDecl support.

IdentifierInfo is hashed based on the stored string.  FieldDecl versus other
Decl is now detected, as well as differently named fields.

Differential Revision: https://reviews.llvm.org/D21675

llvm-svn: 295911
diff --git a/clang/test/Modules/odr_hash.cpp b/clang/test/Modules/odr_hash.cpp
index 652e74f..2b2a788 100644
--- a/clang/test/Modules/odr_hash.cpp
+++ b/clang/test/Modules/odr_hash.cpp
@@ -115,6 +115,41 @@
 #endif
 }
 
+namespace Field {
+#if defined(FIRST)
+struct S1 {
+  int x;
+  private:
+  int y;
+};
+#elif defined(SECOND)
+struct S1 {
+  int x;
+  int y;
+};
+#else
+S1 s1;
+// expected-error@second.h:* {{'Field::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found field}}
+// expected-note@first.h:* {{but in 'FirstModule' found private access specifier}}
+#endif
+
+#if defined(FIRST)
+struct S2 {
+  int x;
+  int y;
+};
+#elif defined(SECOND)
+struct S2 {
+  int y;
+  int x;
+};
+#else
+S2 s2;
+// expected-error@second.h:* {{'Field::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'y'}}
+// expected-note@first.h:* {{but in 'FirstModule' found field 'x'}}
+#endif
+}  // namespace Field
+
 // Naive parsing of AST can lead to cycles in processing.  Ensure
 // self-references don't trigger an endless cycles of AST node processing.
 namespace SelfReference {
@@ -151,6 +186,9 @@
 
   static_assert(1 == 1, "Message");
   static_assert(2 == 2);
+
+  int x;
+  double y;
 };
 #elif defined(SECOND)
 struct S {
@@ -160,6 +198,9 @@
 
   static_assert(1 == 1, "Message");
   static_assert(2 == 2);
+
+  int x;
+  double y;
 };
 #else
 S s;
@@ -174,6 +215,9 @@
   static_assert(1 == 1, "Message");
   static_assert(2 == 2);
 
+  int x;
+  double y;
+
   private:
 };
 #elif defined(SECOND)
@@ -185,6 +229,9 @@
   static_assert(1 == 1, "Message");
   static_assert(2 == 2);
 
+  int x;
+  double y;
+
   public:
 };
 #else