]> granicus.if.org Git - clang/commitdiff
Revert 298754 and 298742.
authorVassil Vassilev <v.g.vassilev@gmail.com>
Sun, 26 Mar 2017 18:32:53 +0000 (18:32 +0000)
committerVassil Vassilev <v.g.vassilev@gmail.com>
Sun, 26 Mar 2017 18:32:53 +0000 (18:32 +0000)
They broke llvm modules builds and our internal modules infrastructure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298816 91177308-0d34-0410-b5e6-96231b3b80d8

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

index f396b6a54771a70a25bdca9eb7ba08c9d14a0f17..07ecf755ad539763c1b3b47184c22d66310fd78f 100644 (file)
@@ -148,7 +148,7 @@ def err_module_odr_violation_mismatch_decl_diff : Error<
   "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 of type %6|"
   "method %4 with %ordinal5 parameter named %6|"
   "method %4 with %ordinal5 parameter with %select{no |}6default argument|"
   "method %4 with %ordinal5 parameter with default argument}3">;
@@ -173,7 +173,7 @@ def note_module_odr_violation_mismatch_decl_diff : Note<"but in '%0' found "
   "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 of type %4|"
   "method %2 with %ordinal3 parameter named %4|"
   "method %2 with %ordinal3 parameter with %select{no |}4default argument|"
   "method %2 with %ordinal3 parameter with different default argument}1">;
index 2ca94e16770c87b40d2f0cb85fa651075f7ca1f7..1b323e4b759b23ae4256a8ceee25716d619f0975 100644 (file)
@@ -330,10 +330,6 @@ public:
     Hash.AddQualType(T);
   }
 
