From: John McCall Date: Sat, 25 Jul 2009 04:35:50 +0000 (+0000) Subject: Flesh out the QualifierSet API. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8fceb57f6980c67bb8f12e29d75736cf057951e8;p=clang Flesh out the QualifierSet API. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77046 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 5ef3539e69..761f3fc922 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -571,6 +571,30 @@ public: CVRMask(0), AddressSpace(0), GCAttrType(QualType::GCNone) { } + void removeConst() { removeCVR(QualType::Const); } + void removeVolatile() { removeCVR(QualType::Volatile); } + void removeRestrict() { removeCVR(QualType::Restrict); } + void removeCVR(unsigned mask) { CVRMask &= ~mask; } + void removeAddressSpace() { AddressSpace = 0; } + void removeGCAttrType() { GCAttrType = QualType::GCNone; } + + void addConst() { addCVR(QualType::Const); } + void addVolatile() { addCVR(QualType::Volatile); } + void addRestrict() { addCVR(QualType::Restrict); } + void addCVR(unsigned mask) { CVRMask |= mask; } + void addAddressSpace(unsigned space) { + assert(space); + AddressSpace = space; + } + void addGCAttrType(QualType::GCAttrTypes type) { + assert(type); + GCAttrType = type; + } + + bool empty() { + return !CVRMask && !AddressSpace && !GCAttrType; + } + /// Collect any qualifiers on the given type and return an /// unqualified type. const Type *strip(QualType QT) {