r307743 - [ODRHash] Revert r307720 to fix buildbot.

Richard Trieu via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 11 17:38:27 PDT 2017


Author: rtrieu
Date: Tue Jul 11 17:38:27 2017
New Revision: 307743

URL: http://llvm.org/viewvc/llvm-project?rev=307743&view=rev
Log:
[ODRHash] Revert r307720 to fix buildbot.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
    cfe/trunk/lib/AST/ODRHash.cpp
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/test/Modules/odr_hash.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=307743&r1=307742&r2=307743&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Tue Jul 11 17:38:27 2017
@@ -147,29 +147,18 @@ def err_module_odr_violation_mismatch_de
   "%select{non-|}5mutable field %4|"
   "field %4 with %select{no|an}5 initalizer|"
   "field %4 with an initializer|"
-  "%select{method %5|constructor|destructor}4|"
-  "%select{method %5|constructor|destructor}4 "
-    "is %select{not deleted|deleted}6|"
-  "%select{method %5|constructor|destructor}4 "
-    "is %select{|pure }6%select{not virtual|virtual}7|"
-  "%select{method %5|constructor|destructor}4 "
-    "is %select{not static|static}6|"
-  "%select{method %5|constructor|destructor}4 "
-    "is %select{not volatile|volatile}6|"
-  "%select{method %5|constructor|destructor}4 "
-    "is %select{not const|const}6|"
-  "%select{method %5|constructor|destructor}4 "
-    "is %select{not inline|inline}6|"
-  "%select{method %5|constructor|destructor}4 "
-    "that has %6 parameter%s6|"
-  "%select{method %5|constructor|destructor}4 "
-    "with %ordinal6 parameter of type %7%select{| decayed from %9}8|"
-  "%select{method %5|constructor|destructor}4 "
-    "with %ordinal6 parameter named %7|"
-  "%select{method %5|constructor|destructor}4 "
-    "with %ordinal6 parameter with%select{out|}7 a default argument|"
-  "%select{method %5|constructor|destructor}4 "
-    "with %ordinal6 parameter with a default argument|"
+  "method %4|"
+  "method %4 is %select{not deleted|deleted}5|"
+  "method %4 is %select{|pure }5%select{not virtual|virtual}6|"
+  "method %4 is %select{not static|static}5|"
+  "method %4 is %select{not volatile|volatile}5|"
+  "method %4 is %select{not const|const}5|"
+  "method %4 is %select{not inline|inline}5|"
+  "method %4 that has %5 parameter%s5|"
+  "method %4 with %ordinal5 parameter of type %6%select{| decayed from %8}7|"
+  "method %4 with %ordinal5 parameter named %6|"
+  "method %4 with %ordinal5 parameter with%select{out|}6 a default argument|"
+  "method %4 with %ordinal5 parameter with a default argument|"
   "%select{typedef|type alias}4 name %5|"
   "%select{typedef|type alias}4 %5 with underlying type %6|"
   "data member with name %4|"
@@ -194,29 +183,18 @@ def note_module_odr_violation_mismatch_d
   "%select{non-|}3mutable field %2|"
   "field %2 with %select{no|an}3 initializer|"
   "field %2 with a different initializer|"
-  "%select{method %3|constructor|destructor}2|"
-  "%select{method %3|constructor|destructor}2 "
-    "is %select{not deleted|deleted}4|"
-  "%select{method %3|constructor|destructor}2 "
-    "is %select{|pure }4%select{not virtual|virtual}5|"
-  "%select{method %3|constructor|destructor}2 "
-    "is %select{not static|static}4|"
-  "%select{method %3|constructor|destructor}2 "
-    "is %select{not volatile|volatile}4|"
-  "%select{method %3|constructor|destructor}2 "
-    "is %select{not const|const}4|"
-  "%select{method %3|constructor|destructor}2 "
-    "is %select{not inline|inline}4|"
-  "%select{method %3|constructor|destructor}2 "
-    "that has %4 parameter%s4|"
-  "%select{method %3|constructor|destructor}2 "
-    "with %ordinal4 parameter of type %5%select{| decayed from %7}6|"
-  "%select{method %3|constructor|destructor}2 "
-    "with %ordinal4 parameter named %5|"
-  "%select{method %3|constructor|destructor}2 "
-    "with %ordinal4 parameter with%select{out|}5 a default argument|"
-  "%select{method %3|constructor|destructor}2 "
-    "with %ordinal4 parameter with a different default argument|"
+  "method %2|"
+  "method %2 is %select{not deleted|deleted}3|"
+  "method %2 is %select{|pure }3%select{not virtual|virtual}4|"
+  "method %2 is %select{not static|static}3|"
+  "method %2 is %select{not volatile|volatile}3|"
+  "method %2 is %select{not const|const}3|"
+  "method %2 is %select{not inline|inline}3|"
+  "method %2 that has %3 parameter%s3|"
+  "method %2 with %ordinal3 parameter of type %4%select{| decayed from %6}5|"
+  "method %2 with %ordinal3 parameter named %4|"
+  "method %2 with %ordinal3 parameter with%select{out|}4 a default argument|"
+  "method %2 with %ordinal3 parameter with a different default argument|"
   "%select{typedef|type alias}2 name %3|"
   "%select{typedef|type alias}2 %3 with different underlying type %4|"
   "data member with name %2|"

Modified: cfe/trunk/lib/AST/ODRHash.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=307743&r1=307742&r2=307743&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ODRHash.cpp (original)
+++ cfe/trunk/lib/AST/ODRHash.cpp Tue Jul 11 17:38:27 2017
@@ -350,8 +350,6 @@ bool ODRHash::isWhitelistedDecl(const De
     default:
       return false;
     case Decl::AccessSpec:
-    case Decl::CXXConstructor:
-    case Decl::CXXDestructor:
     case Decl::CXXMethod:
     case Decl::Field:
     case Decl::Friend:

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=307743&r1=307742&r2=307743&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Tue Jul 11 17:38:27 2017
@@ -9341,8 +9341,6 @@ void ASTReader::diagnoseOdrViolations()
         case Decl::Field:
           return Field;
         case Decl::CXXMethod:
-        case Decl::CXXConstructor:
-        case Decl::CXXDestructor:
           return CXXMethod;
         case Decl::TypeAlias:
           return TypeAlias;
@@ -9671,30 +9669,17 @@ void ASTReader::diagnoseOdrViolations()
         break;
       }
       case CXXMethod: {
-        enum {
-          DiagMethod,
-          DiagConstructor,
-          DiagDestructor,
-        } FirstMethodType,
-            SecondMethodType;
-        auto GetMethodTypeForDiagnostics = [](const CXXMethodDecl* D) {
-          if (isa<CXXConstructorDecl>(D)) return DiagConstructor;
-          if (isa<CXXDestructorDecl>(D)) return DiagDestructor;
-          return DiagMethod;
-        };
         const CXXMethodDecl *FirstMethod = cast<CXXMethodDecl>(FirstDecl);
         const CXXMethodDecl *SecondMethod = cast<CXXMethodDecl>(SecondDecl);
-        FirstMethodType = GetMethodTypeForDiagnostics(FirstMethod);
-        SecondMethodType = GetMethodTypeForDiagnostics(SecondMethod);
         auto FirstName = FirstMethod->getDeclName();
         auto SecondName = SecondMethod->getDeclName();
-        if (FirstMethodType != SecondMethodType || FirstName != SecondName) {
+        if (FirstName != SecondName) {
           ODRDiagError(FirstMethod->getLocation(),
                        FirstMethod->getSourceRange(), MethodName)
-              << FirstMethodType << FirstName;
+              << FirstName;
           ODRDiagNote(SecondMethod->getLocation(),
                       SecondMethod->getSourceRange(), MethodName)
-              << SecondMethodType << SecondName;
+              << SecondName;
 
           Diagnosed = true;
           break;
@@ -9705,11 +9690,11 @@ void ASTReader::diagnoseOdrViolations()
         if (FirstDeleted != SecondDeleted) {
           ODRDiagError(FirstMethod->getLocation(),
                        FirstMethod->getSourceRange(), MethodDeleted)
-              << FirstMethodType << FirstName << FirstDeleted;
+              << FirstName << FirstDeleted;
 
           ODRDiagNote(SecondMethod->getLocation(),
                       SecondMethod->getSourceRange(), MethodDeleted)
-              << SecondMethodType << SecondName << SecondDeleted;
+              << SecondName << SecondDeleted;
           Diagnosed = true;
           break;
         }
@@ -9722,10 +9707,10 @@ void ASTReader::diagnoseOdrViolations()
             (FirstVirtual != SecondVirtual || FirstPure != SecondPure)) {
           ODRDiagError(FirstMethod->getLocation(),
                        FirstMethod->getSourceRange(), MethodVirtual)
-              << FirstMethodType << FirstName << FirstPure << FirstVirtual;
+              << FirstName << FirstPure << FirstVirtual;
           ODRDiagNote(SecondMethod->getLocation(),
                       SecondMethod->getSourceRange(), MethodVirtual)
-              << SecondMethodType << SecondName << SecondPure << SecondVirtual;
+              << SecondName << SecondPure << SecondVirtual;
           Diagnosed = true;
           break;
         }
@@ -9740,10 +9725,10 @@ void ASTReader::diagnoseOdrViolations()
         if (FirstStatic != SecondStatic) {
           ODRDiagError(FirstMethod->getLocation(),
                        FirstMethod->getSourceRange(), MethodStatic)
-              << FirstMethodType << FirstName << FirstStatic;
+              << FirstName << FirstStatic;
           ODRDiagNote(SecondMethod->getLocation(),
                       SecondMethod->getSourceRange(), MethodStatic)
-              << SecondMethodType << SecondName << SecondStatic;
+              << SecondName << SecondStatic;
           Diagnosed = true;
           break;
         }
@@ -9753,10 +9738,10 @@ void ASTReader::diagnoseOdrViolations()
         if (FirstVolatile != SecondVolatile) {
           ODRDiagError(FirstMethod->getLocation(),
                        FirstMethod->getSourceRange(), MethodVolatile)
-              << FirstMethodType << FirstName << FirstVolatile;
+              << FirstName << FirstVolatile;
           ODRDiagNote(SecondMethod->getLocation(),
                       SecondMethod->getSourceRange(), MethodVolatile)
-              << SecondMethodType << SecondName << SecondVolatile;
+              << SecondName << SecondVolatile;
           Diagnosed = true;
           break;
         }
@@ -9766,10 +9751,10 @@ void ASTReader::diagnoseOdrViolations()
         if (FirstConst != SecondConst) {
           ODRDiagError(FirstMethod->getLocation(),
                        FirstMethod->getSourceRange(), MethodConst)
-              << FirstMethodType << FirstName << FirstConst;
+              << FirstName << FirstConst;
           ODRDiagNote(SecondMethod->getLocation(),
                       SecondMethod->getSourceRange(), MethodConst)
-              << SecondMethodType << SecondName << SecondConst;
+              << SecondName << SecondConst;
           Diagnosed = true;
           break;
         }
@@ -9779,10 +9764,10 @@ void ASTReader::diagnoseOdrViolations()
         if (FirstInline != SecondInline) {
           ODRDiagError(FirstMethod->getLocation(),
                        FirstMethod->getSourceRange(), MethodInline)
-              << FirstMethodType << FirstName << FirstInline;
+              << FirstName << FirstInline;
           ODRDiagNote(SecondMethod->getLocation(),
                       SecondMethod->getSourceRange(), MethodInline)
-              << SecondMethodType << SecondName << SecondInline;
+              << SecondName << SecondInline;
           Diagnosed = true;
           break;
         }
@@ -9792,10 +9777,10 @@ void ASTReader::diagnoseOdrViolations()
         if (FirstNumParameters != SecondNumParameters) {
           ODRDiagError(FirstMethod->getLocation(),
                        FirstMethod->getSourceRange(), MethodNumberParameters)
-              << FirstMethodType << FirstName << FirstNumParameters;
+              << FirstName << FirstNumParameters;
           ODRDiagNote(SecondMethod->getLocation(),
                       SecondMethod->getSourceRange(), MethodNumberParameters)
-              << SecondMethodType << SecondName << SecondNumParameters;
+              << SecondName << SecondNumParameters;
           Diagnosed = true;
           break;
         }
@@ -9815,27 +9800,24 @@ void ASTReader::diagnoseOdrViolations()
                     FirstParamType->getAs<DecayedType>()) {
               ODRDiagError(FirstMethod->getLocation(),
                            FirstMethod->getSourceRange(), MethodParameterType)
-                  << FirstMethodType << FirstName << (I + 1) << FirstParamType
-                  << true << ParamDecayedType->getOriginalType();
+                  << FirstName << (I + 1) << FirstParamType << true
+                  << ParamDecayedType->getOriginalType();
             } else {
               ODRDiagError(FirstMethod->getLocation(),
                            FirstMethod->getSourceRange(), MethodParameterType)
-                  << FirstMethodType << FirstName << (I + 1) << FirstParamType
-                  << false;
+                  << FirstName << (I + 1) << FirstParamType << false;
             }
 
             if (const DecayedType *ParamDecayedType =
                     SecondParamType->getAs<DecayedType>()) {
               ODRDiagNote(SecondMethod->getLocation(),
                           SecondMethod->getSourceRange(), MethodParameterType)
-                  << SecondMethodType << SecondName << (I + 1)
-                  << SecondParamType << true
+                  << SecondName << (I + 1) << SecondParamType << true
                   << ParamDecayedType->getOriginalType();
             } else {
               ODRDiagNote(SecondMethod->getLocation(),
                           SecondMethod->getSourceRange(), MethodParameterType)
-                  << SecondMethodType << SecondName << (I + 1)
-                  << SecondParamType << false;
+                  << SecondName << (I + 1) << SecondParamType << false;
             }
             ParameterMismatch = true;
             break;
@@ -9846,10 +9828,10 @@ void ASTReader::diagnoseOdrViolations()
           if (FirstParamName != SecondParamName) {
             ODRDiagError(FirstMethod->getLocation(),
                          FirstMethod->getSourceRange(), MethodParameterName)
-                << FirstMethodType << FirstName << (I + 1) << FirstParamName;
+                << FirstName << (I + 1) << FirstParamName;
             ODRDiagNote(SecondMethod->getLocation(),
                         SecondMethod->getSourceRange(), MethodParameterName)
-                << SecondMethodType << SecondName << (I + 1) << SecondParamName;
+                << SecondName << (I + 1) << SecondParamName;
             ParameterMismatch = true;
             break;
           }
@@ -9860,14 +9842,12 @@ void ASTReader::diagnoseOdrViolations()
             ODRDiagError(FirstMethod->getLocation(),
                          FirstMethod->getSourceRange(),
                          MethodParameterSingleDefaultArgument)
-                << FirstMethodType << FirstName << (I + 1)
-                << (FirstInit == nullptr)
+                << FirstName << (I + 1) << (FirstInit == nullptr)
                 << (FirstInit ? FirstInit->getSourceRange() : SourceRange());
             ODRDiagNote(SecondMethod->getLocation(),
                         SecondMethod->getSourceRange(),
                         MethodParameterSingleDefaultArgument)
-                << SecondMethodType << SecondName << (I + 1)
-                << (SecondInit == nullptr)
+                << SecondName << (I + 1) << (SecondInit == nullptr)
                 << (SecondInit ? SecondInit->getSourceRange() : SourceRange());
             ParameterMismatch = true;
             break;
@@ -9878,13 +9858,11 @@ void ASTReader::diagnoseOdrViolations()
             ODRDiagError(FirstMethod->getLocation(),
                          FirstMethod->getSourceRange(),
                          MethodParameterDifferentDefaultArgument)
-                << FirstMethodType << FirstName << (I + 1)
-                << FirstInit->getSourceRange();
+                << FirstName << (I + 1) << FirstInit->getSourceRange();
             ODRDiagNote(SecondMethod->getLocation(),
                         SecondMethod->getSourceRange(),
                         MethodParameterDifferentDefaultArgument)
-                << SecondMethodType << SecondName << (I + 1)
-                << SecondInit->getSourceRange();
+                << SecondName << (I + 1) << SecondInit->getSourceRange();
             ParameterMismatch = true;
             break;
 

Modified: cfe/trunk/test/Modules/odr_hash.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/odr_hash.cpp?rev=307743&r1=307742&r2=307743&view=diff
==============================================================================
--- cfe/trunk/test/Modules/odr_hash.cpp (original)
+++ cfe/trunk/test/Modules/odr_hash.cpp Tue Jul 11 17:38:27 2017
@@ -519,75 +519,6 @@ S14 s14;
 #endif
 }  // namespace Method
 
-namespace Constructor {
-#if defined(FIRST)
-struct S1 {
-  S1() {}
-  void foo() {}
-};
-#elif defined(SECOND)
-struct S1 {
-  void foo() {}
-  S1() {}
-};
-#else
-S1 s1;
-// expected-error at second.h:* {{'Constructor::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'foo'}}
-// expected-note at first.h:* {{but in 'FirstModule' found constructor}}
-#endif
-
-#if defined(FIRST)
-struct S2 {
-  S2(int) {}
-  S2(int, int) {}
-};
-#elif defined(SECOND)
-struct S2 {
-  S2(int, int) {}
-  S2(int) {}
-};
-#else
-S2* s2;
-// expected-error at second.h:* {{'Constructor::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found constructor that has 2 parameters}}
-// expected-note at first.h:* {{but in 'FirstModule' found constructor that has 1 parameter}}
-#endif
-}  // namespace Constructor
-
-namespace Destructor {
-#if defined(FIRST)
-struct S1 {
-  ~S1() {}
-  S1() {}
-};
-#elif defined(SECOND)
-struct S1 {
-  S1() {}
-  ~S1() {}
-};
-#else
-S1 s1;
-// expected-error at second.h:* {{'Destructor::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found constructor}}
-// expected-note at first.h:* {{but in 'FirstModule' found destructor}}
-#endif
-
-#if defined(FIRST)
-struct S2 {
-  virtual ~S2() {}
-  void foo() {}
-};
-#elif defined(SECOND)
-struct S2 {
-  ~S2() {}
-  virtual void foo() {}
-};
-#else
-S2 s2;
-// expected-error at second.h:* {{'Destructor::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found destructor is not virtual}}
-// expected-note at first.h:* {{but in 'FirstModule' found destructor is virtual}}
-#endif
-
-}  // namespace Destructor
-
 // 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 {




More information about the cfe-commits mailing list