-  void VisitQualifiers(Qualifiers Quals) {
-    ID.AddInteger(Quals.getAsOpaqueValue());
-  }
-
   void Visit(const Type *T) {
     ID.AddInteger(T->getTypeClass());
     Inherited::Visit(T);
@@ -341,43 +337,6 @@ public:
 
   void VisitType(const Type *T) {}
 
-  void VisitAdjustedType(const AdjustedType *T) {
-    AddQualType(T->getOriginalType());
-    AddQualType(T->getAdjustedType());
-    VisitType(T);
-  }
-
-  void VisitDecayedType(const DecayedType *T) {
-    AddQualType(T->getDecayedType());
-    AddQualType(T->getPointeeType());
-    VisitAdjustedType(T);
-  }
-
-  void VisitArrayType(const ArrayType *T) {
-    AddQualType(T->getElementType());
-    ID.AddInteger(T->getSizeModifier());
-    VisitQualifiers(T->getIndexTypeQualifiers());
-    VisitType(T);
-  }
-  void VisitConstantArrayType(const ConstantArrayType *T) {
-    T->getSize().Profile(ID);
-    VisitArrayType(T);
-  }
-
-  void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
-    AddStmt(T->getSizeExpr());
-    VisitArrayType(T);
-  }
-
-  void VisitIncompleteArrayType(const IncompleteArrayType *T) {
-    VisitArrayType(T);
-  }
-
-  void VisitVariableArrayType(const VariableArrayType *T) {
-    AddStmt(T->getSizeExpr());
-    VisitArrayType(T);
-  }
-
   void VisitBuiltinType(const BuiltinType *T) {
     ID.AddInteger(T->getKind());
     VisitType(T);
index 653629f597f7fc07222739df50d6b15f108b18a4..a691f7abd1a567bd92fbe3a76ad8a7372ca862ca 100644 (file)
@@ -9586,33 +9586,13 @@ void ASTReader::diagnoseOdrViolations() {
         for (unsigned I = 0; I < FirstNumParameters; ++I) {
           const ParmVarDecl *FirstParam = FirstMethod->getParamDecl(I);
           const ParmVarDecl *SecondParam = SecondMethod->getParamDecl(I);
-
-          QualType FirstParamType = FirstParam->getType();
-          QualType SecondParamType = SecondParam->getType();
-          if (FirstParamType != SecondParamType) {
-            if (const DecayedType *ParamDecayedType =
-                    FirstParamType->getAs<DecayedType>()) {
-              ODRDiagError(FirstMethod->getLocation(),
-                           FirstMethod->getSourceRange(), MethodParameterType)
-                  << FirstName << (I + 1) << FirstParamType << true
-                  << ParamDecayedType->getOriginalType();
-            } else {
-              ODRDiagError(FirstMethod->getLocation(),
-                           FirstMethod->getSourceRange(), MethodParameterType)
-                  << FirstName << (I + 1) << FirstParamType << false;
-            }
-
-            if (const DecayedType *ParamDecayedType =
-                    SecondParamType->getAs<DecayedType>()) {
-              ODRDiagNote(SecondMethod->getLocation(),
-                          SecondMethod->getSourceRange(), MethodParameterType)
-                  << SecondName << (I + 1) << SecondParamType << true
-                  << ParamDecayedType->getOriginalType();
-            } else {
-              ODRDiagNote(SecondMethod->getLocation(),
-                          SecondMethod->getSourceRange(), MethodParameterType)
-                  << SecondName << (I + 1) << SecondParamType << false;
-            }
+          if (FirstParam->getType() != SecondParam->getType()) {
+            ODRDiagError(FirstMethod->getLocation(),
+                         FirstMethod->getSourceRange(), MethodParameterType)
+                << FirstName << (I + 1) << FirstParam->getType();
+            ODRDiagNote(SecondMethod->getLocation(),
+                        SecondMethod->getSourceRange(), MethodParameterType)
+                << SecondName << (I + 1) << SecondParam->getType();
             ParameterMismatch = true;
             break;
           }
index 3acb23cb3168e894313f3261fe8eaef604a5af05..6069601b1e835456572d9ac8f67a06cb3d4a6b7f 100644 (file)
@@ -275,33 +275,6 @@ S11 s11;
 // expected-note@first.h:* {{but in 'FirstModule' found field 'x' with a different initializer}}
 #endif
 
-#if defined(FIRST)
-struct S12 {
-  unsigned x[5];
-};
-#elif defined(SECOND)
-struct S12 {
-  unsigned x[7];
-};
-#else
-S12 s12;
-// expected-error@first.h:* {{'Field::S12::x' from module 'FirstModule' is not present in definition of 'Field::S12' in module 'SecondModule'}}
-// expected-note@second.h:* {{declaration of 'x' does not match}}
-#endif
-
-#if defined(FIRST)
-struct S13 {
-  unsigned x[7];
-};
-#elif defined(SECOND)
-struct S13 {
-  double x[7];
-};
-#else
-S13 s13;
-// expected-error@first.h:* {{'Field::S13::x' from module 'FirstModule' is not present in definition of 'Field::S13' in module 'SecondModule'}}
-// expected-note@second.h:* {{declaration of 'x' does not match}}
-#endif
 }  // namespace Field
 
 namespace Method {
@@ -503,20 +476,6 @@ S13 s13;
 // expected-error@second.h:* {{'Method::S13' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter with default argument}}
 // expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter with different default argument}}
 #endif
-
-#if defined(FIRST)
-struct S14 {
-  void A(int x[2]) {}
-};
-#elif defined(SECOND)
-struct S14 {
-  void A(int x[3]) {}
-};
-#else
-S14 s14;
-// expected-error@second.h:* {{'Method::S14' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [3]'}}
-// expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [2]'}}
-#endif
 }  // namespace Method
 
 // Naive parsing of AST can lead to cycles in processing.  Ensure
@@ -638,52 +597,74 @@ S3 s3;
 
 // Interesting cases that should not cause errors.  struct S should not error
 // while struct T should error at the access specifier mismatch at the end.
-#define ALL_DECLS                                        \
-public:                                                  \
-private:                                                 \
-protected:                                               \
-  static_assert(1 == 1, "Message");                      \
-  static_assert(2 == 2);                                 \
-                                                         \
-  int x;                                                 \
-  double y;                                              \
-                                                         \
-  INT z;                                                 \
-                                                         \
-  unsigned a : 1;                                        \
-  unsigned b : 2 * 2 + 5 / 2;                            \
-                                                         \
-  mutable int c = sizeof(x + y);                         \
-                                                         \
-  void method() {}                                       \
-  static void static_method() {}                         \
-  virtual void virtual_method() {}                       \
-  virtual void pure_virtual_method() = 0;                \
-  inline void inline_method() {}                         \
-  void volatile_method() volatile {}                     \
-  void const_method() const {}                           \
-                                                         \
-  typedef int typedef_int;                               \
-  using using_int = int;                                 \
-                                                         \
-  void method_one_arg(int x) {}                          \
-  void method_one_arg_default_argument(int x = 5 + 5) {} \
-  void method_decayed_type(int x[5]) {}                  \
-                                                         \
-  int constant_arr[5];                                   \
-                                                         \
-  double last_decl;
-
 namespace AllDecls {
 #if defined(FIRST)
 typedef int INT;
 struct S {
-  ALL_DECLS
+  public:
+  private:
+  protected:
+
+  static_assert(1 == 1, "Message");
+  static_assert(2 == 2);
+
+  int x;
+  double y;
+
+  INT z;
+
+  unsigned a : 1;
+  unsigned b : 2*2 + 5/2;
+
+  mutable int c = sizeof(x + y);
+
+  void method() {}
+  static void static_method() {}
+  virtual void virtual_method() {}
+  virtual void pure_virtual_method() = 0;
+  inline void inline_method() {}
+  void volatile_method() volatile {}
+  void const_method() const {}
+
+  typedef int typedef_int;
+  using using_int = int;
+
+  void method_one_arg(int x) {}
+  void method_one_arg_default_argument(int x = 5 + 5) {}
 };
 #elif defined(SECOND)
 typedef int INT;
 struct S {
-  ALL_DECLS
+  public:
+  private:
+  protected:
+
+  static_assert(1 == 1, "Message");
+  static_assert(2 == 2);
+
+  int x;
+  double y;
+
+  INT z;
+
+  unsigned a : 1;
+  unsigned b : 2 * 2 + 5 / 2;
+
+  mutable int c = sizeof(x + y);
+
+  void method() {}
+  static void static_method() {}
+  virtual void virtual_method() {}
+  virtual void pure_virtual_method() = 0;
+  inline void inline_method() {}
+  void volatile_method() volatile {}
+  void const_method() const {}
+
+  typedef int typedef_int;
+  using using_int = int;
+
+  void method_one_arg(int x) {}
+  void method_one_arg_default_argument(int x = 5 + 5) {}
 };
 #else
 S *s;
@@ -692,14 +673,72 @@ S *s;
 #if defined(FIRST)
 typedef int INT;
 struct T {
-  ALL_DECLS
+  public:
+  private:
+  protected:
+
+  static_assert(1 == 1, "Message");
+  static_assert(2 == 2);
+
+  int x;
+  double y;
+
+  INT z;
+
+  unsigned a : 1;
+  unsigned b : 2 * 2 + 5 / 2;
+
+  mutable int c = sizeof(x + y);
+
+  void method() {}
+  static void static_method() {}
+  virtual void virtual_method() {}
+  virtual void pure_virtual_method() = 0;
+  inline void inline_method() {}
+  void volatile_method() volatile {}
+  void const_method() const {}
+
+  typedef int typedef_int;
+  using using_int = int;
+
+  void method_one_arg(int x) {}
+  void method_one_arg_default_argument(int x = 5 + 5) {}
 
   private:
 };
 #elif defined(SECOND)
 typedef int INT;
 struct T {
-  ALL_DECLS
+  public:
+  private:
+  protected:
+
+  static_assert(1 == 1, "Message");
+  static_assert(2 == 2);
+
+  int x;
+  double y;
+
+  INT z;
+
+  unsigned a : 1;
+  unsigned b : 2 * 2 + 5 / 2;
+
+  mutable int c = sizeof(x + y);
+
+  void method() {}
+  static void static_method() {}
+  virtual void virtual_method() {}
+  virtual void pure_virtual_method() = 0;
+  inline void inline_method() {}
+  void volatile_method() volatile {}
+  void const_method() const {}
+
+  typedef int typedef_int;
+  using using_int = int;
+
+  void method_one_arg(int x) {}
+  void method_one_arg_default_argument(int x = 5 + 5) {}
 
   public:
 };