This patch fixes the implementations of the __has_trivial_destructor
and __has_trivial_constructor builtin pseudo-functions and
additionally implements __has_trivial_copy and __has_trivial_assign,
from John McCall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76916 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 0211470..2ecefde 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -4244,9 +4244,7 @@
   }
 
   if (getLangOptions().CPlusPlus) {
-    QualType EltTy = T;
-    while (const ArrayType *AT = Context.getAsArrayType(EltTy))
-      EltTy = AT->getElementType();
+    QualType EltTy = Context.getBaseElementType(T);
 
     if (const RecordType *RT = EltTy->getAsRecordType()) {
       CXXRecordDecl* RDecl = cast<CXXRecordDecl>(RT->getDecl());
@@ -4430,10 +4428,7 @@
   typedef RecordDecl::field_iterator field_iter;
   for (field_iter fi = RD->field_begin(), fe = RD->field_end(); fi != fe;
        ++fi) {
-    QualType EltTy = (*fi)->getType();
-    while (const ArrayType *AT = Context.getAsArrayType(EltTy))
-      EltTy = AT->getElementType();
-
+    QualType EltTy = Context.getBaseElementType((*fi)->getType());
     if (const RecordType *EltRT = EltTy->getAsRecordType()) {
       CXXRecordDecl* EltRD = cast<CXXRecordDecl>(EltRT->getDecl());