diff options
author | Manman Ren <manman.ren@gmail.com> | 2016-08-20 00:04:21 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2016-08-20 00:04:21 +0000 |
commit | a40556d57b31750252e0ccc6650f5e4bcdd459d3 (patch) | |
tree | 1173d50c1e89ff38196a73bce53a407551ad6421 /lib/AST/Type.cpp | |
parent | d3aa353811729b890cfbf06a958f816f4cc30e7f (diff) |
[NFC] Add a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.
This is in preparation of adding a new type class ObjCTypeParamType that
can take protocol qualifiers. ObjCProtocolQualifiers will be shared between
ObjCObjectType and ObjCTypeParamType.
rdar://24619481
rdar://25060179
Differential Revision: http://reviews.llvm.org/D23078
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279351 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r-- | lib/AST/Type.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 4c1d4ec540..2629aecbe5 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -546,15 +546,9 @@ ObjCObjectType::ObjCObjectType(QualType Canonical, QualType Base, ObjCObjectTypeBits.NumTypeArgs = typeArgs.size(); assert(getTypeArgsAsWritten().size() == typeArgs.size() && "bitfield overflow in type argument count"); - ObjCObjectTypeBits.NumProtocols = protocols.size(); - assert(getNumProtocols() == protocols.size() && - "bitfield overflow in protocol count"); if (!typeArgs.empty()) memcpy(getTypeArgStorage(), typeArgs.data(), typeArgs.size() * sizeof(QualType)); - if (!protocols.empty()) - memcpy(getProtocolStorage(), protocols.data(), - protocols.size() * sizeof(ObjCProtocolDecl*)); for (auto typeArg : typeArgs) { if (typeArg->isDependentType()) @@ -565,6 +559,9 @@ ObjCObjectType::ObjCObjectType(QualType Canonical, QualType Base, if (typeArg->containsUnexpandedParameterPack()) setContainsUnexpandedParameterPack(); } + // Initialize the protocol qualifiers. The protocol storage is known + // after we set number of type arguments. + initialize(protocols); } bool ObjCObjectType::isSpecialized() const { |