diff options
Diffstat (limited to 'include/clang/AST/DeclObjC.h')
-rw-r--r-- | include/clang/AST/DeclObjC.h | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index c42764b6f3bf..f46078f28a7d 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -612,7 +612,8 @@ public: /// @interface NSArray<T> // stores the <T> /// @end /// \endcode -class ObjCTypeParamList { +class ObjCTypeParamList final + : private llvm::TrailingObjects<ObjCTypeParamList, ObjCTypeParamDecl *> { /// Stores the components of a SourceRange as a POD. struct PODSourceRange { unsigned Begin; @@ -644,7 +645,7 @@ public: /// Iterate through the type parameters in the list. typedef ObjCTypeParamDecl **iterator; - iterator begin() { return reinterpret_cast<ObjCTypeParamDecl **>(this + 1); } + iterator begin() { return getTrailingObjects<ObjCTypeParamDecl *>(); } iterator end() { return begin() + size(); } @@ -655,7 +656,7 @@ public: typedef ObjCTypeParamDecl * const *const_iterator; const_iterator begin() const { - return reinterpret_cast<ObjCTypeParamDecl * const *>(this + 1); + return getTrailingObjects<ObjCTypeParamDecl *>(); } const_iterator end() const { @@ -685,6 +686,7 @@ public: /// Gather the default set of type arguments to be substituted for /// these type parameters when dealing with an unspecialized type. void gatherDefaultTypeArgs(SmallVectorImpl<QualType> &typeArgs) const; + friend TrailingObjects; }; /// ObjCContainerDecl - Represents a container for method declarations. @@ -1202,13 +1204,8 @@ public: // might bring in a definition. // Note: a null value indicates that we don't have a definition and that // modules are enabled. - if (!Data.getOpaqueValue()) { - if (IdentifierInfo *II = getIdentifier()) { - if (II->isOutOfDate()) { - updateOutOfDate(*II); - } - } - } + if (!Data.getOpaqueValue()) + getMostRecentDecl(); return Data.getPointer(); } @@ -1851,13 +1848,8 @@ public: // might bring in a definition. // Note: a null value indicates that we don't have a definition and that // modules are enabled. - if (!Data.getOpaqueValue()) { - if (IdentifierInfo *II = getIdentifier()) { - if (II->isOutOfDate()) { - updateOutOfDate(*II); - } - } - } + if (!Data.getOpaqueValue()) + getMostRecentDecl(); return Data.getPointer(); } @@ -2519,26 +2511,18 @@ public: void setPropertyAttributes(PropertyAttributeKind PRVal) { PropertyAttributes |= PRVal; } + void overwritePropertyAttributes(unsigned PRVal) { + PropertyAttributes = PRVal; + } PropertyAttributeKind getPropertyAttributesAsWritten() const { return PropertyAttributeKind(PropertyAttributesAsWritten); } - bool hasWrittenStorageAttribute() const { - return PropertyAttributesAsWritten & (OBJC_PR_assign | OBJC_PR_copy | - OBJC_PR_unsafe_unretained | OBJC_PR_retain | OBJC_PR_strong | - OBJC_PR_weak); - } - void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal) { PropertyAttributesAsWritten = PRVal; } - void makeitReadWriteAttribute() { - PropertyAttributes &= ~OBJC_PR_readonly; - PropertyAttributes |= OBJC_PR_readwrite; - } - // Helper methods for accessing attributes. /// isReadOnly - Return true iff the property has a setter. |