[ODRHash] Add basic support for CXXRecordDecl

llvm-svn: 296521
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index d8c2e20..78a3eec 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -194,6 +194,14 @@
 
     Inherited::VisitFieldDecl(D);
   }
+
+  void VisitFunctionDecl(const FunctionDecl *D) {
+    Inherited::VisitFunctionDecl(D);
+  }
+
+  void VisitCXXMethodDecl(const CXXMethodDecl *D) {
+    Inherited::VisitCXXMethodDecl(D);
+  }
 };
 
 // Only allow a small portion of Decl's to be processed.  Remove this once
@@ -206,6 +214,7 @@
     default:
       return false;
     case Decl::AccessSpec:
+    case Decl::CXXMethod:
     case Decl::Field:
     case Decl::StaticAssert:
       return true;
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 982f592..e9cb51d 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -8957,6 +8957,7 @@
         ProtectedSpecifer,
         StaticAssert,
         Field,
+        CXXMethod,
         Other
       } FirstDiffType = Other,
         SecondDiffType = Other;
@@ -8982,6 +8983,8 @@
           return StaticAssert;
         case Decl::Field:
           return Field;
+        case Decl::CXXMethod:
+          return CXXMethod;
         }
       };
 
@@ -9068,6 +9071,7 @@
         FieldSingleMutable,
         FieldSingleInitializer,
         FieldDifferentInitializers,
+        MethodName,
       };
 
       // These lambdas have the common portions of the ODR diagnostics.  This
@@ -9288,6 +9292,25 @@
 
         break;
       }
+      case CXXMethod: {
+        const CXXMethodDecl *FirstMethod = cast<CXXMethodDecl>(FirstDecl);
+        const CXXMethodDecl *SecondMethod = cast<CXXMethodDecl>(SecondDecl);
+        IdentifierInfo *FirstII = FirstMethod->getIdentifier();
+        IdentifierInfo *SecondII = SecondMethod->getIdentifier();
+        if (FirstII->getName() != SecondII->getName()) {
+          ODRDiagError(FirstMethod->getLocation(),
+                       FirstMethod->getSourceRange(), MethodName)
+              << FirstII;
+          ODRDiagNote(SecondMethod->getLocation(),
+                      SecondMethod->getSourceRange(), MethodName)
+              << SecondII;
+
+          Diagnosed = true;
+          break;
+        }
+
+        break;
+      }
       }
 
       if (Diagnosed == true)