Revert "[ObjC] Make C++ triviality type traits available to non-trivial C"
This reverts commit r329289.
It was decided that we shouldn't expose the __has_* traits to C since
they are deprecated and useless.
See the discussion here:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180402/thread.html#223921
llvm-svn: 329608
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 74a6de5..a24ae7a 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -4521,8 +4521,6 @@
// does not correctly compute triviality in the presence of multiple special
// members of the same kind. Revisit this once the g++ bug is fixed.
case UTT_HasTrivialDefaultConstructor:
- if (T.isNonTrivialToPrimitiveDefaultInitialize())
- return false;
// http://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html:
// If __is_pod (type) is true then the trait is true, else if type is
// a cv class or union type (or array thereof) with a trivial default
@@ -4533,11 +4531,7 @@
return RD->hasTrivialDefaultConstructor() &&
!RD->hasNonTrivialDefaultConstructor();
return false;
- case UTT_HasTrivialMoveConstructor: {
- QualType::PrimitiveCopyKind PCK =
- T.isNonTrivialToPrimitiveDestructiveMove();
- if (PCK != QualType::PCK_Trivial && PCK != QualType::PCK_VolatileTrivial)
- return false;
+ case UTT_HasTrivialMoveConstructor:
// This trait is implemented by MSVC 2012 and needed to parse the
// standard library headers. Specifically this is used as the logic
// behind std::is_trivially_move_constructible (20.9.4.3).
@@ -4546,11 +4540,7 @@
if (CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
return RD->hasTrivialMoveConstructor() && !RD->hasNonTrivialMoveConstructor();
return false;
- }
- case UTT_HasTrivialCopy: {
- QualType::PrimitiveCopyKind PCK = T.isNonTrivialToPrimitiveCopy();
- if (PCK != QualType::PCK_Trivial && PCK != QualType::PCK_VolatileTrivial)
- return false;
+ case UTT_HasTrivialCopy:
// http://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html:
// If __is_pod (type) is true or type is a reference type then
// the trait is true, else if type is a cv class or union type
@@ -4562,12 +4552,7 @@
return RD->hasTrivialCopyConstructor() &&
!RD->hasNonTrivialCopyConstructor();
return false;
- }
- case UTT_HasTrivialMoveAssign: {
- QualType::PrimitiveCopyKind PCK =
- T.isNonTrivialToPrimitiveDestructiveMove();
- if (PCK != QualType::PCK_Trivial && PCK != QualType::PCK_VolatileTrivial)
- return false;
+ case UTT_HasTrivialMoveAssign:
// This trait is implemented by MSVC 2012 and needed to parse the
// standard library headers. Specifically it is used as the logic
// behind std::is_trivially_move_assignable (20.9.4.3)
@@ -4576,11 +4561,7 @@
if (CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
return RD->hasTrivialMoveAssignment() && !RD->hasNonTrivialMoveAssignment();
return false;
- }
- case UTT_HasTrivialAssign: {
- QualType::PrimitiveCopyKind PCK = T.isNonTrivialToPrimitiveCopy();
- if (PCK != QualType::PCK_Trivial && PCK != QualType::PCK_VolatileTrivial)
- return false;
+ case UTT_HasTrivialAssign:
// http://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html:
// If type is const qualified or is a reference type then the
// trait is false. Otherwise if __is_pod (type) is true then the
@@ -4601,7 +4582,6 @@
return RD->hasTrivialCopyAssignment() &&
!RD->hasNonTrivialCopyAssignment();
return false;
- }
case UTT_IsDestructible:
case UTT_IsTriviallyDestructible:
case UTT_IsNothrowDestructible:
@@ -4652,8 +4632,6 @@
return true;
case UTT_HasTrivialDestructor:
- if (T.isDestructedType() == QualType::DK_nontrivial_c_struct)
- return false;
// http://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html
// If __is_pod (type) is true or type is a reference type
// then the trait is true, else if type is a cv class or union