forked from OSchip/llvm-project
Renamed ASQualType to ExtQualType to reflect its more
general use; as for, objc2's gc type attributes. No change in functionality. llvm-svn: 64778
This commit is contained in:
parent
89f908b883
commit
ece8582ca2
|
@ -55,7 +55,7 @@ namespace clang {
|
|||
/// decls) that can be referred to throughout the semantic analysis of a file.
|
||||
class ASTContext {
|
||||
std::vector<Type*> Types;
|
||||
llvm::FoldingSet<ASQualType> ASQualTypes;
|
||||
llvm::FoldingSet<ExtQualType> ExtQualTypes;
|
||||
llvm::FoldingSet<ComplexType> ComplexTypes;
|
||||
llvm::FoldingSet<PointerType> PointerTypes;
|
||||
llvm::FoldingSet<BlockPointerType> BlockPointerTypes;
|
||||
|
@ -183,11 +183,12 @@ public:
|
|||
// Type Constructors
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
/// getASQualType - Return the uniqued reference to the type for an address
|
||||
/// space qualified type with the specified type and address space. The
|
||||
/// resulting type has a union of the qualifiers from T and the address space.
|
||||
// If T already has an address space specifier, it is silently replaced.
|
||||
QualType getASQualType(QualType T, unsigned AddressSpace);
|
||||
/// getAddSpaceQualType - Return the uniqued reference to the type for an
|
||||
/// address space qualified type with the specified type and address space.
|
||||
/// The resulting type has a union of the qualifiers from T and the address
|
||||
/// space. If T already has an address space specifier, it is silently
|
||||
/// replaced.
|
||||
QualType getAddrSpaceQualType(QualType T, unsigned AddressSpace);
|
||||
|
||||
/// getComplexType - Return the uniqued reference to the type for a complex
|
||||
/// number with the specified element type.
|
||||
|
|
|
@ -246,7 +246,7 @@ public:
|
|||
ConstantArray, VariableArray, IncompleteArray, DependentSizedArray,
|
||||
Vector, ExtVector,
|
||||
FunctionNoProto, FunctionProto,
|
||||
TypeName, Tagged, ASQual,
|
||||
TypeName, Tagged, ExtQual,
|
||||
TemplateTypeParm, ClassTemplateSpecialization,
|
||||
ObjCInterface, ObjCQualifiedInterface,
|
||||
ObjCQualifiedId,
|
||||
|
@ -454,18 +454,20 @@ protected:
|
|||
}
|
||||
};
|
||||
|
||||
/// ASQualType - TR18037 (C embedded extensions) 6.2.5p26
|
||||
/// This supports address space qualified types.
|
||||
/// ExtQualType - TR18037 (C embedded extensions) 6.2.5p26
|
||||
/// This supports all kinds of type attributes; including,
|
||||
/// address space qualified types, objective-c's __weak and
|
||||
/// __strong attributes.
|
||||
///
|
||||
class ASQualType : public Type, public llvm::FoldingSetNode {
|
||||
class ExtQualType : public Type, public llvm::FoldingSetNode {
|
||||
/// BaseType - This is the underlying type that this qualifies. All CVR
|
||||
/// qualifiers are stored on the QualType that references this type, so we
|
||||
/// can't have any here.
|
||||
Type *BaseType;
|
||||
/// Address Space ID - The address space ID this type is qualified with.
|
||||
unsigned AddressSpace;
|
||||
ASQualType(Type *Base, QualType CanonicalPtr, unsigned AddrSpace) :
|
||||
Type(ASQual, CanonicalPtr, Base->isDependentType()), BaseType(Base),
|
||||
ExtQualType(Type *Base, QualType CanonicalPtr, unsigned AddrSpace) :
|
||||
Type(ExtQual, CanonicalPtr, Base->isDependentType()), BaseType(Base),
|
||||
AddressSpace(AddrSpace) {
|
||||
}
|
||||
friend class ASTContext; // ASTContext creates these.
|
||||
|
@ -484,8 +486,8 @@ public:
|
|||
ID.AddInteger(AddrSpace);
|
||||
}
|
||||
|
||||
static bool classof(const Type *T) { return T->getTypeClass() == ASQual; }
|
||||
static bool classof(const ASQualType *) { return true; }
|
||||
static bool classof(const Type *T) { return T->getTypeClass() == ExtQual; }
|
||||
static bool classof(const ExtQualType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
@ -1707,8 +1709,8 @@ public:
|
|||
/// getUnqualifiedType - Return the type without any qualifiers.
|
||||
inline QualType QualType::getUnqualifiedType() const {
|
||||
Type *TP = getTypePtr();
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(TP))
|
||||
TP = ASQT->getBaseType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(TP))
|
||||
TP = EXTQT->getBaseType();
|
||||
return QualType(TP, 0);
|
||||
}
|
||||
|
||||
|
@ -1719,8 +1721,8 @@ inline unsigned QualType::getAddressSpace() const {
|
|||
return AT->getElementType().getAddressSpace();
|
||||
if (const RecordType *RT = dyn_cast<RecordType>(CT))
|
||||
return RT->getAddressSpace();
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CT))
|
||||
return ASQT->getAddressSpace();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CT))
|
||||
return EXTQT->getAddressSpace();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -380,10 +380,10 @@ ASTContext::getTypeInfo(const Type *T) {
|
|||
Width = std::max(llvm::NextPowerOf2(Width - 1), (uint64_t)8);
|
||||
Align = Width;
|
||||
break;
|
||||
case Type::ASQual:
|
||||
case Type::ExtQual:
|
||||
// FIXME: Pointers into different addr spaces could have different sizes and
|
||||
// alignment requirements: getPointerInfo should take an AddrSpace.
|
||||
return getTypeInfo(QualType(cast<ASQualType>(T)->getBaseType(), 0));
|
||||
return getTypeInfo(QualType(cast<ExtQualType>(T)->getBaseType(), 0));
|
||||
case Type::ObjCQualifiedId:
|
||||
Width = Target.getPointerWidth(0);
|
||||
Align = Target.getPointerAlign(0);
|
||||
|
@ -712,12 +712,12 @@ const ASTRecordLayout &ASTContext::getASTRecordLayout(const RecordDecl *D) {
|
|||
// Type creation/memoization methods
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
QualType ASTContext::getASQualType(QualType T, unsigned AddressSpace) {
|
||||
QualType ASTContext::getAddrSpaceQualType(QualType T, unsigned AddressSpace) {
|
||||
QualType CanT = getCanonicalType(T);
|
||||
if (CanT.getAddressSpace() == AddressSpace)
|
||||
return T;
|
||||
|
||||
// Type's cannot have multiple ASQuals, therefore we know we only have to deal
|
||||
// Type's cannot have multiple ExtQuals, therefore we know we only have to deal
|
||||
// with CVR qualifiers from here on out.
|
||||
assert(CanT.getAddressSpace() == 0 &&
|
||||
"Type is already address space qualified");
|
||||
|
@ -725,24 +725,24 @@ QualType ASTContext::getASQualType(QualType T, unsigned AddressSpace) {
|
|||
// Check if we've already instantiated an address space qual'd type of this
|
||||
// type.
|
||||
llvm::FoldingSetNodeID ID;
|
||||
ASQualType::Profile(ID, T.getTypePtr(), AddressSpace);
|
||||
ExtQualType::Profile(ID, T.getTypePtr(), AddressSpace);
|
||||
void *InsertPos = 0;
|
||||
if (ASQualType *ASQy = ASQualTypes.FindNodeOrInsertPos(ID, InsertPos))
|
||||
return QualType(ASQy, 0);
|
||||
if (ExtQualType *EXTQy = ExtQualTypes.FindNodeOrInsertPos(ID, InsertPos))
|
||||
return QualType(EXTQy, 0);
|
||||
|
||||
// If the base type isn't canonical, this won't be a canonical type either,
|
||||
// so fill in the canonical type field.
|
||||
QualType Canonical;
|
||||
if (!T->isCanonical()) {
|
||||
Canonical = getASQualType(CanT, AddressSpace);
|
||||
Canonical = getAddrSpaceQualType(CanT, AddressSpace);
|
||||
|
||||
// Get the new insert position for the node we care about.
|
||||
ASQualType *NewIP = ASQualTypes.FindNodeOrInsertPos(ID, InsertPos);
|
||||
ExtQualType *NewIP = ExtQualTypes.FindNodeOrInsertPos(ID, InsertPos);
|
||||
assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
|
||||
}
|
||||
ASQualType *New = new (*this, 8) ASQualType(T.getTypePtr(), Canonical,
|
||||
AddressSpace);
|
||||
ASQualTypes.InsertNode(New, InsertPos);
|
||||
ExtQualType *New = new (*this, 8) ExtQualType(T.getTypePtr(), Canonical,
|
||||
AddressSpace);
|
||||
ExtQualTypes.InsertNode(New, InsertPos);
|
||||
Types.push_back(New);
|
||||
return QualType(New, T.getCVRQualifiers());
|
||||
}
|
||||
|
@ -1470,7 +1470,7 @@ const ArrayType *ASTContext::getAsArrayType(QualType T) {
|
|||
// Handle the common negative case fast, ignoring CVR qualifiers.
|
||||
QualType CType = T->getCanonicalTypeInternal();
|
||||
|
||||
// Make sure to look through type qualifiers (like ASQuals) for the negative
|
||||
// Make sure to look through type qualifiers (like ExtQuals) for the negative
|
||||
// test.
|
||||
if (!isa<ArrayType>(CType) &&
|
||||
!isa<ArrayType>(CType.getUnqualifiedType()))
|
||||
|
@ -1487,11 +1487,11 @@ const ArrayType *ASTContext::getAsArrayType(QualType T) {
|
|||
unsigned AddrSpace = 0;
|
||||
Type *Ty = T.getTypePtr();
|
||||
|
||||
// Rip through ASQualType's and typedefs to get to a concrete type.
|
||||
// Rip through ExtQualType's and typedefs to get to a concrete type.
|
||||
while (1) {
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(Ty)) {
|
||||
AddrSpace = ASQT->getAddressSpace();
|
||||
Ty = ASQT->getBaseType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(Ty)) {
|
||||
AddrSpace = EXTQT->getAddressSpace();
|
||||
Ty = EXTQT->getBaseType();
|
||||
} else {
|
||||
T = Ty->getDesugaredType();
|
||||
if (T.getTypePtr() == Ty && T.getCVRQualifiers() == 0)
|
||||
|
@ -1512,7 +1512,7 @@ const ArrayType *ASTContext::getAsArrayType(QualType T) {
|
|||
// This can recursively sink qualifiers through multiple levels of arrays.
|
||||
QualType NewEltTy = ATy->getElementType();
|
||||
if (AddrSpace)
|
||||
NewEltTy = getASQualType(NewEltTy, AddrSpace);
|
||||
NewEltTy = getAddrSpaceQualType(NewEltTy, AddrSpace);
|
||||
NewEltTy = NewEltTy.getWithAdditionalQualifiers(CVRQuals);
|
||||
|
||||
if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(ATy))
|
||||
|
|
|
@ -959,8 +959,8 @@ unsigned IntExprEvaluator::GetAlignOfType(QualType T) {
|
|||
if (Ty->isFunctionType())
|
||||
return 4;
|
||||
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(Ty))
|
||||
return GetAlignOfType(QualType(ASQT->getBaseType(), 0));
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(Ty))
|
||||
return GetAlignOfType(QualType(EXTQT->getBaseType(), 0));
|
||||
|
||||
// alignof VLA/incomplete array.
|
||||
if (const ArrayType *VAT = dyn_cast<ArrayType>(Ty))
|
||||
|
|
|
@ -94,7 +94,7 @@ QualType Type::getDesugaredType() const {
|
|||
bool Type::isVoidType() const {
|
||||
if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
|
||||
return BT->getKind() == BuiltinType::Void;
|
||||
if (const ASQualType *AS = dyn_cast<ASQualType>(CanonicalType))
|
||||
if (const ExtQualType *AS = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return AS->getBaseType()->isVoidType();
|
||||
return false;
|
||||
}
|
||||
|
@ -102,15 +102,15 @@ bool Type::isVoidType() const {
|
|||
bool Type::isObjectType() const {
|
||||
if (isa<FunctionType>(CanonicalType) || isa<ReferenceType>(CanonicalType))
|
||||
return false;
|
||||
if (const ASQualType *AS = dyn_cast<ASQualType>(CanonicalType))
|
||||
if (const ExtQualType *AS = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return AS->getBaseType()->isObjectType();
|
||||
return !CanonicalType->isIncompleteType();
|
||||
}
|
||||
|
||||
bool Type::isDerivedType() const {
|
||||
switch (CanonicalType->getTypeClass()) {
|
||||
case ASQual:
|
||||
return cast<ASQualType>(CanonicalType)->getBaseType()->isDerivedType();
|
||||
case ExtQual:
|
||||
return cast<ExtQualType>(CanonicalType)->getBaseType()->isDerivedType();
|
||||
case Pointer:
|
||||
case VariableArray:
|
||||
case ConstantArray:
|
||||
|
@ -145,7 +145,7 @@ bool Type::isUnionType() const {
|
|||
bool Type::isComplexType() const {
|
||||
if (const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
|
||||
return CT->getElementType()->isFloatingType();
|
||||
if (const ASQualType *AS = dyn_cast<ASQualType>(CanonicalType))
|
||||
if (const ExtQualType *AS = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return AS->getBaseType()->isComplexType();
|
||||
return false;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ bool Type::isComplexIntegerType() const {
|
|||
// Check for GCC complex integer extension.
|
||||
if (const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
|
||||
return CT->getElementType()->isIntegerType();
|
||||
if (const ASQualType *AS = dyn_cast<ASQualType>(CanonicalType))
|
||||
if (const ExtQualType *AS = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return AS->getBaseType()->isComplexIntegerType();
|
||||
return false;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ const ComplexType *Type::getAsComplexIntegerType() const {
|
|||
|
||||
// If the canonical form of this type isn't what we want, reject it.
|
||||
if (!isa<ComplexType>(CanonicalType)) {
|
||||
// Look through type qualifiers (e.g. ASQualType's).
|
||||
// Look through type qualifiers (e.g. ExtQualType's).
|
||||
if (isa<ComplexType>(CanonicalType.getUnqualifiedType()))
|
||||
return CanonicalType.getUnqualifiedType()->getAsComplexIntegerType();
|
||||
return 0;
|
||||
|
@ -187,7 +187,7 @@ const BuiltinType *Type::getAsBuiltinType() const {
|
|||
|
||||
// If the canonical form of this type isn't a builtin type, reject it.
|
||||
if (!isa<BuiltinType>(CanonicalType)) {
|
||||
// Look through type qualifiers (e.g. ASQualType's).
|
||||
// Look through type qualifiers (e.g. ExtQualType's).
|
||||
if (isa<BuiltinType>(CanonicalType.getUnqualifiedType()))
|
||||
return CanonicalType.getUnqualifiedType()->getAsBuiltinType();
|
||||
return 0;
|
||||
|
@ -514,8 +514,8 @@ bool Type::isIntegerType() const {
|
|||
return true;
|
||||
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
|
||||
return VT->getElementType()->isIntegerType();
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isIntegerType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isIntegerType();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -529,24 +529,24 @@ bool Type::isIntegralType() const {
|
|||
// FIXME: In C++, enum types are never integral.
|
||||
if (isa<FixedWidthIntType>(CanonicalType))
|
||||
return true;
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isIntegralType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isIntegralType();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::isEnumeralType() const {
|
||||
if (const TagType *TT = dyn_cast<TagType>(CanonicalType))
|
||||
return TT->getDecl()->isEnum();
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isEnumeralType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isEnumeralType();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::isBooleanType() const {
|
||||
if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
|
||||
return BT->getKind() == BuiltinType::Bool;
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isBooleanType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isBooleanType();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -556,16 +556,16 @@ bool Type::isCharType() const {
|
|||
BT->getKind() == BuiltinType::UChar ||
|
||||
BT->getKind() == BuiltinType::Char_S ||
|
||||
BT->getKind() == BuiltinType::SChar;
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isCharType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isCharType();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::isWideCharType() const {
|
||||
if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
|
||||
return BT->getKind() == BuiltinType::WChar;
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isWideCharType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isWideCharType();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -588,8 +588,8 @@ bool Type::isSignedIntegerType() const {
|
|||
|
||||
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
|
||||
return VT->getElementType()->isSignedIntegerType();
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isSignedIntegerType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isSignedIntegerType();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -612,8 +612,8 @@ bool Type::isUnsignedIntegerType() const {
|
|||
|
||||
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
|
||||
return VT->getElementType()->isUnsignedIntegerType();
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isUnsignedIntegerType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isUnsignedIntegerType();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -625,8 +625,8 @@ bool Type::isFloatingType() const {
|
|||
return CT->getElementType()->isFloatingType();
|
||||
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
|
||||
return VT->getElementType()->isFloatingType();
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isFloatingType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isFloatingType();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -636,8 +636,8 @@ bool Type::isRealFloatingType() const {
|
|||
BT->getKind() <= BuiltinType::LongDouble;
|
||||
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
|
||||
return VT->getElementType()->isRealFloatingType();
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isRealFloatingType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isRealFloatingType();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -651,8 +651,8 @@ bool Type::isRealType() const {
|
|||
return true;
|
||||
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
|
||||
return VT->getElementType()->isRealType();
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isRealType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isRealType();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -666,8 +666,8 @@ bool Type::isArithmeticType() const {
|
|||
return ET->getDecl()->isDefinition();
|
||||
if (isa<FixedWidthIntType>(CanonicalType))
|
||||
return true;
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isArithmeticType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isArithmeticType();
|
||||
return isa<ComplexType>(CanonicalType) || isa<VectorType>(CanonicalType);
|
||||
}
|
||||
|
||||
|
@ -681,8 +681,8 @@ bool Type::isScalarType() const {
|
|||
return true;
|
||||
return false;
|
||||
}
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isScalarType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isScalarType();
|
||||
if (isa<FixedWidthIntType>(CanonicalType))
|
||||
return true;
|
||||
return isa<PointerType>(CanonicalType) ||
|
||||
|
@ -706,8 +706,8 @@ bool Type::isAggregateType() const {
|
|||
return CXXClassType->getDecl()->isAggregate();
|
||||
if (isa<RecordType>(CanonicalType))
|
||||
return true;
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isAggregateType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isAggregateType();
|
||||
return isa<ArrayType>(CanonicalType);
|
||||
}
|
||||
|
||||
|
@ -715,8 +715,8 @@ bool Type::isAggregateType() const {
|
|||
/// according to the rules of C99 6.7.5p3. It is not legal to call this on
|
||||
/// incomplete types or dependent types.
|
||||
bool Type::isConstantSizeType() const {
|
||||
if (const ASQualType *ASQT = dyn_cast<ASQualType>(CanonicalType))
|
||||
return ASQT->getBaseType()->isConstantSizeType();
|
||||
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
|
||||
return EXTQT->getBaseType()->isConstantSizeType();
|
||||
assert(!isIncompleteType() && "This doesn't make sense for incomplete types");
|
||||
assert(!isDependentType() && "This doesn't make sense for dependent types");
|
||||
// The VAT must have a size, as it is known to be complete.
|
||||
|
@ -729,8 +729,8 @@ bool Type::isConstantSizeType() const {
|
|||
bool Type::isIncompleteType() const {
|
||||
switch (CanonicalType->getTypeClass()) {
|
||||
default: return false;
|
||||
case ASQual:
|
||||
return cast<ASQualType>(CanonicalType)->getBaseType()->isIncompleteType();
|
||||
case ExtQual:
|
||||
return cast<ExtQualType>(CanonicalType)->getBaseType()->isIncompleteType();
|
||||
case Builtin:
|
||||
// Void is the only incomplete builtin type. Per C99 6.2.5p19, it can never
|
||||
// be completed.
|
||||
|
@ -755,8 +755,8 @@ bool Type::isPODType() const {
|
|||
switch (CanonicalType->getTypeClass()) {
|
||||
// Everything not explicitly mentioned is not POD.
|
||||
default: return false;
|
||||
case ASQual:
|
||||
return cast<ASQualType>(CanonicalType)->getBaseType()->isPODType();
|
||||
case ExtQual:
|
||||
return cast<ExtQualType>(CanonicalType)->getBaseType()->isPODType();
|
||||
case VariableArray:
|
||||
case ConstantArray:
|
||||
// IncompleteArray is caught by isIncompleteType() above.
|
||||
|
@ -886,7 +886,7 @@ QualType TypedefType::LookThroughTypedefs() const {
|
|||
|
||||
|
||||
/// FIXME:
|
||||
/// FIXME: This is incorrect for ASQuals!
|
||||
/// FIXME: This is incorrect for ExtQuals!
|
||||
/// FIXME:
|
||||
TypeQuals |= CurType.getCVRQualifiers();
|
||||
|
||||
|
@ -1052,7 +1052,7 @@ void ComplexType::getAsStringInternal(std::string &S) const {
|
|||
S = "_Complex " + S;
|
||||
}
|
||||
|
||||
void ASQualType::getAsStringInternal(std::string &S) const {
|
||||
void ExtQualType::getAsStringInternal(std::string &S) const {
|
||||
S = "__attribute__((address_space("+llvm::utostr_32(AddressSpace)+")))" + S;
|
||||
BaseType->getAsStringInternal(S);
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ void Type::Create(ASTContext& Context, unsigned i, Deserializer& D) {
|
|||
D.RegisterPtr(PtrID,Context.getTypes()[i]);
|
||||
break;
|
||||
|
||||
case Type::ASQual:
|
||||
D.RegisterPtr(PtrID,ASQualType::CreateImpl(Context,D));
|
||||
case Type::ExtQual:
|
||||
D.RegisterPtr(PtrID,ExtQualType::CreateImpl(Context,D));
|
||||
break;
|
||||
|
||||
case Type::Complex:
|
||||
|
@ -138,18 +138,18 @@ void Type::Create(ASTContext& Context, unsigned i, Deserializer& D) {
|
|||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ASQualType
|
||||
// ExtQualType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ASQualType::EmitImpl(Serializer& S) const {
|
||||
void ExtQualType::EmitImpl(Serializer& S) const {
|
||||
S.EmitPtr(getBaseType());
|
||||
S.EmitInt(getAddressSpace());
|
||||
}
|
||||
|
||||
Type* ASQualType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
Type* ExtQualType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
QualType BaseTy = QualType::ReadVal(D);
|
||||
unsigned AddressSpace = D.ReadInt();
|
||||
return Context.getASQualType(BaseTy, AddressSpace).getTypePtr();
|
||||
return Context.getAddrSpaceQualType(BaseTy, AddressSpace).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -397,7 +397,7 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty,
|
|||
case Type::Reference:
|
||||
case Type::Vector:
|
||||
case Type::ExtVector:
|
||||
case Type::ASQual:
|
||||
case Type::ExtQual:
|
||||
case Type::ObjCInterface:
|
||||
case Type::ObjCQualifiedInterface:
|
||||
case Type::ObjCQualifiedId:
|
||||
|
|
|
@ -266,9 +266,9 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
|
|||
return GetFunctionType(getFunctionInfo(FTP), FTP->isVariadic());
|
||||
}
|
||||
|
||||
case Type::ASQual:
|
||||
case Type::ExtQual:
|
||||
return
|
||||
ConvertTypeRecursive(QualType(cast<ASQualType>(Ty).getBaseType(), 0));
|
||||
ConvertTypeRecursive(QualType(cast<ExtQualType>(Ty).getBaseType(), 0));
|
||||
|
||||
case Type::ObjCInterface: {
|
||||
// Warning: Use of this is strongly discouraged. Late binding of instance
|
||||
|
|
|
@ -2459,7 +2459,7 @@ Sema::CheckPointerTypesForAssignment(QualType lhsType, QualType rhsType) {
|
|||
// C99 6.5.16.1p1: This following citation is common to constraints
|
||||
// 3 & 4 (below). ...and the type *pointed to* by the left has all the
|
||||
// qualifiers of the type *pointed to* by the right;
|
||||
// FIXME: Handle ASQualType
|
||||
// FIXME: Handle ExtQualType
|
||||
if (!lhptee.isAtLeastAsQualifiedAs(rhptee))
|
||||
ConvTy = CompatiblePointerDiscardsQualifiers;
|
||||
|
||||
|
|
|
@ -755,7 +755,7 @@ static void HandleAddressSpaceTypeAttribute(QualType &Type,
|
|||
}
|
||||
|
||||
unsigned ASIdx = static_cast<unsigned>(addrSpace.getZExtValue());
|
||||
Type = S.Context.getASQualType(Type, ASIdx);
|
||||
Type = S.Context.getAddrSpaceQualType(Type, ASIdx);
|
||||
}
|
||||
|
||||
void Sema::ProcessTypeAttributeList(QualType &Result, const AttributeList *AL) {
|
||||
|
|
Loading…
Reference in New Issue