зеркало из https://github.com/microsoft/clang-1.git
Remove ObjCQualifiedInterfaceType:-)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76321 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
fb89cf05d3
Коммит
c15cb2af27
|
@ -79,7 +79,7 @@ class ASTContext {
|
||||||
llvm::FoldingSet<TemplateSpecializationType> TemplateSpecializationTypes;
|
llvm::FoldingSet<TemplateSpecializationType> TemplateSpecializationTypes;
|
||||||
llvm::FoldingSet<QualifiedNameType> QualifiedNameTypes;
|
llvm::FoldingSet<QualifiedNameType> QualifiedNameTypes;
|
||||||
llvm::FoldingSet<TypenameType> TypenameTypes;
|
llvm::FoldingSet<TypenameType> TypenameTypes;
|
||||||
llvm::FoldingSet<ObjCQualifiedInterfaceType> ObjCQualifiedInterfaceTypes;
|
llvm::FoldingSet<ObjCInterfaceType> ObjCInterfaceTypes;
|
||||||
llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
|
llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
|
||||||
|
|
||||||
llvm::FoldingSet<QualifiedTemplateName> QualifiedTemplateNames;
|
llvm::FoldingSet<QualifiedTemplateName> QualifiedTemplateNames;
|
||||||
|
@ -354,7 +354,6 @@ public:
|
||||||
/// getTypedefType - Return the unique reference to the type for the
|
/// getTypedefType - Return the unique reference to the type for the
|
||||||
/// specified typename decl.
|
/// specified typename decl.
|
||||||
QualType getTypedefType(TypedefDecl *Decl);
|
QualType getTypedefType(TypedefDecl *Decl);
|
||||||
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl);
|
|
||||||
|
|
||||||
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index,
|
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index,
|
||||||
bool ParameterPack,
|
bool ParameterPack,
|
||||||
|
@ -374,19 +373,16 @@ public:
|
||||||
const TemplateSpecializationType *TemplateId,
|
const TemplateSpecializationType *TemplateId,
|
||||||
QualType Canon = QualType());
|
QualType Canon = QualType());
|
||||||
|
|
||||||
|
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
|
||||||
|
ObjCProtocolDecl **Protocols = 0,
|
||||||
|
unsigned NumProtocols = 0);
|
||||||
|
|
||||||
/// getObjCObjectPointerType - Return a ObjCObjectPointerType type for the
|
/// getObjCObjectPointerType - Return a ObjCObjectPointerType type for the
|
||||||
/// given interface decl and the conforming protocol list.
|
/// given interface decl and the conforming protocol list.
|
||||||
QualType getObjCObjectPointerType(QualType OIT,
|
QualType getObjCObjectPointerType(QualType OIT,
|
||||||
ObjCProtocolDecl **ProtocolList = 0,
|
ObjCProtocolDecl **ProtocolList = 0,
|
||||||
unsigned NumProtocols = 0);
|
unsigned NumProtocols = 0);
|
||||||
|
|
||||||
/// getObjCQualifiedInterfaceType - Return a
|
|
||||||
/// ObjCQualifiedInterfaceType type for the given interface decl and
|
|
||||||
/// the conforming protocol list.
|
|
||||||
QualType getObjCQualifiedInterfaceType(ObjCInterfaceDecl *Decl,
|
|
||||||
ObjCProtocolDecl **ProtocolList,
|
|
||||||
unsigned NumProtocols);
|
|
||||||
|
|
||||||
/// getTypeOfType - GCC extension.
|
/// getTypeOfType - GCC extension.
|
||||||
QualType getTypeOfExprType(Expr *e);
|
QualType getTypeOfExprType(Expr *e);
|
||||||
QualType getTypeOfType(QualType t);
|
QualType getTypeOfType(QualType t);
|
||||||
|
|
|
@ -454,7 +454,7 @@ public:
|
||||||
const ObjCObjectPointerType *getAsObjCInterfacePointerType() const;
|
const ObjCObjectPointerType *getAsObjCInterfacePointerType() const;
|
||||||
const ObjCObjectPointerType *getAsObjCQualifiedIdType() const;
|
const ObjCObjectPointerType *getAsObjCQualifiedIdType() const;
|
||||||
const ObjCInterfaceType *getAsObjCInterfaceType() const;
|
const ObjCInterfaceType *getAsObjCInterfaceType() const;
|
||||||
const ObjCQualifiedInterfaceType *getAsObjCQualifiedInterfaceType() const;
|
const ObjCInterfaceType *getAsObjCQualifiedInterfaceType() const;
|
||||||
const TemplateTypeParmType *getAsTemplateTypeParmType() const;
|
const TemplateTypeParmType *getAsTemplateTypeParmType() const;
|
||||||
|
|
||||||
// Member-template getAs<specific type>'. This scheme will eventually
|
// Member-template getAs<specific type>'. This scheme will eventually
|
||||||
|
@ -1861,41 +1861,43 @@ public:
|
||||||
/// object oriented design. They basically correspond to C++ classes. There
|
/// object oriented design. They basically correspond to C++ classes. There
|
||||||
/// are two kinds of interface types, normal interfaces like "NSString" and
|
/// are two kinds of interface types, normal interfaces like "NSString" and
|
||||||
/// qualified interfaces, which are qualified with a protocol list like
|
/// qualified interfaces, which are qualified with a protocol list like
|
||||||
/// "NSString<NSCopyable, NSAmazing>". Qualified interface types are instances
|
/// "NSString<NSCopyable, NSAmazing>".
|
||||||
/// of ObjCQualifiedInterfaceType, which is a subclass of ObjCInterfaceType.
|
class ObjCInterfaceType : public Type, public llvm::FoldingSetNode {
|
||||||
class ObjCInterfaceType : public Type {
|
|
||||||
ObjCInterfaceDecl *Decl;
|
ObjCInterfaceDecl *Decl;
|
||||||
protected:
|
|
||||||
ObjCInterfaceType(TypeClass tc, ObjCInterfaceDecl *D) :
|
// List of protocols for this protocol conforming object type
|
||||||
Type(tc, QualType(), /*Dependent=*/false), Decl(D) { }
|
// List is sorted on protocol name. No protocol is enterred more than once.
|
||||||
|
llvm::SmallVector<ObjCProtocolDecl*, 4> Protocols;
|
||||||
|
|
||||||
|
ObjCInterfaceType(ObjCInterfaceDecl *D,
|
||||||
|
ObjCProtocolDecl **Protos, unsigned NumP) :
|
||||||
|
Type(ObjCInterface, QualType(), /*Dependent=*/false),
|
||||||
|
Decl(D), Protocols(Protos, Protos+NumP) { }
|
||||||
friend class ASTContext; // ASTContext creates these.
|
friend class ASTContext; // ASTContext creates these.
|
||||||
|
|
||||||
// FIXME: These can go away when we move ASTContext::canAssignObjCInterfaces
|
|
||||||
// to this class (as a static helper).
|
|
||||||
bool isObjCIdInterface() const;
|
|
||||||
bool isObjCClassInterface() const;
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ObjCInterfaceDecl *getDecl() const { return Decl; }
|
ObjCInterfaceDecl *getDecl() const { return Decl; }
|
||||||
|
|
||||||
/// qual_iterator and friends: this provides access to the (potentially empty)
|
|
||||||
/// list of protocols qualifying this interface. If this is an instance of
|
|
||||||
/// ObjCQualifiedInterfaceType it returns the list, otherwise it returns an
|
|
||||||
/// empty list if there are no qualifying protocols.
|
|
||||||
typedef llvm::SmallVector<ObjCProtocolDecl*, 8>::const_iterator qual_iterator;
|
|
||||||
inline qual_iterator qual_begin() const;
|
|
||||||
inline qual_iterator qual_end() const;
|
|
||||||
bool qual_empty() const { return getTypeClass() != ObjCQualifiedInterface; }
|
|
||||||
|
|
||||||
/// getNumProtocols - Return the number of qualifying protocols in this
|
/// getNumProtocols - Return the number of qualifying protocols in this
|
||||||
/// interface type, or 0 if there are none.
|
/// interface type, or 0 if there are none.
|
||||||
inline unsigned getNumProtocols() const;
|
unsigned getNumProtocols() const { return Protocols.size(); }
|
||||||
|
|
||||||
|
/// qual_iterator and friends: this provides access to the (potentially empty)
|
||||||
|
/// list of protocols qualifying this interface.
|
||||||
|
typedef llvm::SmallVector<ObjCProtocolDecl*, 8>::const_iterator qual_iterator;
|
||||||
|
qual_iterator qual_begin() const { return Protocols.begin(); }
|
||||||
|
qual_iterator qual_end() const { return Protocols.end(); }
|
||||||
|
bool qual_empty() const { return Protocols.size() == 0; }
|
||||||
|
|
||||||
virtual void getAsStringInternal(std::string &InnerString,
|
virtual void getAsStringInternal(std::string &InnerString,
|
||||||
const PrintingPolicy &Policy) const;
|
const PrintingPolicy &Policy) const;
|
||||||
|
|
||||||
|
void Profile(llvm::FoldingSetNodeID &ID);
|
||||||
|
static void Profile(llvm::FoldingSetNodeID &ID,
|
||||||
|
const ObjCInterfaceDecl *Decl,
|
||||||
|
ObjCProtocolDecl **protocols, unsigned NumProtocols);
|
||||||
|
|
||||||
static bool classof(const Type *T) {
|
static bool classof(const Type *T) {
|
||||||
return T->getTypeClass() == ObjCInterface ||
|
return T->getTypeClass() == ObjCInterface;
|
||||||
T->getTypeClass() == ObjCQualifiedInterface;
|
|
||||||
}
|
}
|
||||||
static bool classof(const ObjCInterfaceType *) { return true; }
|
static bool classof(const ObjCInterfaceType *) { return true; }
|
||||||
};
|
};
|
||||||
|
@ -1975,69 +1977,6 @@ public:
|
||||||
static bool classof(const ObjCObjectPointerType *) { return true; }
|
static bool classof(const ObjCObjectPointerType *) { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// ObjCQualifiedInterfaceType - This class represents interface types
|
|
||||||
/// conforming to a list of protocols, such as INTF<Proto1, Proto2, Proto1>.
|
|
||||||
///
|
|
||||||
/// Duplicate protocols are removed and protocol list is canonicalized to be in
|
|
||||||
/// alphabetical order.
|
|
||||||
/// FIXME: Remove this class (converting uses to ObjCObjectPointerType).
|
|
||||||
class ObjCQualifiedInterfaceType : public ObjCInterfaceType,
|
|
||||||
public llvm::FoldingSetNode {
|
|
||||||
|
|
||||||
// List of protocols for this protocol conforming object type
|
|
||||||
// List is sorted on protocol name. No protocol is enterred more than once.
|
|
||||||
llvm::SmallVector<ObjCProtocolDecl*, 4> Protocols;
|
|
||||||
|
|
||||||
ObjCQualifiedInterfaceType(ObjCInterfaceDecl *D,
|
|
||||||
ObjCProtocolDecl **Protos, unsigned NumP) :
|
|
||||||
ObjCInterfaceType(ObjCQualifiedInterface, D),
|
|
||||||
Protocols(Protos, Protos+NumP) { }
|
|
||||||
friend class ASTContext; // ASTContext creates these.
|
|
||||||
public:
|
|
||||||
|
|
||||||
unsigned getNumProtocols() const {
|
|
||||||
return Protocols.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
qual_iterator qual_begin() const { return Protocols.begin(); }
|
|
||||||
qual_iterator qual_end() const { return Protocols.end(); }
|
|
||||||
|
|
||||||
virtual void getAsStringInternal(std::string &InnerString,
|
|
||||||
const PrintingPolicy &Policy) const;
|
|
||||||
|
|
||||||
void Profile(llvm::FoldingSetNodeID &ID);
|
|
||||||
static void Profile(llvm::FoldingSetNodeID &ID,
|
|
||||||
const ObjCInterfaceDecl *Decl,
|
|
||||||
ObjCProtocolDecl **protocols, unsigned NumProtocols);
|
|
||||||
|
|
||||||
static bool classof(const Type *T) {
|
|
||||||
return T->getTypeClass() == ObjCQualifiedInterface;
|
|
||||||
}
|
|
||||||
static bool classof(const ObjCQualifiedInterfaceType *) { return true; }
|
|
||||||
};
|
|
||||||
|
|
||||||
inline ObjCInterfaceType::qual_iterator ObjCInterfaceType::qual_begin() const {
|
|
||||||
if (const ObjCQualifiedInterfaceType *QIT =
|
|
||||||
dyn_cast<ObjCQualifiedInterfaceType>(this))
|
|
||||||
return QIT->qual_begin();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
inline ObjCInterfaceType::qual_iterator ObjCInterfaceType::qual_end() const {
|
|
||||||
if (const ObjCQualifiedInterfaceType *QIT =
|
|
||||||
dyn_cast<ObjCQualifiedInterfaceType>(this))
|
|
||||||
return QIT->qual_end();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// getNumProtocols - Return the number of qualifying protocols in this
|
|
||||||
/// interface type, or 0 if there are none.
|
|
||||||
inline unsigned ObjCInterfaceType::getNumProtocols() const {
|
|
||||||
if (const ObjCQualifiedInterfaceType *QIT =
|
|
||||||
dyn_cast<ObjCQualifiedInterfaceType>(this))
|
|
||||||
return QIT->getNumProtocols();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inline function definitions.
|
// Inline function definitions.
|
||||||
|
|
||||||
/// getUnqualifiedType - Return the type without any qualifiers.
|
/// getUnqualifiedType - Return the type without any qualifiers.
|
||||||
|
@ -2193,9 +2132,6 @@ inline bool Type::isObjCObjectPointerType() const {
|
||||||
inline bool Type::isObjCInterfaceType() const {
|
inline bool Type::isObjCInterfaceType() const {
|
||||||
return isa<ObjCInterfaceType>(CanonicalType.getUnqualifiedType());
|
return isa<ObjCInterfaceType>(CanonicalType.getUnqualifiedType());
|
||||||
}
|
}
|
||||||
inline bool Type::isObjCQualifiedInterfaceType() const {
|
|
||||||
return isa<ObjCQualifiedInterfaceType>(CanonicalType.getUnqualifiedType());
|
|
||||||
}
|
|
||||||
inline bool Type::isObjCQualifiedIdType() const {
|
inline bool Type::isObjCQualifiedIdType() const {
|
||||||
if (const ObjCObjectPointerType *OPT = getAsObjCObjectPointerType())
|
if (const ObjCObjectPointerType *OPT = getAsObjCObjectPointerType())
|
||||||
return OPT->isObjCQualifiedIdType();
|
return OPT->isObjCQualifiedIdType();
|
||||||
|
|
|
@ -81,7 +81,6 @@ NON_CANONICAL_TYPE(QualifiedName, Type)
|
||||||
DEPENDENT_TYPE(Typename, Type)
|
DEPENDENT_TYPE(Typename, Type)
|
||||||
TYPE(ObjCInterface, Type)
|
TYPE(ObjCInterface, Type)
|
||||||
TYPE(ObjCObjectPointer, Type)
|
TYPE(ObjCObjectPointer, Type)
|
||||||
TYPE(ObjCQualifiedInterface, ObjCInterfaceType)
|
|
||||||
|
|
||||||
#undef DEPENDENT_TYPE
|
#undef DEPENDENT_TYPE
|
||||||
#undef NON_CANONICAL_TYPE
|
#undef NON_CANONICAL_TYPE
|
||||||
|
|
|
@ -396,16 +396,14 @@ namespace clang {
|
||||||
TYPE_ENUM = 20,
|
TYPE_ENUM = 20,
|
||||||
/// \brief An ObjCInterfaceType record.
|
/// \brief An ObjCInterfaceType record.
|
||||||
TYPE_OBJC_INTERFACE = 21,
|
TYPE_OBJC_INTERFACE = 21,
|
||||||
/// \brief An ObjCQualifiedInterfaceType record.
|
|
||||||
TYPE_OBJC_QUALIFIED_INTERFACE = 22,
|
|
||||||
/// \brief An ObjCObjectPointerType record.
|
/// \brief An ObjCObjectPointerType record.
|
||||||
TYPE_OBJC_OBJECT_POINTER = 23,
|
TYPE_OBJC_OBJECT_POINTER = 22,
|
||||||
/// \brief a DecltypeType record.
|
/// \brief a DecltypeType record.
|
||||||
TYPE_DECLTYPE = 24,
|
TYPE_DECLTYPE = 23,
|
||||||
/// \brief A ConstantArrayWithExprType record.
|
/// \brief A ConstantArrayWithExprType record.
|
||||||
TYPE_CONSTANT_ARRAY_WITH_EXPR = 25,
|
TYPE_CONSTANT_ARRAY_WITH_EXPR = 24,
|
||||||
/// \brief A ConstantArrayWithoutExprType record.
|
/// \brief A ConstantArrayWithoutExprType record.
|
||||||
TYPE_CONSTANT_ARRAY_WITHOUT_EXPR = 26
|
TYPE_CONSTANT_ARRAY_WITHOUT_EXPR = 25
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief The type IDs for special types constructed by semantic
|
/// \brief The type IDs for special types constructed by semantic
|
||||||
|
|
|
@ -256,10 +256,6 @@ NODE_XML(ObjCInterfaceType, "ObjCInterfaceType")
|
||||||
ID_ATTRIBUTE_XML
|
ID_ATTRIBUTE_XML
|
||||||
END_NODE_XML
|
END_NODE_XML
|
||||||
|
|
||||||
NODE_XML(ObjCQualifiedInterfaceType, "ObjCQualifiedInterfaceType")
|
|
||||||
ID_ATTRIBUTE_XML
|
|
||||||
END_NODE_XML
|
|
||||||
|
|
||||||
NODE_XML(ObjCObjectPointerType, "ObjCObjectPointerType")
|
NODE_XML(ObjCObjectPointerType, "ObjCObjectPointerType")
|
||||||
ID_ATTRIBUTE_XML
|
ID_ATTRIBUTE_XML
|
||||||
END_NODE_XML
|
END_NODE_XML
|
||||||
|
|
|
@ -600,7 +600,6 @@ ASTContext::getTypeInfo(const Type *T) {
|
||||||
// alignment requirements: getPointerInfo should take an AddrSpace.
|
// alignment requirements: getPointerInfo should take an AddrSpace.
|
||||||
return getTypeInfo(QualType(cast<ExtQualType>(T)->getBaseType(), 0));
|
return getTypeInfo(QualType(cast<ExtQualType>(T)->getBaseType(), 0));
|
||||||
case Type::ObjCObjectPointer:
|
case Type::ObjCObjectPointer:
|
||||||
case Type::ObjCQualifiedInterface:
|
|
||||||
Width = Target.getPointerWidth(0);
|
Width = Target.getPointerWidth(0);
|
||||||
Align = Target.getPointerAlign(0);
|
Align = Target.getPointerAlign(0);
|
||||||
break;
|
break;
|
||||||
|
@ -1703,17 +1702,6 @@ QualType ASTContext::getTypedefType(TypedefDecl *Decl) {
|
||||||
return QualType(Decl->TypeForDecl, 0);
|
return QualType(Decl->TypeForDecl, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getObjCInterfaceType - Return the unique reference to the type for the
|
|
||||||
/// specified ObjC interface decl.
|
|
||||||
QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl) {
|
|
||||||
if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
|
|
||||||
|
|
||||||
ObjCInterfaceDecl *OID = const_cast<ObjCInterfaceDecl*>(Decl);
|
|
||||||
Decl->TypeForDecl = new(*this,8) ObjCInterfaceType(Type::ObjCInterface, OID);
|
|
||||||
Types.push_back(Decl->TypeForDecl);
|
|
||||||
return QualType(Decl->TypeForDecl, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \brief Retrieve the template type parameter type for a template
|
/// \brief Retrieve the template type parameter type for a template
|
||||||
/// parameter or parameter pack with the given depth, index, and (optionally)
|
/// parameter or parameter pack with the given depth, index, and (optionally)
|
||||||
/// name.
|
/// name.
|
||||||
|
@ -1896,27 +1884,28 @@ QualType ASTContext::getObjCObjectPointerType(QualType InterfaceT,
|
||||||
return QualType(QType, 0);
|
return QualType(QType, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getObjCQualifiedInterfaceType - Return a ObjCQualifiedInterfaceType type for
|
/// getObjCInterfaceType - Return the unique reference to the type for the
|
||||||
/// the given interface decl and the conforming protocol list.
|
/// specified ObjC interface decl. The list of protocols is optional.
|
||||||
QualType ASTContext::getObjCQualifiedInterfaceType(ObjCInterfaceDecl *Decl,
|
QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
|
||||||
ObjCProtocolDecl **Protocols, unsigned NumProtocols) {
|
ObjCProtocolDecl **Protocols, unsigned NumProtocols) {
|
||||||
|
if (NumProtocols)
|
||||||
// Sort the protocol list alphabetically to canonicalize it.
|
// Sort the protocol list alphabetically to canonicalize it.
|
||||||
SortAndUniqueProtocols(Protocols, NumProtocols);
|
SortAndUniqueProtocols(Protocols, NumProtocols);
|
||||||
|
|
||||||
llvm::FoldingSetNodeID ID;
|
llvm::FoldingSetNodeID ID;
|
||||||
ObjCQualifiedInterfaceType::Profile(ID, Decl, Protocols, NumProtocols);
|
ObjCInterfaceType::Profile(ID, Decl, Protocols, NumProtocols);
|
||||||
|
|
||||||
void *InsertPos = 0;
|
void *InsertPos = 0;
|
||||||
if (ObjCQualifiedInterfaceType *QT =
|
if (ObjCInterfaceType *QT =
|
||||||
ObjCQualifiedInterfaceTypes.FindNodeOrInsertPos(ID, InsertPos))
|
ObjCInterfaceTypes.FindNodeOrInsertPos(ID, InsertPos))
|
||||||
return QualType(QT, 0);
|
return QualType(QT, 0);
|
||||||
|
|
||||||
// No Match;
|
// No Match;
|
||||||
ObjCQualifiedInterfaceType *QType =
|
ObjCInterfaceType *QType =
|
||||||
new (*this,8) ObjCQualifiedInterfaceType(Decl, Protocols, NumProtocols);
|
new (*this,8) ObjCInterfaceType(const_cast<ObjCInterfaceDecl*>(Decl),
|
||||||
|
Protocols, NumProtocols);
|
||||||
Types.push_back(QType);
|
Types.push_back(QType);
|
||||||
ObjCQualifiedInterfaceTypes.InsertNode(QType, InsertPos);
|
ObjCInterfaceTypes.InsertNode(QType, InsertPos);
|
||||||
return QualType(QType, 0);
|
return QualType(QType, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3193,30 +3182,23 @@ bool ASTContext::canAssignObjCInterfaces(const ObjCInterfaceType *LHS,
|
||||||
|
|
||||||
// RHS must have a superset of the protocols in the LHS. If the LHS is not
|
// RHS must have a superset of the protocols in the LHS. If the LHS is not
|
||||||
// protocol qualified at all, then we are good.
|
// protocol qualified at all, then we are good.
|
||||||
if (!isa<ObjCQualifiedInterfaceType>(LHS))
|
if (LHS->getNumProtocols() == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Okay, we know the LHS has protocol qualifiers. If the RHS doesn't, then it
|
// Okay, we know the LHS has protocol qualifiers. If the RHS doesn't, then it
|
||||||
// isn't a superset.
|
// isn't a superset.
|
||||||
if (!isa<ObjCQualifiedInterfaceType>(RHS))
|
if (RHS->getNumProtocols() == 0)
|
||||||
return true; // FIXME: should return false!
|
return true; // FIXME: should return false!
|
||||||
|
|
||||||
// Finally, we must have two protocol-qualified interfaces.
|
for (ObjCInterfaceType::qual_iterator LHSPI = LHS->qual_begin(),
|
||||||
const ObjCQualifiedInterfaceType *LHSP =cast<ObjCQualifiedInterfaceType>(LHS);
|
LHSPE = LHS->qual_end();
|
||||||
const ObjCQualifiedInterfaceType *RHSP =cast<ObjCQualifiedInterfaceType>(RHS);
|
|
||||||
|
|
||||||
// All LHS protocols must have a presence on the RHS.
|
|
||||||
assert(LHSP->qual_begin() != LHSP->qual_end() && "Empty LHS protocol list?");
|
|
||||||
|
|
||||||
for (ObjCQualifiedInterfaceType::qual_iterator LHSPI = LHSP->qual_begin(),
|
|
||||||
LHSPE = LHSP->qual_end();
|
|
||||||
LHSPI != LHSPE; LHSPI++) {
|
LHSPI != LHSPE; LHSPI++) {
|
||||||
bool RHSImplementsProtocol = false;
|
bool RHSImplementsProtocol = false;
|
||||||
|
|
||||||
// If the RHS doesn't implement the protocol on the left, the types
|
// If the RHS doesn't implement the protocol on the left, the types
|
||||||
// are incompatible.
|
// are incompatible.
|
||||||
for (ObjCQualifiedInterfaceType::qual_iterator RHSPI = RHSP->qual_begin(),
|
for (ObjCInterfaceType::qual_iterator RHSPI = RHS->qual_begin(),
|
||||||
RHSPE = RHSP->qual_end();
|
RHSPE = RHS->qual_end();
|
||||||
RHSPI != RHSPE; RHSPI++) {
|
RHSPI != RHSPE; RHSPI++) {
|
||||||
if ((*RHSPI)->lookupProtocolNamed((*LHSPI)->getIdentifier())) {
|
if ((*RHSPI)->lookupProtocolNamed((*LHSPI)->getIdentifier())) {
|
||||||
RHSImplementsProtocol = true;
|
RHSImplementsProtocol = true;
|
||||||
|
@ -3434,11 +3416,6 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) {
|
||||||
if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
|
if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
|
||||||
if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
|
if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
|
||||||
|
|
||||||
// Consider qualified interfaces and interfaces the same.
|
|
||||||
// FIXME: Remove (ObjCObjectPointerType should obsolete this funny business).
|
|
||||||
if (LHSClass == Type::ObjCQualifiedInterface) LHSClass = Type::ObjCInterface;
|
|
||||||
if (RHSClass == Type::ObjCQualifiedInterface) RHSClass = Type::ObjCInterface;
|
|
||||||
|
|
||||||
// If the canonical type classes don't match.
|
// If the canonical type classes don't match.
|
||||||
if (LHSClass != RHSClass) {
|
if (LHSClass != RHSClass) {
|
||||||
// C99 6.7.2.2p4: Each enumerated type shall be compatible with char,
|
// C99 6.7.2.2p4: Each enumerated type shall be compatible with char,
|
||||||
|
@ -3475,7 +3452,6 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) {
|
||||||
case Type::VariableArray:
|
case Type::VariableArray:
|
||||||
case Type::FunctionProto:
|
case Type::FunctionProto:
|
||||||
case Type::ExtVector:
|
case Type::ExtVector:
|
||||||
case Type::ObjCQualifiedInterface:
|
|
||||||
assert(false && "Types are eliminated above");
|
assert(false && "Types are eliminated above");
|
||||||
return QualType();
|
return QualType();
|
||||||
|
|
||||||
|
|
|
@ -475,19 +475,26 @@ const ObjCInterfaceType *Type::getAsObjCInterfaceType() const {
|
||||||
return dyn_cast<ObjCInterfaceType>(CanonicalType.getUnqualifiedType());
|
return dyn_cast<ObjCInterfaceType>(CanonicalType.getUnqualifiedType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ObjCInterfaceType *Type::getAsObjCQualifiedInterfaceType() const {
|
||||||
|
// There is no sugar for ObjCInterfaceType's, just return the canonical
|
||||||
|
// type pointer if it is the right class. There is no typedef information to
|
||||||
|
// return and these cannot be Address-space qualified.
|
||||||
|
if (const ObjCInterfaceType *OIT = getAsObjCInterfaceType())
|
||||||
|
if (OIT->getNumProtocols())
|
||||||
|
return OIT;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Type::isObjCQualifiedInterfaceType() const {
|
||||||
|
return getAsObjCQualifiedIdType() != 0;
|
||||||
|
}
|
||||||
|
|
||||||
const ObjCObjectPointerType *Type::getAsObjCObjectPointerType() const {
|
const ObjCObjectPointerType *Type::getAsObjCObjectPointerType() const {
|
||||||
// There is no sugar for ObjCObjectPointerType's, just return the
|
// There is no sugar for ObjCObjectPointerType's, just return the
|
||||||
// canonical type pointer if it is the right class.
|
// canonical type pointer if it is the right class.
|
||||||
return dyn_cast<ObjCObjectPointerType>(CanonicalType.getUnqualifiedType());
|
return dyn_cast<ObjCObjectPointerType>(CanonicalType.getUnqualifiedType());
|
||||||
}
|
}
|
||||||
|
|
||||||
const ObjCQualifiedInterfaceType *
|
|
||||||
Type::getAsObjCQualifiedInterfaceType() const {
|
|
||||||
// There is no sugar for ObjCQualifiedInterfaceType's, just return the
|
|
||||||
// canonical type pointer if it is the right class.
|
|
||||||
return dyn_cast<ObjCQualifiedInterfaceType>(CanonicalType.getUnqualifiedType());
|
|
||||||
}
|
|
||||||
|
|
||||||
const ObjCObjectPointerType *Type::getAsObjCQualifiedIdType() const {
|
const ObjCObjectPointerType *Type::getAsObjCQualifiedIdType() const {
|
||||||
// There is no sugar for ObjCQualifiedIdType's, just return the canonical
|
// There is no sugar for ObjCQualifiedIdType's, just return the canonical
|
||||||
// type pointer if it is the right class.
|
// type pointer if it is the right class.
|
||||||
|
@ -766,7 +773,6 @@ bool Type::isIncompleteType() const {
|
||||||
// An array of unknown size is an incomplete type (C99 6.2.5p22).
|
// An array of unknown size is an incomplete type (C99 6.2.5p22).
|
||||||
return true;
|
return true;
|
||||||
case ObjCInterface:
|
case ObjCInterface:
|
||||||
case ObjCQualifiedInterface:
|
|
||||||
// ObjC interfaces are incomplete if they are @class, not @interface.
|
// ObjC interfaces are incomplete if they are @class, not @interface.
|
||||||
return cast<ObjCInterfaceType>(this)->getDecl()->isForwardDecl();
|
return cast<ObjCInterfaceType>(this)->getDecl()->isForwardDecl();
|
||||||
}
|
}
|
||||||
|
@ -849,7 +855,6 @@ bool Type::isSpecifierType() const {
|
||||||
case QualifiedName:
|
case QualifiedName:
|
||||||
case Typename:
|
case Typename:
|
||||||
case ObjCInterface:
|
case ObjCInterface:
|
||||||
case ObjCQualifiedInterface:
|
|
||||||
case ObjCObjectPointer:
|
case ObjCObjectPointer:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
@ -931,19 +936,6 @@ void ObjCObjectPointerType::Profile(llvm::FoldingSetNodeID &ID) {
|
||||||
Profile(ID, getPointeeType(), 0, 0);
|
Profile(ID, getPointeeType(), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjCQualifiedInterfaceType::Profile(llvm::FoldingSetNodeID &ID,
|
|
||||||
const ObjCInterfaceDecl *Decl,
|
|
||||||
ObjCProtocolDecl **protocols,
|
|
||||||
unsigned NumProtocols) {
|
|
||||||
ID.AddPointer(Decl);
|
|
||||||
for (unsigned i = 0; i != NumProtocols; i++)
|
|
||||||
ID.AddPointer(protocols[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjCQualifiedInterfaceType::Profile(llvm::FoldingSetNodeID &ID) {
|
|
||||||
Profile(ID, getDecl(), &Protocols[0], getNumProtocols());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// LookThroughTypedefs - Return the ultimate type this typedef corresponds to
|
/// LookThroughTypedefs - Return the ultimate type this typedef corresponds to
|
||||||
/// potentially looking through *all* consequtive typedefs. This returns the
|
/// potentially looking through *all* consequtive typedefs. This returns the
|
||||||
/// sum of the type qualifiers, so if you have:
|
/// sum of the type qualifiers, so if you have:
|
||||||
|
@ -1566,10 +1558,41 @@ void TypenameType::getAsStringInternal(std::string &InnerString, const PrintingP
|
||||||
InnerString = MyString + ' ' + InnerString;
|
InnerString = MyString + ' ' + InnerString;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjCInterfaceType::getAsStringInternal(std::string &InnerString, const PrintingPolicy &Policy) const {
|
void ObjCInterfaceType::Profile(llvm::FoldingSetNodeID &ID,
|
||||||
|
const ObjCInterfaceDecl *Decl,
|
||||||
|
ObjCProtocolDecl **protocols,
|
||||||
|
unsigned NumProtocols) {
|
||||||
|
ID.AddPointer(Decl);
|
||||||
|
for (unsigned i = 0; i != NumProtocols; i++)
|
||||||
|
ID.AddPointer(protocols[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjCInterfaceType::Profile(llvm::FoldingSetNodeID &ID) {
|
||||||
|
if (getNumProtocols())
|
||||||
|
Profile(ID, getDecl(), &Protocols[0], getNumProtocols());
|
||||||
|
else
|
||||||
|
Profile(ID, getDecl(), 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjCInterfaceType::getAsStringInternal(std::string &InnerString,
|
||||||
|
const PrintingPolicy &Policy) const {
|
||||||
if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'.
|
if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'.
|
||||||
InnerString = ' ' + InnerString;
|
InnerString = ' ' + InnerString;
|
||||||
InnerString = getDecl()->getIdentifier()->getName() + InnerString;
|
|
||||||
|
std::string ObjCQIString = getDecl()->getNameAsString();
|
||||||
|
if (getNumProtocols()) {
|
||||||
|
ObjCQIString += '<';
|
||||||
|
bool isFirst = true;
|
||||||
|
for (qual_iterator I = qual_begin(), E = qual_end(); I != E; ++I) {
|
||||||
|
if (isFirst)
|
||||||
|
isFirst = false;
|
||||||
|
else
|
||||||
|
ObjCQIString += ',';
|
||||||
|
ObjCQIString += (*I)->getNameAsString();
|
||||||
|
}
|
||||||
|
ObjCQIString += '>';
|
||||||
|
}
|
||||||
|
InnerString = ObjCQIString + InnerString;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjCObjectPointerType::getAsStringInternal(std::string &InnerString,
|
void ObjCObjectPointerType::getAsStringInternal(std::string &InnerString,
|
||||||
|
@ -1600,25 +1623,6 @@ void ObjCObjectPointerType::getAsStringInternal(std::string &InnerString,
|
||||||
InnerString = ObjCQIString + InnerString;
|
InnerString = ObjCQIString + InnerString;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ObjCQualifiedInterfaceType::getAsStringInternal(std::string &InnerString,
|
|
||||||
const PrintingPolicy &Policy) const {
|
|
||||||
if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'.
|
|
||||||
InnerString = ' ' + InnerString;
|
|
||||||
std::string ObjCQIString = getDecl()->getNameAsString();
|
|
||||||
ObjCQIString += '<';
|
|
||||||
bool isFirst = true;
|
|
||||||
for (qual_iterator I = qual_begin(), E = qual_end(); I != E; ++I) {
|
|
||||||
if (isFirst)
|
|
||||||
isFirst = false;
|
|
||||||
else
|
|
||||||
ObjCQIString += ',';
|
|
||||||
ObjCQIString += (*I)->getNameAsString();
|
|
||||||
}
|
|
||||||
ObjCQIString += '>';
|
|
||||||
InnerString = ObjCQIString + InnerString;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TagType::getAsStringInternal(std::string &InnerString, const PrintingPolicy &Policy) const {
|
void TagType::getAsStringInternal(std::string &InnerString, const PrintingPolicy &Policy) const {
|
||||||
if (Policy.SuppressTag)
|
if (Policy.SuppressTag)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -779,7 +779,6 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty,
|
||||||
return llvm::DIType();
|
return llvm::DIType();
|
||||||
case Type::ObjCObjectPointer:
|
case Type::ObjCObjectPointer:
|
||||||
return Slot = CreateType(cast<ObjCObjectPointerType>(Ty), Unit);
|
return Slot = CreateType(cast<ObjCObjectPointerType>(Ty), Unit);
|
||||||
case Type::ObjCQualifiedInterface: // Drop protocols from interface.
|
|
||||||
case Type::ObjCInterface:
|
case Type::ObjCInterface:
|
||||||
return Slot = CreateType(cast<ObjCInterfaceType>(Ty), Unit);
|
return Slot = CreateType(cast<ObjCInterfaceType>(Ty), Unit);
|
||||||
case Type::Builtin: return Slot = CreateType(cast<BuiltinType>(Ty), Unit);
|
case Type::Builtin: return Slot = CreateType(cast<BuiltinType>(Ty), Unit);
|
||||||
|
|
|
@ -341,12 +341,6 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
|
||||||
return
|
return
|
||||||
ConvertTypeRecursive(QualType(cast<ExtQualType>(Ty).getBaseType(), 0));
|
ConvertTypeRecursive(QualType(cast<ExtQualType>(Ty).getBaseType(), 0));
|
||||||
|
|
||||||
case Type::ObjCQualifiedInterface: {
|
|
||||||
// Lower foo<P1,P2> just like foo.
|
|
||||||
ObjCInterfaceDecl *ID = cast<ObjCQualifiedInterfaceType>(Ty).getDecl();
|
|
||||||
return ConvertTypeRecursive(Context.getObjCInterfaceType(ID));
|
|
||||||
}
|
|
||||||
|
|
||||||
case Type::ObjCInterface: {
|
case Type::ObjCInterface: {
|
||||||
// Objective-C interfaces are always opaque (outside of the
|
// Objective-C interfaces are always opaque (outside of the
|
||||||
// runtime, which can do whatever it likes); we never refine
|
// runtime, which can do whatever it likes); we never refine
|
||||||
|
|
|
@ -1918,19 +1918,14 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) {
|
||||||
assert(Record.size() == 1 && "incorrect encoding of enum type");
|
assert(Record.size() == 1 && "incorrect encoding of enum type");
|
||||||
return Context->getTypeDeclType(cast<EnumDecl>(GetDecl(Record[0])));
|
return Context->getTypeDeclType(cast<EnumDecl>(GetDecl(Record[0])));
|
||||||
|
|
||||||
case pch::TYPE_OBJC_INTERFACE:
|
case pch::TYPE_OBJC_INTERFACE: {
|
||||||
assert(Record.size() == 1 && "incorrect encoding of objc interface type");
|
|
||||||
return Context->getObjCInterfaceType(
|
|
||||||
cast<ObjCInterfaceDecl>(GetDecl(Record[0])));
|
|
||||||
|
|
||||||
case pch::TYPE_OBJC_QUALIFIED_INTERFACE: {
|
|
||||||
unsigned Idx = 0;
|
unsigned Idx = 0;
|
||||||
ObjCInterfaceDecl *ItfD = cast<ObjCInterfaceDecl>(GetDecl(Record[Idx++]));
|
ObjCInterfaceDecl *ItfD = cast<ObjCInterfaceDecl>(GetDecl(Record[Idx++]));
|
||||||
unsigned NumProtos = Record[Idx++];
|
unsigned NumProtos = Record[Idx++];
|
||||||
llvm::SmallVector<ObjCProtocolDecl*, 4> Protos;
|
llvm::SmallVector<ObjCProtocolDecl*, 4> Protos;
|
||||||
for (unsigned I = 0; I != NumProtos; ++I)
|
for (unsigned I = 0; I != NumProtos; ++I)
|
||||||
Protos.push_back(cast<ObjCProtocolDecl>(GetDecl(Record[Idx++])));
|
Protos.push_back(cast<ObjCProtocolDecl>(GetDecl(Record[Idx++])));
|
||||||
return Context->getObjCQualifiedInterfaceType(ItfD, Protos.data(), NumProtos);
|
return Context->getObjCInterfaceType(ItfD, Protos.data(), NumProtos);
|
||||||
}
|
}
|
||||||
|
|
||||||
case pch::TYPE_OBJC_OBJECT_POINTER: {
|
case pch::TYPE_OBJC_OBJECT_POINTER: {
|
||||||
|
@ -1995,7 +1990,7 @@ QualType PCHReader::GetType(pch::TypeID ID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Index -= pch::NUM_PREDEF_TYPE_IDS;
|
Index -= pch::NUM_PREDEF_TYPE_IDS;
|
||||||
assert(Index < TypesLoaded.size() && "Type index out-of-range");
|
//assert(Index < TypesLoaded.size() && "Type index out-of-range");
|
||||||
if (!TypesLoaded[Index])
|
if (!TypesLoaded[Index])
|
||||||
TypesLoaded[Index] = ReadTypeRecord(TypeOffsets[Index]).getTypePtr();
|
TypesLoaded[Index] = ReadTypeRecord(TypeOffsets[Index]).getTypePtr();
|
||||||
|
|
||||||
|
|
|
@ -239,18 +239,11 @@ void PCHTypeWriter::VisitQualifiedNameType(const QualifiedNameType *T) {
|
||||||
|
|
||||||
void PCHTypeWriter::VisitObjCInterfaceType(const ObjCInterfaceType *T) {
|
void PCHTypeWriter::VisitObjCInterfaceType(const ObjCInterfaceType *T) {
|
||||||
Writer.AddDeclRef(T->getDecl(), Record);
|
Writer.AddDeclRef(T->getDecl(), Record);
|
||||||
Code = pch::TYPE_OBJC_INTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
PCHTypeWriter::VisitObjCQualifiedInterfaceType(
|
|
||||||
const ObjCQualifiedInterfaceType *T) {
|
|
||||||
VisitObjCInterfaceType(T);
|
|
||||||
Record.push_back(T->getNumProtocols());
|
Record.push_back(T->getNumProtocols());
|
||||||
for (ObjCInterfaceType::qual_iterator I = T->qual_begin(),
|
for (ObjCInterfaceType::qual_iterator I = T->qual_begin(),
|
||||||
E = T->qual_end(); I != E; ++I)
|
E = T->qual_end(); I != E; ++I)
|
||||||
Writer.AddDeclRef(*I, Record);
|
Writer.AddDeclRef(*I, Record);
|
||||||
Code = pch::TYPE_OBJC_QUALIFIED_INTERFACE;
|
Code = pch::TYPE_OBJC_INTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -433,7 +426,6 @@ void PCHWriter::WriteBlockInfoBlock() {
|
||||||
RECORD(TYPE_RECORD);
|
RECORD(TYPE_RECORD);
|
||||||
RECORD(TYPE_ENUM);
|
RECORD(TYPE_ENUM);
|
||||||
RECORD(TYPE_OBJC_INTERFACE);
|
RECORD(TYPE_OBJC_INTERFACE);
|
||||||
RECORD(TYPE_OBJC_QUALIFIED_INTERFACE);
|
|
||||||
RECORD(TYPE_OBJC_OBJECT_POINTER);
|
RECORD(TYPE_OBJC_OBJECT_POINTER);
|
||||||
// Statements and Exprs can occur in the Types block.
|
// Statements and Exprs can occur in the Types block.
|
||||||
AddStmtsExprs(Stream, Record);
|
AddStmtsExprs(Stream, Record);
|
||||||
|
@ -1844,6 +1836,18 @@ void PCHWriter::WritePCH(Sema &SemaRef, MemorizeStatCalls *StatCalls,
|
||||||
WriteSourceManagerBlock(Context.getSourceManager(), PP, isysroot);
|
WriteSourceManagerBlock(Context.getSourceManager(), PP, isysroot);
|
||||||
WritePreprocessor(PP);
|
WritePreprocessor(PP);
|
||||||
WriteComments(Context);
|
WriteComments(Context);
|
||||||
|
// Write the record of special types.
|
||||||
|
Record.clear();
|
||||||
|
|
||||||
|
AddTypeRef(Context.getBuiltinVaListType(), Record);
|
||||||
|
AddTypeRef(Context.getObjCIdType(), Record);
|
||||||
|
AddTypeRef(Context.getObjCSelType(), Record);
|
||||||
|
AddTypeRef(Context.getObjCProtoType(), Record);
|
||||||
|
AddTypeRef(Context.getObjCClassType(), Record);
|
||||||
|
AddTypeRef(Context.getRawCFConstantStringType(), Record);
|
||||||
|
AddTypeRef(Context.getRawObjCFastEnumerationStateType(), Record);
|
||||||
|
AddTypeRef(Context.getFILEType(), Record);
|
||||||
|
Stream.EmitRecord(pch::SPECIAL_TYPES, Record);
|
||||||
|
|
||||||
// Keep writing types and declarations until all types and
|
// Keep writing types and declarations until all types and
|
||||||
// declarations have been written.
|
// declarations have been written.
|
||||||
|
@ -1883,18 +1887,6 @@ void PCHWriter::WritePCH(Sema &SemaRef, MemorizeStatCalls *StatCalls,
|
||||||
(const char *)&DeclOffsets.front(),
|
(const char *)&DeclOffsets.front(),
|
||||||
DeclOffsets.size() * sizeof(DeclOffsets[0]));
|
DeclOffsets.size() * sizeof(DeclOffsets[0]));
|
||||||
|
|
||||||
// Write the record of special types.
|
|
||||||
Record.clear();
|
|
||||||
AddTypeRef(Context.getBuiltinVaListType(), Record);
|
|
||||||
AddTypeRef(Context.getObjCIdType(), Record);
|
|
||||||
AddTypeRef(Context.getObjCSelType(), Record);
|
|
||||||
AddTypeRef(Context.getObjCProtoType(), Record);
|
|
||||||
AddTypeRef(Context.getObjCClassType(), Record);
|
|
||||||
AddTypeRef(Context.getRawCFConstantStringType(), Record);
|
|
||||||
AddTypeRef(Context.getRawObjCFastEnumerationStateType(), Record);
|
|
||||||
AddTypeRef(Context.getFILEType(), Record);
|
|
||||||
Stream.EmitRecord(pch::SPECIAL_TYPES, Record);
|
|
||||||
|
|
||||||
// Write the record containing external, unnamed definitions.
|
// Write the record containing external, unnamed definitions.
|
||||||
if (!ExternalDefinitions.empty())
|
if (!ExternalDefinitions.empty())
|
||||||
Stream.EmitRecord(pch::EXTERNAL_DEFINITIONS, ExternalDefinitions);
|
Stream.EmitRecord(pch::EXTERNAL_DEFINITIONS, ExternalDefinitions);
|
||||||
|
|
|
@ -1820,16 +1820,7 @@ static void scanToNextArgument(const char *&argRef) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RewriteObjC::needToScanForQualifiers(QualType T) {
|
bool RewriteObjC::needToScanForQualifiers(QualType T) {
|
||||||
|
return T->isObjCQualifiedIdType() || T->isObjCQualifiedInterfaceType();
|
||||||
if (T->isObjCQualifiedIdType())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (const PointerType *pType = T->getAsPointerType()) {
|
|
||||||
Type *pointeeType = pType->getPointeeType().getTypePtr();
|
|
||||||
if (isa<ObjCQualifiedInterfaceType>(pointeeType))
|
|
||||||
return true; // we have "Class <Protocol> *".
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RewriteObjC::RewriteObjCQualifiedInterfaceTypes(Expr *E) {
|
void RewriteObjC::RewriteObjCQualifiedInterfaceTypes(Expr *E) {
|
||||||
|
|
|
@ -860,7 +860,7 @@ bool Sema::ObjCQualifiedIdTypesAreCompatible(QualType lhs, QualType rhs,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QualType ltype = lhs->getAsPointerType()->getPointeeType();
|
QualType ltype = lhs->getAsPointerType()->getPointeeType();
|
||||||
if (const ObjCQualifiedInterfaceType *lhsQI =
|
if (const ObjCInterfaceType *lhsQI =
|
||||||
ltype->getAsObjCQualifiedInterfaceType()) {
|
ltype->getAsObjCQualifiedInterfaceType()) {
|
||||||
ObjCObjectPointerType::qual_iterator LHSProtoI = lhsQI->qual_begin();
|
ObjCObjectPointerType::qual_iterator LHSProtoI = lhsQI->qual_begin();
|
||||||
ObjCObjectPointerType::qual_iterator LHSProtoE = lhsQI->qual_end();
|
ObjCObjectPointerType::qual_iterator LHSProtoE = lhsQI->qual_end();
|
||||||
|
|
|
@ -1537,7 +1537,6 @@ MarkDeducedTemplateParameters(Sema &SemaRef, QualType T,
|
||||||
case Type::Enum:
|
case Type::Enum:
|
||||||
case Type::Typename:
|
case Type::Typename:
|
||||||
case Type::ObjCInterface:
|
case Type::ObjCInterface:
|
||||||
case Type::ObjCQualifiedInterface:
|
|
||||||
case Type::ObjCObjectPointer:
|
case Type::ObjCObjectPointer:
|
||||||
#define TYPE(Class, Base)
|
#define TYPE(Class, Base)
|
||||||
#define ABSTRACT_TYPE(Class, Base)
|
#define ABSTRACT_TYPE(Class, Base)
|
||||||
|
|
|
@ -735,14 +735,6 @@ InstantiateObjCInterfaceType(const ObjCInterfaceType *T) const {
|
||||||
return QualType();
|
return QualType();
|
||||||
}
|
}
|
||||||
|
|
||||||
QualType
|
|
||||||
TemplateTypeInstantiator::
|
|
||||||
InstantiateObjCQualifiedInterfaceType(
|
|
||||||
const ObjCQualifiedInterfaceType *T) const {
|
|
||||||
assert(false && "Objective-C types cannot be dependent");
|
|
||||||
return QualType();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \brief The actual implementation of Sema::InstantiateType().
|
/// \brief The actual implementation of Sema::InstantiateType().
|
||||||
QualType TemplateTypeInstantiator::Instantiate(QualType T) const {
|
QualType TemplateTypeInstantiator::Instantiate(QualType T) const {
|
||||||
// If T is not a dependent type, there is nothing to do.
|
// If T is not a dependent type, there is nothing to do.
|
||||||
|
|
|
@ -208,9 +208,10 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS,
|
||||||
// FIXME: Adding a TST_objcInterface clause doesn't seem ideal, so we have
|
// FIXME: Adding a TST_objcInterface clause doesn't seem ideal, so we have
|
||||||
// this "hack" for now...
|
// this "hack" for now...
|
||||||
if (const ObjCInterfaceType *Interface = Result->getAsObjCInterfaceType())
|
if (const ObjCInterfaceType *Interface = Result->getAsObjCInterfaceType())
|
||||||
// FIXME: Remove ObjCQualifiedInterfaceType (by moving the list of
|
// FIXME: Investigate removing the protocol list in ObjCInterfaceType.
|
||||||
// protocols 'up' to ObjCInterfaceType).
|
// To simply this, Sema::GetTypeForDeclarator() uses the declspec
|
||||||
Result = Context.getObjCQualifiedInterfaceType(Interface->getDecl(),
|
// protocol list, not the list we are storing here.
|
||||||
|
Result = Context.getObjCInterfaceType(Interface->getDecl(),
|
||||||
(ObjCProtocolDecl**)PQ,
|
(ObjCProtocolDecl**)PQ,
|
||||||
DS.getNumProtocolQualifiers());
|
DS.getNumProtocolQualifiers());
|
||||||
else if (Result->isObjCIdType())
|
else if (Result->isObjCIdType())
|
||||||
|
@ -900,10 +901,10 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip,
|
||||||
// Build the type anyway.
|
// Build the type anyway.
|
||||||
}
|
}
|
||||||
if (getLangOptions().ObjC1 && T->isObjCInterfaceType()) {
|
if (getLangOptions().ObjC1 && T->isObjCInterfaceType()) {
|
||||||
const ObjCInterfaceType *OIT = T->getAsObjCInterfaceType();
|
const DeclSpec &DS = D.getDeclSpec();
|
||||||
T = Context.getObjCObjectPointerType(T,
|
T = Context.getObjCObjectPointerType(T,
|
||||||
(ObjCProtocolDecl **)OIT->qual_begin(),
|
(ObjCProtocolDecl **)DS.getProtocolQualifiers(),
|
||||||
OIT->getNumProtocols());
|
DS.getNumProtocolQualifiers());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
T = BuildPointerType(T, DeclType.Ptr.TypeQuals, DeclType.Loc, Name);
|
T = BuildPointerType(T, DeclType.Ptr.TypeQuals, DeclType.Loc, Name);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче