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/AST/Type.cpp b/lib/AST/Type.cpp
index 1df8b63..c3bb29b 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -1072,6 +1072,30 @@
Args[Idx].Profile(ID);
}
+const Type *QualifierSet::strip(const Type* T) {
+ QualType DT = T->getDesugaredType();
+ CVRMask |= DT.getCVRQualifiers();
+
+ if (const ExtQualType* EQT = dyn_cast<ExtQualType>(DT)) {
+ if (EQT->getAddressSpace())
+ AddressSpace = EQT->getAddressSpace();
+ if (EQT->getObjCGCAttr())
+ GCAttrType = EQT->getObjCGCAttr();
+ return EQT->getBaseType();
+ }else {
+ // Use the sugared type unless desugaring found extra qualifiers.
+ return (DT.getCVRQualifiers() ? DT.getTypePtr() : T);
+ }
+}
+
+QualType QualifierSet::apply(QualType QT, ASTContext& C) {
+ QT = QT.getWithAdditionalQualifiers(CVRMask);
+ if (GCAttrType) QT = C.getObjCGCQualType(QT, GCAttrType);
+ if (AddressSpace) QT = C.getAddrSpaceQualType(QT, AddressSpace);
+ return QT;
+}
+
+
//===----------------------------------------------------------------------===//
// Type Printing
//===----------------------------------------------------------------------===//