diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h index d48f8d55bf3129..954b9bc15789b6 100644 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -15,7 +15,6 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclBase.h" -#include "clang/AST/DeclObjCCommon.h" #include "clang/AST/ExternalASTSource.h" #include "clang/AST/Redeclarable.h" #include "clang/AST/SelectorLocationsKind.h" @@ -743,6 +742,34 @@ class ObjCPropertyDecl : public NamedDecl { void anchor() override; public: + enum PropertyAttributeKind { + OBJC_PR_noattr = 0x00, + OBJC_PR_readonly = 0x01, + OBJC_PR_getter = 0x02, + OBJC_PR_assign = 0x04, + OBJC_PR_readwrite = 0x08, + OBJC_PR_retain = 0x10, + OBJC_PR_copy = 0x20, + OBJC_PR_nonatomic = 0x40, + OBJC_PR_setter = 0x80, + OBJC_PR_atomic = 0x100, + OBJC_PR_weak = 0x200, + OBJC_PR_strong = 0x400, + OBJC_PR_unsafe_unretained = 0x800, + /// Indicates that the nullability of the type was spelled with a + /// property attribute rather than a type qualifier. + OBJC_PR_nullability = 0x1000, + OBJC_PR_null_resettable = 0x2000, + OBJC_PR_class = 0x4000, + OBJC_PR_direct = 0x8000 + // Adding a property should change NumPropertyAttrsBits + }; + + enum { + /// Number of bits fitting all the property attributes. + NumPropertyAttrsBits = 16 + }; + enum SetterKind { Assign, Retain, Copy, Weak }; enum PropertyControl { None, Required, Optional }; @@ -755,8 +782,8 @@ class ObjCPropertyDecl : public NamedDecl { QualType DeclType; TypeSourceInfo *DeclTypeSourceInfo; - unsigned PropertyAttributes : NumObjCPropertyAttrsBits; - unsigned PropertyAttributesAsWritten : NumObjCPropertyAttrsBits; + unsigned PropertyAttributes : NumPropertyAttrsBits; + unsigned PropertyAttributesAsWritten : NumPropertyAttrsBits; // \@required/\@optional unsigned PropertyImplementation : 2; @@ -783,14 +810,15 @@ class ObjCPropertyDecl : public NamedDecl { ObjCIvarDecl *PropertyIvarDecl = nullptr; ObjCPropertyDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - SourceLocation AtLocation, SourceLocation LParenLocation, - QualType T, TypeSourceInfo *TSI, PropertyControl propControl) - : NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation), - LParenLoc(LParenLocation), DeclType(T), DeclTypeSourceInfo(TSI), - PropertyAttributes(ObjCPropertyAttribute::kind_noattr), - PropertyAttributesAsWritten(ObjCPropertyAttribute::kind_noattr), - PropertyImplementation(propControl), GetterName(Selector()), - SetterName(Selector()) {} + SourceLocation AtLocation, SourceLocation LParenLocation, + QualType T, TypeSourceInfo *TSI, + PropertyControl propControl) + : NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation), + LParenLoc(LParenLocation), DeclType(T), DeclTypeSourceInfo(TSI), + PropertyAttributes(OBJC_PR_noattr), + PropertyAttributesAsWritten(OBJC_PR_noattr), + PropertyImplementation(propControl), GetterName(Selector()), + SetterName(Selector()) {} public: static ObjCPropertyDecl *Create(ASTContext &C, DeclContext *DC, @@ -822,11 +850,11 @@ class ObjCPropertyDecl : public NamedDecl { /// type. QualType getUsageType(QualType objectType) const; - ObjCPropertyAttribute::Kind getPropertyAttributes() const { - return ObjCPropertyAttribute::Kind(PropertyAttributes); + PropertyAttributeKind getPropertyAttributes() const { + return PropertyAttributeKind(PropertyAttributes); } - void setPropertyAttributes(ObjCPropertyAttribute::Kind PRVal) { + void setPropertyAttributes(PropertyAttributeKind PRVal) { PropertyAttributes |= PRVal; } @@ -834,11 +862,11 @@ class ObjCPropertyDecl : public NamedDecl { PropertyAttributes = PRVal; } - ObjCPropertyAttribute::Kind getPropertyAttributesAsWritten() const { - return ObjCPropertyAttribute::Kind(PropertyAttributesAsWritten); + PropertyAttributeKind getPropertyAttributesAsWritten() const { + return PropertyAttributeKind(PropertyAttributesAsWritten); } - void setPropertyAttributesAsWritten(ObjCPropertyAttribute::Kind PRVal) { + void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal) { PropertyAttributesAsWritten = PRVal; } @@ -846,28 +874,23 @@ class ObjCPropertyDecl : public NamedDecl { /// isReadOnly - Return true iff the property has a setter. bool isReadOnly() const { - return (PropertyAttributes & ObjCPropertyAttribute::kind_readonly); + return (PropertyAttributes & OBJC_PR_readonly); } /// isAtomic - Return true if the property is atomic. bool isAtomic() const { - return (PropertyAttributes & ObjCPropertyAttribute::kind_atomic); + return (PropertyAttributes & OBJC_PR_atomic); } /// isRetaining - Return true if the property retains its value. bool isRetaining() const { - return (PropertyAttributes & (ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_strong | - ObjCPropertyAttribute::kind_copy)); + return (PropertyAttributes & + (OBJC_PR_retain | OBJC_PR_strong | OBJC_PR_copy)); } bool isInstanceProperty() const { return !isClassProperty(); } - bool isClassProperty() const { - return PropertyAttributes & ObjCPropertyAttribute::kind_class; - } - bool isDirectProperty() const { - return PropertyAttributes & ObjCPropertyAttribute::kind_direct; - } + bool isClassProperty() const { return PropertyAttributes & OBJC_PR_class; } + bool isDirectProperty() const { return PropertyAttributes & OBJC_PR_direct; } ObjCPropertyQueryKind getQueryKind() const { return isClassProperty() ? ObjCPropertyQueryKind::OBJC_PR_query_class : @@ -883,13 +906,13 @@ class ObjCPropertyDecl : public NamedDecl { /// the property setter. This is only valid if the property has been /// defined to have a setter. SetterKind getSetterKind() const { - if (PropertyAttributes & ObjCPropertyAttribute::kind_strong) + if (PropertyAttributes & OBJC_PR_strong) return getType()->isBlockPointerType() ? Copy : Retain; - if (PropertyAttributes & ObjCPropertyAttribute::kind_retain) + if (PropertyAttributes & OBJC_PR_retain) return Retain; - if (PropertyAttributes & ObjCPropertyAttribute::kind_copy) + if (PropertyAttributes & OBJC_PR_copy) return Copy; - if (PropertyAttributes & ObjCPropertyAttribute::kind_weak) + if (PropertyAttributes & OBJC_PR_weak) return Weak; return Assign; } diff --git a/clang/include/clang/AST/DeclObjCCommon.h b/clang/include/clang/AST/DeclObjCCommon.h deleted file mode 100644 index 5f03bce6e9a89b..00000000000000 --- a/clang/include/clang/AST/DeclObjCCommon.h +++ /dev/null @@ -1,55 +0,0 @@ -//===- DeclObjCCommon.h - Classes for representing declarations -*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file contains common ObjC enums and classes used in AST and -// Sema. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_AST_DECLOBJC_COMMON_H -#define LLVM_CLANG_AST_DECLOBJC_COMMON_H - -namespace clang { - -/// ObjCPropertyAttribute::Kind - list of property attributes. -/// Keep this list in sync with LLVM's Dwarf.h ApplePropertyAttributes.s -namespace ObjCPropertyAttribute { -enum Kind { - kind_noattr = 0x00, - kind_readonly = 0x01, - kind_getter = 0x02, - kind_assign = 0x04, - kind_readwrite = 0x08, - kind_retain = 0x10, - kind_copy = 0x20, - kind_nonatomic = 0x40, - kind_setter = 0x80, - kind_atomic = 0x100, - kind_weak = 0x200, - kind_strong = 0x400, - kind_unsafe_unretained = 0x800, - /// Indicates that the nullability of the type was spelled with a - /// property attribute rather than a type qualifier. - kind_nullability = 0x1000, - kind_null_resettable = 0x2000, - kind_class = 0x4000, - kind_direct = 0x8000, - // Adding a property should change NumObjCPropertyAttrsBits - // Also, don't forget to update the Clang C API at CXObjCPropertyAttrKind and - // clang_Cursor_getObjCPropertyAttributes. -}; -} // namespace ObjCPropertyAttribute::Kind - -enum { - /// Number of bits fitting all the property attributes. - NumObjCPropertyAttrsBits = 16 -}; - -} // namespace clang - -#endif // LLVM_CLANG_AST_DECLOBJC_COMMON_H diff --git a/clang/include/clang/Sema/DeclSpec.h b/clang/include/clang/Sema/DeclSpec.h index 1327d92cd55943..5bc13fe343f499 100644 --- a/clang/include/clang/Sema/DeclSpec.h +++ b/clang/include/clang/Sema/DeclSpec.h @@ -23,7 +23,6 @@ #define LLVM_CLANG_SEMA_DECLSPEC_H #include "clang/AST/DeclCXX.h" -#include "clang/AST/DeclObjCCommon.h" #include "clang/AST/NestedNameSpecifier.h" #include "clang/Basic/ExceptionSpecificationType.h" #include "clang/Basic/Lambda.h" @@ -842,10 +841,31 @@ class ObjCDeclSpec { DQ_CSNullability = 0x40 }; + /// PropertyAttributeKind - list of property attributes. + /// Keep this list in sync with LLVM's Dwarf.h ApplePropertyAttributes. + enum ObjCPropertyAttributeKind { + DQ_PR_noattr = 0x0, + DQ_PR_readonly = 0x01, + DQ_PR_getter = 0x02, + DQ_PR_assign = 0x04, + DQ_PR_readwrite = 0x08, + DQ_PR_retain = 0x10, + DQ_PR_copy = 0x20, + DQ_PR_nonatomic = 0x40, + DQ_PR_setter = 0x80, + DQ_PR_atomic = 0x100, + DQ_PR_weak = 0x200, + DQ_PR_strong = 0x400, + DQ_PR_unsafe_unretained = 0x800, + DQ_PR_nullability = 0x1000, + DQ_PR_null_resettable = 0x2000, + DQ_PR_class = 0x4000, + DQ_PR_direct = 0x8000, + }; + ObjCDeclSpec() - : objcDeclQualifier(DQ_None), - PropertyAttributes(ObjCPropertyAttribute::kind_noattr), Nullability(0), - GetterName(nullptr), SetterName(nullptr) {} + : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr), + Nullability(0), GetterName(nullptr), SetterName(nullptr) { } ObjCDeclQualifier getObjCDeclQualifier() const { return (ObjCDeclQualifier)objcDeclQualifier; @@ -857,35 +877,32 @@ class ObjCDeclSpec { objcDeclQualifier = (ObjCDeclQualifier) (objcDeclQualifier & ~DQVal); } - ObjCPropertyAttribute::Kind getPropertyAttributes() const { - return ObjCPropertyAttribute::Kind(PropertyAttributes); + ObjCPropertyAttributeKind getPropertyAttributes() const { + return ObjCPropertyAttributeKind(PropertyAttributes); } - void setPropertyAttributes(ObjCPropertyAttribute::Kind PRVal) { + void setPropertyAttributes(ObjCPropertyAttributeKind PRVal) { PropertyAttributes = - (ObjCPropertyAttribute::Kind)(PropertyAttributes | PRVal); + (ObjCPropertyAttributeKind)(PropertyAttributes | PRVal); } NullabilityKind getNullability() const { - assert( - ((getObjCDeclQualifier() & DQ_CSNullability) || - (getPropertyAttributes() & ObjCPropertyAttribute::kind_nullability)) && - "Objective-C declspec doesn't have nullability"); + assert(((getObjCDeclQualifier() & DQ_CSNullability) || + (getPropertyAttributes() & DQ_PR_nullability)) && + "Objective-C declspec doesn't have nullability"); return static_cast(Nullability); } SourceLocation getNullabilityLoc() const { - assert( - ((getObjCDeclQualifier() & DQ_CSNullability) || - (getPropertyAttributes() & ObjCPropertyAttribute::kind_nullability)) && - "Objective-C declspec doesn't have nullability"); + assert(((getObjCDeclQualifier() & DQ_CSNullability) || + (getPropertyAttributes() & DQ_PR_nullability)) && + "Objective-C declspec doesn't have nullability"); return NullabilityLoc; } void setNullability(SourceLocation loc, NullabilityKind kind) { - assert( - ((getObjCDeclQualifier() & DQ_CSNullability) || - (getPropertyAttributes() & ObjCPropertyAttribute::kind_nullability)) && - "Set the nullability declspec or property attribute first"); + assert(((getObjCDeclQualifier() & DQ_CSNullability) || + (getPropertyAttributes() & DQ_PR_nullability)) && + "Set the nullability declspec or property attribute first"); Nullability = static_cast(kind); NullabilityLoc = loc; } @@ -912,8 +929,8 @@ class ObjCDeclSpec { // (space saving is negligible). unsigned objcDeclQualifier : 7; - // NOTE: VC++ treats enums as signed, avoid using ObjCPropertyAttribute::Kind - unsigned PropertyAttributes : NumObjCPropertyAttrsBits; + // NOTE: VC++ treats enums as signed, avoid using ObjCPropertyAttributeKind + unsigned PropertyAttributes : 16; unsigned Nullability : 2; diff --git a/clang/lib/ARCMigrate/TransGCAttrs.cpp b/clang/lib/ARCMigrate/TransGCAttrs.cpp index 8f5f3cff17cb72..5e3162197ed1b0 100644 --- a/clang/lib/ARCMigrate/TransGCAttrs.cpp +++ b/clang/lib/ARCMigrate/TransGCAttrs.cpp @@ -231,7 +231,8 @@ static void checkAllAtProps(MigrationContext &MigrateCtx, SmallVector, 4> ATLs; bool hasWeak = false, hasStrong = false; - ObjCPropertyAttribute::Kind Attrs = ObjCPropertyAttribute::kind_noattr; + ObjCPropertyDecl::PropertyAttributeKind + Attrs = ObjCPropertyDecl::OBJC_PR_noattr; for (IndivPropsTy::iterator PI = IndProps.begin(), PE = IndProps.end(); PI != PE; ++PI) { ObjCPropertyDecl *PD = *PI; @@ -273,7 +274,7 @@ static void checkAllAtProps(MigrationContext &MigrateCtx, else toAttr = "unsafe_unretained"; } - if (Attrs & ObjCPropertyAttribute::kind_assign) + if (Attrs & ObjCPropertyDecl::OBJC_PR_assign) MigrateCtx.rewritePropertyAttribute("assign", toAttr, AtLoc); else MigrateCtx.addPropertyAttribute(toAttr, AtLoc); @@ -301,8 +302,8 @@ static void checkAllProps(MigrationContext &MigrateCtx, for (unsigned i = 0, e = AllProps.size(); i != e; ++i) { ObjCPropertyDecl *PD = AllProps[i]; if (PD->getPropertyAttributesAsWritten() & - (ObjCPropertyAttribute::kind_assign | - ObjCPropertyAttribute::kind_readonly)) { + (ObjCPropertyDecl::OBJC_PR_assign | + ObjCPropertyDecl::OBJC_PR_readonly)) { SourceLocation AtLoc = PD->getAtLoc(); if (AtLoc.isInvalid()) continue; diff --git a/clang/lib/ARCMigrate/TransProperties.cpp b/clang/lib/ARCMigrate/TransProperties.cpp index adfb4bd77ac602..0675fb0baeb801 100644 --- a/clang/lib/ARCMigrate/TransProperties.cpp +++ b/clang/lib/ARCMigrate/TransProperties.cpp @@ -168,22 +168,22 @@ class PropertiesRewriter { } void rewriteProperty(PropsTy &props, SourceLocation atLoc) { - ObjCPropertyAttribute::Kind propAttrs = getPropertyAttrs(props); + ObjCPropertyDecl::PropertyAttributeKind propAttrs = getPropertyAttrs(props); - if (propAttrs & - (ObjCPropertyAttribute::kind_copy | - ObjCPropertyAttribute::kind_unsafe_unretained | - ObjCPropertyAttribute::kind_strong | ObjCPropertyAttribute::kind_weak)) + if (propAttrs & (ObjCPropertyDecl::OBJC_PR_copy | + ObjCPropertyDecl::OBJC_PR_unsafe_unretained | + ObjCPropertyDecl::OBJC_PR_strong | + ObjCPropertyDecl::OBJC_PR_weak)) return; - if (propAttrs & ObjCPropertyAttribute::kind_retain) { + if (propAttrs & ObjCPropertyDecl::OBJC_PR_retain) { // strong is the default. return doPropAction(PropAction_RetainReplacedWithStrong, props, atLoc); } bool HasIvarAssignedAPlusOneObject = hasIvarAssignedAPlusOneObject(props); - if (propAttrs & ObjCPropertyAttribute::kind_assign) { + if (propAttrs & ObjCPropertyDecl::OBJC_PR_assign) { if (HasIvarAssignedAPlusOneObject) return doPropAction(PropAction_AssignRemoved, props, atLoc); return doPropAction(PropAction_AssignRewritten, props, atLoc); @@ -354,10 +354,11 @@ class PropertiesRewriter { return ty; } - ObjCPropertyAttribute::Kind getPropertyAttrs(PropsTy &props) const { + ObjCPropertyDecl::PropertyAttributeKind + getPropertyAttrs(PropsTy &props) const { assert(!props.empty()); - ObjCPropertyAttribute::Kind attrs = - props[0].PropD->getPropertyAttributesAsWritten(); + ObjCPropertyDecl::PropertyAttributeKind + attrs = props[0].PropD->getPropertyAttributesAsWritten(); #ifndef NDEBUG for (PropsTy::iterator I = props.begin(), E = props.end(); I != E; ++I) diff --git a/clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp b/clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp index 81e67628fb1f46..d28bd378acc11d 100644 --- a/clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp +++ b/clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp @@ -118,11 +118,13 @@ class ZeroOutInDeallocRemover : ObjCPropertyDecl *PD = PID->getPropertyDecl(); ObjCMethodDecl *setterM = PD->getSetterMethodDecl(); if (!(setterM && setterM->isDefined())) { - ObjCPropertyAttribute::Kind AttrKind = PD->getPropertyAttributes(); - if (AttrKind & (ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_copy | - ObjCPropertyAttribute::kind_strong)) - SynthesizedProperties[PD] = PID; + ObjCPropertyDecl::PropertyAttributeKind AttrKind = + PD->getPropertyAttributes(); + if (AttrKind & + (ObjCPropertyDecl::OBJC_PR_retain | + ObjCPropertyDecl::OBJC_PR_copy | + ObjCPropertyDecl::OBJC_PR_strong)) + SynthesizedProperties[PD] = PID; } } } diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index fffcfac60ca7fe..8734dd390247f5 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -6770,11 +6770,11 @@ ASTContext::getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, if (PD->isReadOnly()) { S += ",R"; - if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_copy) + if (PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_copy) S += ",C"; - if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_retain) + if (PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_retain) S += ",&"; - if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_weak) + if (PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak) S += ",W"; } else { switch (PD->getSetterKind()) { @@ -6790,15 +6790,15 @@ ASTContext::getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, if (Dynamic) S += ",D"; - if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_nonatomic) + if (PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_nonatomic) S += ",N"; - if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_getter) { + if (PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_getter) { S += ",G"; S += PD->getGetterName().getAsString(); } - if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_setter) { + if (PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_setter) { S += ",S"; S += PD->getSetterName().getAsString(); } diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index db6c073c971310..6492f07eb5b047 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -146,8 +146,7 @@ bool ObjCContainerDecl::HasUserDeclaredSetterMethod( // auto-synthesized). for (const auto *P : Cat->properties()) if (P->getIdentifier() == Property->getIdentifier()) { - if (P->getPropertyAttributes() & - ObjCPropertyAttribute::kind_readwrite) + if (P->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite) return true; break; } diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index 706452fcc4a75e..23dc9e562d4f57 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -1428,83 +1428,85 @@ void DeclPrinter::VisitObjCPropertyDecl(ObjCPropertyDecl *PDecl) { QualType T = PDecl->getType(); Out << "@property"; - if (PDecl->getPropertyAttributes() != ObjCPropertyAttribute::kind_noattr) { + if (PDecl->getPropertyAttributes() != ObjCPropertyDecl::OBJC_PR_noattr) { bool first = true; Out << "("; - if (PDecl->getPropertyAttributes() & ObjCPropertyAttribute::kind_class) { + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_class) { Out << (first ? "" : ", ") << "class"; first = false; } - if (PDecl->getPropertyAttributes() & ObjCPropertyAttribute::kind_direct) { + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_direct) { Out << (first ? "" : ", ") << "direct"; first = false; } if (PDecl->getPropertyAttributes() & - ObjCPropertyAttribute::kind_nonatomic) { + ObjCPropertyDecl::OBJC_PR_nonatomic) { Out << (first ? "" : ", ") << "nonatomic"; first = false; } - if (PDecl->getPropertyAttributes() & ObjCPropertyAttribute::kind_atomic) { + if (PDecl->getPropertyAttributes() & + ObjCPropertyDecl::OBJC_PR_atomic) { Out << (first ? "" : ", ") << "atomic"; first = false; } - if (PDecl->getPropertyAttributes() & ObjCPropertyAttribute::kind_assign) { + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_assign) { Out << (first ? "" : ", ") << "assign"; first = false; } - if (PDecl->getPropertyAttributes() & ObjCPropertyAttribute::kind_retain) { + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_retain) { Out << (first ? "" : ", ") << "retain"; first = false; } - if (PDecl->getPropertyAttributes() & ObjCPropertyAttribute::kind_strong) { + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_strong) { Out << (first ? "" : ", ") << "strong"; first = false; } - if (PDecl->getPropertyAttributes() & ObjCPropertyAttribute::kind_copy) { + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_copy) { Out << (first ? "" : ", ") << "copy"; first = false; } - if (PDecl->getPropertyAttributes() & ObjCPropertyAttribute::kind_weak) { + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak) { Out << (first ? "" : ", ") << "weak"; first = false; } - if (PDecl->getPropertyAttributes() & - ObjCPropertyAttribute::kind_unsafe_unretained) { + if (PDecl->getPropertyAttributes() + & ObjCPropertyDecl::OBJC_PR_unsafe_unretained) { Out << (first ? "" : ", ") << "unsafe_unretained"; first = false; } if (PDecl->getPropertyAttributes() & - ObjCPropertyAttribute::kind_readwrite) { + ObjCPropertyDecl::OBJC_PR_readwrite) { Out << (first ? "" : ", ") << "readwrite"; first = false; } - if (PDecl->getPropertyAttributes() & ObjCPropertyAttribute::kind_readonly) { + if (PDecl->getPropertyAttributes() & + ObjCPropertyDecl::OBJC_PR_readonly) { Out << (first ? "" : ", ") << "readonly"; first = false; } - if (PDecl->getPropertyAttributes() & ObjCPropertyAttribute::kind_getter) { + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_getter) { Out << (first ? "" : ", ") << "getter = "; PDecl->getGetterName().print(Out); first = false; } - if (PDecl->getPropertyAttributes() & ObjCPropertyAttribute::kind_setter) { + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_setter) { Out << (first ? "" : ", ") << "setter = "; PDecl->getSetterName().print(Out); first = false; } if (PDecl->getPropertyAttributes() & - ObjCPropertyAttribute::kind_nullability) { + ObjCPropertyDecl::OBJC_PR_nullability) { if (auto nullability = AttributedType::stripOuterNullability(T)) { if (*nullability == NullabilityKind::Unspecified && (PDecl->getPropertyAttributes() & - ObjCPropertyAttribute::kind_null_resettable)) { + ObjCPropertyDecl::OBJC_PR_null_resettable)) { Out << (first ? "" : ", ") << "null_resettable"; } else { Out << (first ? "" : ", ") diff --git a/clang/lib/AST/JSONNodeDumper.cpp b/clang/lib/AST/JSONNodeDumper.cpp index 91281fb44bfa9e..1f7dc5e9190ffa 100644 --- a/clang/lib/AST/JSONNodeDumper.cpp +++ b/clang/lib/AST/JSONNodeDumper.cpp @@ -999,32 +999,31 @@ void JSONNodeDumper::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) { case ObjCPropertyDecl::Optional: JOS.attribute("control", "optional"); break; } - ObjCPropertyAttribute::Kind Attrs = D->getPropertyAttributes(); - if (Attrs != ObjCPropertyAttribute::kind_noattr) { - if (Attrs & ObjCPropertyAttribute::kind_getter) + ObjCPropertyDecl::PropertyAttributeKind Attrs = D->getPropertyAttributes(); + if (Attrs != ObjCPropertyDecl::OBJC_PR_noattr) { + if (Attrs & ObjCPropertyDecl::OBJC_PR_getter) JOS.attribute("getter", createBareDeclRef(D->getGetterMethodDecl())); - if (Attrs & ObjCPropertyAttribute::kind_setter) + if (Attrs & ObjCPropertyDecl::OBJC_PR_setter) JOS.attribute("setter", createBareDeclRef(D->getSetterMethodDecl())); - attributeOnlyIfTrue("readonly", - Attrs & ObjCPropertyAttribute::kind_readonly); - attributeOnlyIfTrue("assign", Attrs & ObjCPropertyAttribute::kind_assign); + attributeOnlyIfTrue("readonly", Attrs & ObjCPropertyDecl::OBJC_PR_readonly); + attributeOnlyIfTrue("assign", Attrs & ObjCPropertyDecl::OBJC_PR_assign); attributeOnlyIfTrue("readwrite", - Attrs & ObjCPropertyAttribute::kind_readwrite); - attributeOnlyIfTrue("retain", Attrs & ObjCPropertyAttribute::kind_retain); - attributeOnlyIfTrue("copy", Attrs & ObjCPropertyAttribute::kind_copy); + Attrs & ObjCPropertyDecl::OBJC_PR_readwrite); + attributeOnlyIfTrue("retain", Attrs & ObjCPropertyDecl::OBJC_PR_retain); + attributeOnlyIfTrue("copy", Attrs & ObjCPropertyDecl::OBJC_PR_copy); attributeOnlyIfTrue("nonatomic", - Attrs & ObjCPropertyAttribute::kind_nonatomic); - attributeOnlyIfTrue("atomic", Attrs & ObjCPropertyAttribute::kind_atomic); - attributeOnlyIfTrue("weak", Attrs & ObjCPropertyAttribute::kind_weak); - attributeOnlyIfTrue("strong", Attrs & ObjCPropertyAttribute::kind_strong); + Attrs & ObjCPropertyDecl::OBJC_PR_nonatomic); + attributeOnlyIfTrue("atomic", Attrs & ObjCPropertyDecl::OBJC_PR_atomic); + attributeOnlyIfTrue("weak", Attrs & ObjCPropertyDecl::OBJC_PR_weak); + attributeOnlyIfTrue("strong", Attrs & ObjCPropertyDecl::OBJC_PR_strong); attributeOnlyIfTrue("unsafe_unretained", - Attrs & ObjCPropertyAttribute::kind_unsafe_unretained); - attributeOnlyIfTrue("class", Attrs & ObjCPropertyAttribute::kind_class); - attributeOnlyIfTrue("direct", Attrs & ObjCPropertyAttribute::kind_direct); + Attrs & ObjCPropertyDecl::OBJC_PR_unsafe_unretained); + attributeOnlyIfTrue("class", Attrs & ObjCPropertyDecl::OBJC_PR_class); + attributeOnlyIfTrue("direct", Attrs & ObjCPropertyDecl::OBJC_PR_direct); attributeOnlyIfTrue("nullability", - Attrs & ObjCPropertyAttribute::kind_nullability); + Attrs & ObjCPropertyDecl::OBJC_PR_nullability); attributeOnlyIfTrue("null_resettable", - Attrs & ObjCPropertyAttribute::kind_null_resettable); + Attrs & ObjCPropertyDecl::OBJC_PR_null_resettable); } } diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp index 9dbe5570753915..2933457b571186 100644 --- a/clang/lib/AST/TextNodeDumper.cpp +++ b/clang/lib/AST/TextNodeDumper.cpp @@ -1958,35 +1958,35 @@ void TextNodeDumper::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) { else if (D->getPropertyImplementation() == ObjCPropertyDecl::Optional) OS << " optional"; - ObjCPropertyAttribute::Kind Attrs = D->getPropertyAttributes(); - if (Attrs != ObjCPropertyAttribute::kind_noattr) { - if (Attrs & ObjCPropertyAttribute::kind_readonly) + ObjCPropertyDecl::PropertyAttributeKind Attrs = D->getPropertyAttributes(); + if (Attrs != ObjCPropertyDecl::OBJC_PR_noattr) { + if (Attrs & ObjCPropertyDecl::OBJC_PR_readonly) OS << " readonly"; - if (Attrs & ObjCPropertyAttribute::kind_assign) + if (Attrs & ObjCPropertyDecl::OBJC_PR_assign) OS << " assign"; - if (Attrs & ObjCPropertyAttribute::kind_readwrite) + if (Attrs & ObjCPropertyDecl::OBJC_PR_readwrite) OS << " readwrite"; - if (Attrs & ObjCPropertyAttribute::kind_retain) + if (Attrs & ObjCPropertyDecl::OBJC_PR_retain) OS << " retain"; - if (Attrs & ObjCPropertyAttribute::kind_copy) + if (Attrs & ObjCPropertyDecl::OBJC_PR_copy) OS << " copy"; - if (Attrs & ObjCPropertyAttribute::kind_nonatomic) + if (Attrs & ObjCPropertyDecl::OBJC_PR_nonatomic) OS << " nonatomic"; - if (Attrs & ObjCPropertyAttribute::kind_atomic) + if (Attrs & ObjCPropertyDecl::OBJC_PR_atomic) OS << " atomic"; - if (Attrs & ObjCPropertyAttribute::kind_weak) + if (Attrs & ObjCPropertyDecl::OBJC_PR_weak) OS << " weak"; - if (Attrs & ObjCPropertyAttribute::kind_strong) + if (Attrs & ObjCPropertyDecl::OBJC_PR_strong) OS << " strong"; - if (Attrs & ObjCPropertyAttribute::kind_unsafe_unretained) + if (Attrs & ObjCPropertyDecl::OBJC_PR_unsafe_unretained) OS << " unsafe_unretained"; - if (Attrs & ObjCPropertyAttribute::kind_class) + if (Attrs & ObjCPropertyDecl::OBJC_PR_class) OS << " class"; - if (Attrs & ObjCPropertyAttribute::kind_direct) + if (Attrs & ObjCPropertyDecl::OBJC_PR_direct) OS << " direct"; - if (Attrs & ObjCPropertyAttribute::kind_getter) + if (Attrs & ObjCPropertyDecl::OBJC_PR_getter) dumpDeclRef(D->getGetterMethodDecl(), "getter"); - if (Attrs & ObjCPropertyAttribute::kind_setter) + if (Attrs & ObjCPropertyDecl::OBJC_PR_setter) dumpDeclRef(D->getSetterMethodDecl(), "setter"); } } diff --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp index 852954618463ca..c78096a20be624 100644 --- a/clang/lib/Analysis/BodyFarm.cpp +++ b/clang/lib/Analysis/BodyFarm.cpp @@ -762,7 +762,7 @@ static Stmt *createObjCPropertyGetter(ASTContext &Ctx, return nullptr; // Ignore weak variables, which have special behavior. - if (Prop->getPropertyAttributes() & ObjCPropertyAttribute::kind_weak) + if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak) return nullptr; // Look to see if Sema has synthesized a body for us. This happens in diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index b512592e78fff6..2324f78f622eab 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -3505,7 +3505,7 @@ CodeGenFunction::GenerateObjCAtomicSetterCopyHelperFunction( if (!Ty->isRecordType()) return nullptr; const ObjCPropertyDecl *PD = PID->getPropertyDecl(); - if ((!(PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_atomic))) + if ((!(PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_atomic))) return nullptr; llvm::Constant *HelperFn = nullptr; if (hasTrivialSetExpr(PID)) @@ -3589,7 +3589,7 @@ CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction( QualType Ty = PD->getType(); if (!Ty->isRecordType()) return nullptr; - if ((!(PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_atomic))) + if ((!(PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_atomic))) return nullptr; llvm::Constant *HelperFn = nullptr; if (hasTrivialGetExpr(PID)) diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index bb9c494ae68ee9..3dbb3be5a5e0ed 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -255,11 +255,11 @@ class CGObjCGNU : public CGObjCRuntime { isDynamic=true) { int attrs = property->getPropertyAttributes(); // For read-only properties, clear the copy and retain flags - if (attrs & ObjCPropertyAttribute::kind_readonly) { - attrs &= ~ObjCPropertyAttribute::kind_copy; - attrs &= ~ObjCPropertyAttribute::kind_retain; - attrs &= ~ObjCPropertyAttribute::kind_weak; - attrs &= ~ObjCPropertyAttribute::kind_strong; + if (attrs & ObjCPropertyDecl::OBJC_PR_readonly) { + attrs &= ~ObjCPropertyDecl::OBJC_PR_copy; + attrs &= ~ObjCPropertyDecl::OBJC_PR_retain; + attrs &= ~ObjCPropertyDecl::OBJC_PR_weak; + attrs &= ~ObjCPropertyDecl::OBJC_PR_strong; } // The first flags field has the same attribute values as clang uses internally Fields.addInt(Int8Ty, attrs & 0xff); diff --git a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp index c46ba9832c0de3..e0e3420fa3b256 100644 --- a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -941,10 +941,9 @@ void RewriteModernObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, unsigned Attributes = PD->getPropertyAttributes(); if (mustSynthesizeSetterGetterMethod(IMD, PD, true /*getter*/)) { - bool GenGetProperty = - !(Attributes & ObjCPropertyAttribute::kind_nonatomic) && - (Attributes & (ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_copy)); + bool GenGetProperty = !(Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) && + (Attributes & (ObjCPropertyDecl::OBJC_PR_retain | + ObjCPropertyDecl::OBJC_PR_copy)); std::string Getr; if (GenGetProperty && !objcGetPropertyDefined) { objcGetPropertyDefined = true; @@ -1003,8 +1002,8 @@ void RewriteModernObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, // Generate the 'setter' function. std::string Setr; - bool GenSetProperty = Attributes & (ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_copy); + bool GenSetProperty = Attributes & (ObjCPropertyDecl::OBJC_PR_retain | + ObjCPropertyDecl::OBJC_PR_copy); if (GenSetProperty && !objcSetPropertyDefined) { objcSetPropertyDefined = true; // FIXME. Is this attribute correct in all cases? @@ -1023,11 +1022,11 @@ void RewriteModernObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, Setr += ", (id)"; Setr += PD->getName(); Setr += ", "; - if (Attributes & ObjCPropertyAttribute::kind_nonatomic) + if (Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) Setr += "0, "; else Setr += "1, "; - if (Attributes & ObjCPropertyAttribute::kind_copy) + if (Attributes & ObjCPropertyDecl::OBJC_PR_copy) Setr += "1)"; else Setr += "0)"; diff --git a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp index 4674f7c6a38c36..32fc80fc8979ca 100644 --- a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp @@ -789,10 +789,9 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, unsigned Attributes = PD->getPropertyAttributes(); if (PID->getGetterMethodDecl() && !PID->getGetterMethodDecl()->isDefined()) { - bool GenGetProperty = - !(Attributes & ObjCPropertyAttribute::kind_nonatomic) && - (Attributes & (ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_copy)); + bool GenGetProperty = !(Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) && + (Attributes & (ObjCPropertyDecl::OBJC_PR_retain | + ObjCPropertyDecl::OBJC_PR_copy)); std::string Getr; if (GenGetProperty && !objcGetPropertyDefined) { objcGetPropertyDefined = true; @@ -851,8 +850,8 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, // Generate the 'setter' function. std::string Setr; - bool GenSetProperty = Attributes & (ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_copy); + bool GenSetProperty = Attributes & (ObjCPropertyDecl::OBJC_PR_retain | + ObjCPropertyDecl::OBJC_PR_copy); if (GenSetProperty && !objcSetPropertyDefined) { objcSetPropertyDefined = true; // FIXME. Is this attribute correct in all cases? @@ -871,11 +870,11 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, Setr += ", (id)"; Setr += PD->getName(); Setr += ", "; - if (Attributes & ObjCPropertyAttribute::kind_nonatomic) + if (Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) Setr += "0, "; else Setr += "1, "; - if (Attributes & ObjCPropertyAttribute::kind_copy) + if (Attributes & ObjCPropertyDecl::OBJC_PR_copy) Setr += "1)"; else Setr += "0)"; diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index eaea8666bc102e..10252b08a8d169 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -740,8 +740,7 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey, // Map a nullability property attribute to a context-sensitive keyword // attribute. - if (OCDS.getPropertyAttributes() & - ObjCPropertyAttribute::kind_nullability) + if (OCDS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nullability) addContextSensitiveTypeNullability(*this, FD.D, OCDS.getNullability(), OCDS.getNullabilityLoc(), addedToDeclSpec); @@ -861,25 +860,25 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) { SourceLocation AttrName = ConsumeToken(); // consume last attribute name if (II->isStr("readonly")) - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_readonly); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_readonly); else if (II->isStr("assign")) - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_assign); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_assign); else if (II->isStr("unsafe_unretained")) - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_unsafe_unretained); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_unsafe_unretained); else if (II->isStr("readwrite")) - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_readwrite); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_readwrite); else if (II->isStr("retain")) - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_retain); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_retain); else if (II->isStr("strong")) - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_strong); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_strong); else if (II->isStr("copy")) - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_copy); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_copy); else if (II->isStr("nonatomic")) - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_nonatomic); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nonatomic); else if (II->isStr("atomic")) - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_atomic); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_atomic); else if (II->isStr("weak")) - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_weak); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_weak); else if (II->isStr("getter") || II->isStr("setter")) { bool IsSetter = II->getNameStart()[0] == 's'; @@ -911,7 +910,7 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) { } if (IsSetter) { - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_setter); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_setter); DS.setSetterName(SelIdent, SelLoc); if (ExpectAndConsume(tok::colon, @@ -920,44 +919,44 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) { return; } } else { - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_getter); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_getter); DS.setGetterName(SelIdent, SelLoc); } } else if (II->isStr("nonnull")) { - if (DS.getPropertyAttributes() & ObjCPropertyAttribute::kind_nullability) + if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nullability) diagnoseRedundantPropertyNullability(*this, DS, NullabilityKind::NonNull, Tok.getLocation()); - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_nullability); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nullability); DS.setNullability(Tok.getLocation(), NullabilityKind::NonNull); } else if (II->isStr("nullable")) { - if (DS.getPropertyAttributes() & ObjCPropertyAttribute::kind_nullability) + if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nullability) diagnoseRedundantPropertyNullability(*this, DS, NullabilityKind::Nullable, Tok.getLocation()); - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_nullability); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nullability); DS.setNullability(Tok.getLocation(), NullabilityKind::Nullable); } else if (II->isStr("null_unspecified")) { - if (DS.getPropertyAttributes() & ObjCPropertyAttribute::kind_nullability) + if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nullability) diagnoseRedundantPropertyNullability(*this, DS, NullabilityKind::Unspecified, Tok.getLocation()); - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_nullability); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nullability); DS.setNullability(Tok.getLocation(), NullabilityKind::Unspecified); } else if (II->isStr("null_resettable")) { - if (DS.getPropertyAttributes() & ObjCPropertyAttribute::kind_nullability) + if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nullability) diagnoseRedundantPropertyNullability(*this, DS, NullabilityKind::Unspecified, Tok.getLocation()); - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_nullability); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nullability); DS.setNullability(Tok.getLocation(), NullabilityKind::Unspecified); // Also set the null_resettable bit. - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_null_resettable); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_null_resettable); } else if (II->isStr("class")) { - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_class); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_class); } else if (II->isStr("direct")) { - DS.setPropertyAttributes(ObjCPropertyAttribute::kind_direct); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_direct); } else { Diag(AttrName, diag::err_objc_expected_property_attr) << II; SkipUntil(tok::r_paren, StopAtSemi); diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 126f155b6ad0a7..559ad52e6d3a33 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -13917,12 +13917,12 @@ void Sema::checkUnsafeExprAssigns(SourceLocation Loc, return; unsigned Attributes = PD->getPropertyAttributes(); - if (Attributes & ObjCPropertyAttribute::kind_assign) { + if (Attributes & ObjCPropertyDecl::OBJC_PR_assign) { // when 'assign' attribute was not explicitly specified // by user, ignore it and rely on property type itself // for lifetime info. unsigned AsWrittenAttr = PD->getPropertyAttributesAsWritten(); - if (!(AsWrittenAttr & ObjCPropertyAttribute::kind_assign) && + if (!(AsWrittenAttr & ObjCPropertyDecl::OBJC_PR_assign) && LHSType->isObjCRetainableType()) return; @@ -13934,7 +13934,8 @@ void Sema::checkUnsafeExprAssigns(SourceLocation Loc, } RHS = cast->getSubExpr(); } - } else if (Attributes & ObjCPropertyAttribute::kind_weak) { + } + else if (Attributes & ObjCPropertyDecl::OBJC_PR_weak) { if (checkUnsafeAssignObject(*this, Loc, Qualifiers::OCL_Weak, RHS, true)) return; } diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 0aad0568714f4e..00d47faec8a5b1 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -6513,24 +6513,22 @@ static bool ObjCPropertyFlagConflicts(unsigned Attributes, unsigned NewFlag) { Attributes |= NewFlag; // Check for collisions with "readonly". - if ((Attributes & ObjCPropertyAttribute::kind_readonly) && - (Attributes & ObjCPropertyAttribute::kind_readwrite)) + if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) && + (Attributes & ObjCDeclSpec::DQ_PR_readwrite)) return true; // Check for more than one of { assign, copy, retain, strong, weak }. unsigned AssignCopyRetMask = Attributes & - (ObjCPropertyAttribute::kind_assign | - ObjCPropertyAttribute::kind_unsafe_unretained | - ObjCPropertyAttribute::kind_copy | ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_strong | ObjCPropertyAttribute::kind_weak); - if (AssignCopyRetMask && - AssignCopyRetMask != ObjCPropertyAttribute::kind_assign && - AssignCopyRetMask != ObjCPropertyAttribute::kind_unsafe_unretained && - AssignCopyRetMask != ObjCPropertyAttribute::kind_copy && - AssignCopyRetMask != ObjCPropertyAttribute::kind_retain && - AssignCopyRetMask != ObjCPropertyAttribute::kind_strong && - AssignCopyRetMask != ObjCPropertyAttribute::kind_weak) + (ObjCDeclSpec::DQ_PR_assign | ObjCDeclSpec::DQ_PR_unsafe_unretained | + ObjCDeclSpec::DQ_PR_copy | ObjCDeclSpec::DQ_PR_retain | + ObjCDeclSpec::DQ_PR_strong | ObjCDeclSpec::DQ_PR_weak); + if (AssignCopyRetMask && AssignCopyRetMask != ObjCDeclSpec::DQ_PR_assign && + AssignCopyRetMask != ObjCDeclSpec::DQ_PR_unsafe_unretained && + AssignCopyRetMask != ObjCDeclSpec::DQ_PR_copy && + AssignCopyRetMask != ObjCDeclSpec::DQ_PR_retain && + AssignCopyRetMask != ObjCDeclSpec::DQ_PR_strong && + AssignCopyRetMask != ObjCDeclSpec::DQ_PR_weak) return true; return false; @@ -6546,41 +6544,32 @@ void Sema::CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS) { CodeCompleter->getCodeCompletionTUInfo(), CodeCompletionContext::CCC_Other); Results.EnterNewScope(); - if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_readonly)) + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_readonly)) Results.AddResult(CodeCompletionResult("readonly")); - if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_assign)) + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_assign)) Results.AddResult(CodeCompletionResult("assign")); if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_unsafe_unretained)) + ObjCDeclSpec::DQ_PR_unsafe_unretained)) Results.AddResult(CodeCompletionResult("unsafe_unretained")); - if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_readwrite)) + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_readwrite)) Results.AddResult(CodeCompletionResult("readwrite")); - if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_retain)) + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_retain)) Results.AddResult(CodeCompletionResult("retain")); - if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_strong)) + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_strong)) Results.AddResult(CodeCompletionResult("strong")); - if (!ObjCPropertyFlagConflicts(Attributes, ObjCPropertyAttribute::kind_copy)) + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_copy)) Results.AddResult(CodeCompletionResult("copy")); - if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_nonatomic)) + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_nonatomic)) Results.AddResult(CodeCompletionResult("nonatomic")); - if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_atomic)) + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_atomic)) Results.AddResult(CodeCompletionResult("atomic")); // Only suggest "weak" if we're compiling for ARC-with-weak-references or GC. if (getLangOpts().ObjCWeak || getLangOpts().getGC() != LangOptions::NonGC) - if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_weak)) + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_weak)) Results.AddResult(CodeCompletionResult("weak")); - if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_setter)) { + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_setter)) { CodeCompletionBuilder Setter(Results.getAllocator(), Results.getCodeCompletionTUInfo()); Setter.AddTypedTextChunk("setter"); @@ -6588,8 +6577,7 @@ void Sema::CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS) { Setter.AddPlaceholderChunk("method"); Results.AddResult(CodeCompletionResult(Setter.TakeString())); } - if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_getter)) { + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_getter)) { CodeCompletionBuilder Getter(Results.getAllocator(), Results.getCodeCompletionTUInfo()); Getter.AddTypedTextChunk("getter"); @@ -6597,8 +6585,7 @@ void Sema::CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS) { Getter.AddPlaceholderChunk("method"); Results.AddResult(CodeCompletionResult(Getter.TakeString())); } - if (!ObjCPropertyFlagConflicts(Attributes, - ObjCPropertyAttribute::kind_nullability)) { + if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_nullability)) { Results.AddResult(CodeCompletionResult("nonnull")); Results.AddResult(CodeCompletionResult("nullable")); Results.AddResult(CodeCompletionResult("null_unspecified")); diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 10a7cf3e22d0e4..a9153322bda58f 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -1953,8 +1953,7 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, if (const ObjCPropertyDecl *PDecl = Setter->findPropertyDecl()) { // Do not warn if user is using property-dot syntax to make call to // user named setter. - if (!(PDecl->getPropertyAttributes() & - ObjCPropertyAttribute::kind_setter)) + if (!(PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_setter)) Diag(MemberLoc, diag::warn_property_access_suggest) << MemberName << QualType(OPT, 0) << PDecl->getName() @@ -3259,7 +3258,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, if (!isImplicit && Method) { if (const ObjCPropertyDecl *Prop = Method->findPropertyDecl()) { bool IsWeak = - Prop->getPropertyAttributes() & ObjCPropertyAttribute::kind_weak; + Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak; if (!IsWeak && Sel.isUnarySelector()) IsWeak = ReturnType.getObjCLifetime() & Qualifiers::OCL_Weak; if (IsWeak && !isUnevaluatedContext() && diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index e301c62dd2c0ba..9c7d8ecf7f9bb7 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -35,23 +35,24 @@ using namespace clang; /// /// Returns OCL_None if the attributes as stated do not imply an ownership. /// Never returns OCL_Autoreleasing. -static Qualifiers::ObjCLifetime -getImpliedARCOwnership(ObjCPropertyAttribute::Kind attrs, QualType type) { +static Qualifiers::ObjCLifetime getImpliedARCOwnership( + ObjCPropertyDecl::PropertyAttributeKind attrs, + QualType type) { // retain, strong, copy, weak, and unsafe_unretained are only legal // on properties of retainable pointer type. - if (attrs & - (ObjCPropertyAttribute::kind_retain | ObjCPropertyAttribute::kind_strong | - ObjCPropertyAttribute::kind_copy)) { + if (attrs & (ObjCPropertyDecl::OBJC_PR_retain | + ObjCPropertyDecl::OBJC_PR_strong | + ObjCPropertyDecl::OBJC_PR_copy)) { return Qualifiers::OCL_Strong; - } else if (attrs & ObjCPropertyAttribute::kind_weak) { + } else if (attrs & ObjCPropertyDecl::OBJC_PR_weak) { return Qualifiers::OCL_Weak; - } else if (attrs & ObjCPropertyAttribute::kind_unsafe_unretained) { + } else if (attrs & ObjCPropertyDecl::OBJC_PR_unsafe_unretained) { return Qualifiers::OCL_ExplicitNone; } // assign can appear on other types, so we have to check the // property type. - if (attrs & ObjCPropertyAttribute::kind_assign && + if (attrs & ObjCPropertyDecl::OBJC_PR_assign && type->isObjCRetainableType()) { return Qualifiers::OCL_ExplicitNone; } @@ -65,7 +66,8 @@ static void checkPropertyDeclWithOwnership(Sema &S, ObjCPropertyDecl *property) { if (property->isInvalidDecl()) return; - ObjCPropertyAttribute::Kind propertyKind = property->getPropertyAttributes(); + ObjCPropertyDecl::PropertyAttributeKind propertyKind + = property->getPropertyAttributes(); Qualifiers::ObjCLifetime propertyLifetime = property->getType().getObjCLifetime(); @@ -78,14 +80,14 @@ static void checkPropertyDeclWithOwnership(Sema &S, // attribute. That's okay, but restore reasonable invariants by // setting the property attribute according to the lifetime // qualifier. - ObjCPropertyAttribute::Kind attr; + ObjCPropertyDecl::PropertyAttributeKind attr; if (propertyLifetime == Qualifiers::OCL_Strong) { - attr = ObjCPropertyAttribute::kind_strong; + attr = ObjCPropertyDecl::OBJC_PR_strong; } else if (propertyLifetime == Qualifiers::OCL_Weak) { - attr = ObjCPropertyAttribute::kind_weak; + attr = ObjCPropertyDecl::OBJC_PR_weak; } else { assert(propertyLifetime == Qualifiers::OCL_ExplicitNone); - attr = ObjCPropertyAttribute::kind_unsafe_unretained; + attr = ObjCPropertyDecl::OBJC_PR_unsafe_unretained; } property->setPropertyAttributes(attr); return; @@ -128,19 +130,18 @@ CheckPropertyAgainstProtocol(Sema &S, ObjCPropertyDecl *Prop, static unsigned deducePropertyOwnershipFromType(Sema &S, QualType T) { // In GC mode, just look for the __weak qualifier. if (S.getLangOpts().getGC() != LangOptions::NonGC) { - if (T.isObjCGCWeak()) - return ObjCPropertyAttribute::kind_weak; + if (T.isObjCGCWeak()) return ObjCDeclSpec::DQ_PR_weak; - // In ARC/MRC, look for an explicit ownership qualifier. - // For some reason, this only applies to __weak. + // In ARC/MRC, look for an explicit ownership qualifier. + // For some reason, this only applies to __weak. } else if (auto ownership = T.getObjCLifetime()) { switch (ownership) { case Qualifiers::OCL_Weak: - return ObjCPropertyAttribute::kind_weak; + return ObjCDeclSpec::DQ_PR_weak; case Qualifiers::OCL_Strong: - return ObjCPropertyAttribute::kind_strong; + return ObjCDeclSpec::DQ_PR_strong; case Qualifiers::OCL_ExplicitNone: - return ObjCPropertyAttribute::kind_unsafe_unretained; + return ObjCDeclSpec::DQ_PR_unsafe_unretained; case Qualifiers::OCL_Autoreleasing: case Qualifiers::OCL_None: return 0; @@ -152,20 +153,22 @@ static unsigned deducePropertyOwnershipFromType(Sema &S, QualType T) { } static const unsigned OwnershipMask = - (ObjCPropertyAttribute::kind_assign | ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_copy | ObjCPropertyAttribute::kind_weak | - ObjCPropertyAttribute::kind_strong | - ObjCPropertyAttribute::kind_unsafe_unretained); + (ObjCPropertyDecl::OBJC_PR_assign | + ObjCPropertyDecl::OBJC_PR_retain | + ObjCPropertyDecl::OBJC_PR_copy | + ObjCPropertyDecl::OBJC_PR_weak | + ObjCPropertyDecl::OBJC_PR_strong | + ObjCPropertyDecl::OBJC_PR_unsafe_unretained); static unsigned getOwnershipRule(unsigned attr) { unsigned result = attr & OwnershipMask; // From an ownership perspective, assign and unsafe_unretained are // identical; make sure one also implies the other. - if (result & (ObjCPropertyAttribute::kind_assign | - ObjCPropertyAttribute::kind_unsafe_unretained)) { - result |= ObjCPropertyAttribute::kind_assign | - ObjCPropertyAttribute::kind_unsafe_unretained; + if (result & (ObjCPropertyDecl::OBJC_PR_assign | + ObjCPropertyDecl::OBJC_PR_unsafe_unretained)) { + result |= ObjCPropertyDecl::OBJC_PR_assign | + ObjCPropertyDecl::OBJC_PR_unsafe_unretained; } return result; @@ -180,16 +183,15 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC) { unsigned Attributes = ODS.getPropertyAttributes(); - FD.D.setObjCWeakProperty((Attributes & ObjCPropertyAttribute::kind_weak) != - 0); + FD.D.setObjCWeakProperty((Attributes & ObjCDeclSpec::DQ_PR_weak) != 0); TypeSourceInfo *TSI = GetTypeForDeclarator(FD.D, S); QualType T = TSI->getType(); if (!getOwnershipRule(Attributes)) { Attributes |= deducePropertyOwnershipFromType(*this, T); } - bool isReadWrite = ((Attributes & ObjCPropertyAttribute::kind_readwrite) || + bool isReadWrite = ((Attributes & ObjCDeclSpec::DQ_PR_readwrite) || // default is readwrite! - !(Attributes & ObjCPropertyAttribute::kind_readonly)); + !(Attributes & ObjCDeclSpec::DQ_PR_readonly)); // Proceed with constructing the ObjCPropertyDecls. ObjCContainerDecl *ClassDecl = cast(CurContext); @@ -275,39 +277,39 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, return Res; } -static ObjCPropertyAttribute::Kind +static ObjCPropertyDecl::PropertyAttributeKind makePropertyAttributesAsWritten(unsigned Attributes) { unsigned attributesAsWritten = 0; - if (Attributes & ObjCPropertyAttribute::kind_readonly) - attributesAsWritten |= ObjCPropertyAttribute::kind_readonly; - if (Attributes & ObjCPropertyAttribute::kind_readwrite) - attributesAsWritten |= ObjCPropertyAttribute::kind_readwrite; - if (Attributes & ObjCPropertyAttribute::kind_getter) - attributesAsWritten |= ObjCPropertyAttribute::kind_getter; - if (Attributes & ObjCPropertyAttribute::kind_setter) - attributesAsWritten |= ObjCPropertyAttribute::kind_setter; - if (Attributes & ObjCPropertyAttribute::kind_assign) - attributesAsWritten |= ObjCPropertyAttribute::kind_assign; - if (Attributes & ObjCPropertyAttribute::kind_retain) - attributesAsWritten |= ObjCPropertyAttribute::kind_retain; - if (Attributes & ObjCPropertyAttribute::kind_strong) - attributesAsWritten |= ObjCPropertyAttribute::kind_strong; - if (Attributes & ObjCPropertyAttribute::kind_weak) - attributesAsWritten |= ObjCPropertyAttribute::kind_weak; - if (Attributes & ObjCPropertyAttribute::kind_copy) - attributesAsWritten |= ObjCPropertyAttribute::kind_copy; - if (Attributes & ObjCPropertyAttribute::kind_unsafe_unretained) - attributesAsWritten |= ObjCPropertyAttribute::kind_unsafe_unretained; - if (Attributes & ObjCPropertyAttribute::kind_nonatomic) - attributesAsWritten |= ObjCPropertyAttribute::kind_nonatomic; - if (Attributes & ObjCPropertyAttribute::kind_atomic) - attributesAsWritten |= ObjCPropertyAttribute::kind_atomic; - if (Attributes & ObjCPropertyAttribute::kind_class) - attributesAsWritten |= ObjCPropertyAttribute::kind_class; - if (Attributes & ObjCPropertyAttribute::kind_direct) - attributesAsWritten |= ObjCPropertyAttribute::kind_direct; - - return (ObjCPropertyAttribute::Kind)attributesAsWritten; + if (Attributes & ObjCDeclSpec::DQ_PR_readonly) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_readonly; + if (Attributes & ObjCDeclSpec::DQ_PR_readwrite) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_readwrite; + if (Attributes & ObjCDeclSpec::DQ_PR_getter) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_getter; + if (Attributes & ObjCDeclSpec::DQ_PR_setter) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_setter; + if (Attributes & ObjCDeclSpec::DQ_PR_assign) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_assign; + if (Attributes & ObjCDeclSpec::DQ_PR_retain) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_retain; + if (Attributes & ObjCDeclSpec::DQ_PR_strong) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_strong; + if (Attributes & ObjCDeclSpec::DQ_PR_weak) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_weak; + if (Attributes & ObjCDeclSpec::DQ_PR_copy) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_copy; + if (Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_unsafe_unretained; + if (Attributes & ObjCDeclSpec::DQ_PR_nonatomic) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_nonatomic; + if (Attributes & ObjCDeclSpec::DQ_PR_atomic) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_atomic; + if (Attributes & ObjCDeclSpec::DQ_PR_class) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_class; + if (Attributes & ObjCDeclSpec::DQ_PR_direct) + attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_direct; + + return (ObjCPropertyDecl::PropertyAttributeKind)attributesAsWritten; } static bool LocPropertyAttribute( ASTContext &Context, const char *attrName, @@ -345,10 +347,12 @@ static void checkAtomicPropertyMismatch(Sema &S, ObjCPropertyDecl *NewProperty, bool PropagateAtomicity) { // If the atomicity of both matches, we're done. - bool OldIsAtomic = (OldProperty->getPropertyAttributes() & - ObjCPropertyAttribute::kind_nonatomic) == 0; - bool NewIsAtomic = (NewProperty->getPropertyAttributes() & - ObjCPropertyAttribute::kind_nonatomic) == 0; + bool OldIsAtomic = + (OldProperty->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_nonatomic) + == 0; + bool NewIsAtomic = + (NewProperty->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_nonatomic) + == 0; if (OldIsAtomic == NewIsAtomic) return; // Determine whether the given property is readonly and implicitly @@ -356,16 +360,14 @@ static void checkAtomicPropertyMismatch(Sema &S, auto isImplicitlyReadonlyAtomic = [](ObjCPropertyDecl *Property) -> bool { // Is it readonly? auto Attrs = Property->getPropertyAttributes(); - if ((Attrs & ObjCPropertyAttribute::kind_readonly) == 0) - return false; + if ((Attrs & ObjCPropertyDecl::OBJC_PR_readonly) == 0) return false; // Is it nonatomic? - if (Attrs & ObjCPropertyAttribute::kind_nonatomic) - return false; + if (Attrs & ObjCPropertyDecl::OBJC_PR_nonatomic) return false; // Was 'atomic' specified directly? if (Property->getPropertyAttributesAsWritten() & - ObjCPropertyAttribute::kind_atomic) + ObjCPropertyDecl::OBJC_PR_atomic) return false; return true; @@ -373,16 +375,16 @@ static void checkAtomicPropertyMismatch(Sema &S, // If we're allowed to propagate atomicity, and the new property did // not specify atomicity at all, propagate. - const unsigned AtomicityMask = (ObjCPropertyAttribute::kind_atomic | - ObjCPropertyAttribute::kind_nonatomic); + const unsigned AtomicityMask = + (ObjCPropertyDecl::OBJC_PR_atomic | ObjCPropertyDecl::OBJC_PR_nonatomic); if (PropagateAtomicity && ((NewProperty->getPropertyAttributesAsWritten() & AtomicityMask) == 0)) { unsigned Attrs = NewProperty->getPropertyAttributes(); Attrs = Attrs & ~AtomicityMask; if (OldIsAtomic) - Attrs |= ObjCPropertyAttribute::kind_atomic; + Attrs |= ObjCPropertyDecl::OBJC_PR_atomic; else - Attrs |= ObjCPropertyAttribute::kind_nonatomic; + Attrs |= ObjCPropertyDecl::OBJC_PR_nonatomic; NewProperty->overwritePropertyAttributes(Attrs); return; @@ -436,9 +438,8 @@ Sema::HandlePropertyInClassExtension(Scope *S, return nullptr; } - bool isClassProperty = - (AttributesAsWritten & ObjCPropertyAttribute::kind_class) || - (Attributes & ObjCPropertyAttribute::kind_class); + bool isClassProperty = (AttributesAsWritten & ObjCDeclSpec::DQ_PR_class) || + (Attributes & ObjCDeclSpec::DQ_PR_class); // Find the property in the extended class's primary class or // extensions. @@ -463,11 +464,11 @@ Sema::HandlePropertyInClassExtension(Scope *S, // This is a common error where the user often intended the original // declaration to be readonly. unsigned diag = - (Attributes & ObjCPropertyAttribute::kind_readwrite) && - (PIDecl->getPropertyAttributesAsWritten() & - ObjCPropertyAttribute::kind_readwrite) - ? diag::err_use_continuation_class_redeclaration_readwrite - : diag::err_use_continuation_class; + (Attributes & ObjCDeclSpec::DQ_PR_readwrite) && + (PIDecl->getPropertyAttributesAsWritten() & + ObjCPropertyDecl::OBJC_PR_readwrite) + ? diag::err_use_continuation_class_redeclaration_readwrite + : diag::err_use_continuation_class; Diag(AtLoc, diag) << CCPrimary->getDeclName(); Diag(PIDecl->getLocation(), diag::note_property_declare); @@ -477,15 +478,15 @@ Sema::HandlePropertyInClassExtension(Scope *S, // Check for consistency of getters. if (PIDecl->getGetterName() != GetterSel) { // If the getter was written explicitly, complain. - if (AttributesAsWritten & ObjCPropertyAttribute::kind_getter) { - Diag(AtLoc, diag::warn_property_redecl_getter_mismatch) - << PIDecl->getGetterName() << GetterSel; - Diag(PIDecl->getLocation(), diag::note_property_declare); - } + if (AttributesAsWritten & ObjCDeclSpec::DQ_PR_getter) { + Diag(AtLoc, diag::warn_property_redecl_getter_mismatch) + << PIDecl->getGetterName() << GetterSel; + Diag(PIDecl->getLocation(), diag::note_property_declare); + } // Always adopt the getter from the original declaration. GetterSel = PIDecl->getGetterName(); - Attributes |= ObjCPropertyAttribute::kind_getter; + Attributes |= ObjCDeclSpec::DQ_PR_getter; } // Check consistency of ownership. @@ -504,9 +505,9 @@ Sema::HandlePropertyInClassExtension(Scope *S, } // If the redeclaration is 'weak' but the original property is not, - if ((Attributes & ObjCPropertyAttribute::kind_weak) && - !(PIDecl->getPropertyAttributesAsWritten() & - ObjCPropertyAttribute::kind_weak) && + if ((Attributes & ObjCPropertyDecl::OBJC_PR_weak) && + !(PIDecl->getPropertyAttributesAsWritten() + & ObjCPropertyDecl::OBJC_PR_weak) && PIDecl->getType()->getAs() && PIDecl->getType().getObjCLifetime() == Qualifiers::OCL_None) { Diag(AtLoc, diag::warn_property_implicitly_mismatched); @@ -583,8 +584,8 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S, // Property defaults to 'assign' if it is readwrite, unless this is ARC // and the type is retainable. bool isAssign; - if (Attributes & (ObjCPropertyAttribute::kind_assign | - ObjCPropertyAttribute::kind_unsafe_unretained)) { + if (Attributes & (ObjCDeclSpec::DQ_PR_assign | + ObjCDeclSpec::DQ_PR_unsafe_unretained)) { isAssign = true; } else if (getOwnershipRule(Attributes) || !isReadWrite) { isAssign = false; @@ -595,8 +596,8 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S, // Issue a warning if property is 'assign' as default and its // object, which is gc'able conforms to NSCopying protocol - if (getLangOpts().getGC() != LangOptions::NonGC && isAssign && - !(Attributes & ObjCPropertyAttribute::kind_assign)) { + if (getLangOpts().getGC() != LangOptions::NonGC && + isAssign && !(Attributes & ObjCDeclSpec::DQ_PR_assign)) { if (const ObjCObjectPointerType *ObjPtrTy = T->getAs()) { ObjCInterfaceDecl *IDecl = ObjPtrTy->getObjectType()->getInterface(); @@ -624,9 +625,8 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S, PropertyId, AtLoc, LParenLoc, T, TInfo); - bool isClassProperty = - (AttributesAsWritten & ObjCPropertyAttribute::kind_class) || - (Attributes & ObjCPropertyAttribute::kind_class); + bool isClassProperty = (AttributesAsWritten & ObjCDeclSpec::DQ_PR_class) || + (Attributes & ObjCDeclSpec::DQ_PR_class); // Class property and instance property can have the same name. if (ObjCPropertyDecl *prevDecl = ObjCPropertyDecl::findPropertyDecl( DC, PropertyId, ObjCPropertyDecl::getQueryKind(isClassProperty))) { @@ -654,68 +654,68 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S, PDecl->setPropertyAttributesAsWritten( makePropertyAttributesAsWritten(AttributesAsWritten)); - if (Attributes & ObjCPropertyAttribute::kind_readonly) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_readonly); + if (Attributes & ObjCDeclSpec::DQ_PR_readonly) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readonly); - if (Attributes & ObjCPropertyAttribute::kind_getter) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_getter); + if (Attributes & ObjCDeclSpec::DQ_PR_getter) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_getter); - if (Attributes & ObjCPropertyAttribute::kind_setter) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_setter); + if (Attributes & ObjCDeclSpec::DQ_PR_setter) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_setter); if (isReadWrite) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_readwrite); + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readwrite); - if (Attributes & ObjCPropertyAttribute::kind_retain) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_retain); + if (Attributes & ObjCDeclSpec::DQ_PR_retain) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_retain); - if (Attributes & ObjCPropertyAttribute::kind_strong) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_strong); + if (Attributes & ObjCDeclSpec::DQ_PR_strong) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong); - if (Attributes & ObjCPropertyAttribute::kind_weak) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_weak); + if (Attributes & ObjCDeclSpec::DQ_PR_weak) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_weak); - if (Attributes & ObjCPropertyAttribute::kind_copy) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_copy); + if (Attributes & ObjCDeclSpec::DQ_PR_copy) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_copy); - if (Attributes & ObjCPropertyAttribute::kind_unsafe_unretained) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_unsafe_unretained); + if (Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_unsafe_unretained); if (isAssign) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_assign); + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_assign); // In the semantic attributes, one of nonatomic or atomic is always set. - if (Attributes & ObjCPropertyAttribute::kind_nonatomic) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_nonatomic); + if (Attributes & ObjCDeclSpec::DQ_PR_nonatomic) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_nonatomic); else - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_atomic); + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_atomic); // 'unsafe_unretained' is alias for 'assign'. - if (Attributes & ObjCPropertyAttribute::kind_unsafe_unretained) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_assign); + if (Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_assign); if (isAssign) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_unsafe_unretained); + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_unsafe_unretained); if (MethodImplKind == tok::objc_required) PDecl->setPropertyImplementation(ObjCPropertyDecl::Required); else if (MethodImplKind == tok::objc_optional) PDecl->setPropertyImplementation(ObjCPropertyDecl::Optional); - if (Attributes & ObjCPropertyAttribute::kind_nullability) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_nullability); + if (Attributes & ObjCDeclSpec::DQ_PR_nullability) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_nullability); - if (Attributes & ObjCPropertyAttribute::kind_null_resettable) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_null_resettable); + if (Attributes & ObjCDeclSpec::DQ_PR_null_resettable) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_null_resettable); - if (Attributes & ObjCPropertyAttribute::kind_class) - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_class); + if (Attributes & ObjCDeclSpec::DQ_PR_class) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_class); - if ((Attributes & ObjCPropertyAttribute::kind_direct) || + if ((Attributes & ObjCDeclSpec::DQ_PR_direct) || CDecl->hasAttr()) { if (isa(CDecl)) { Diag(PDecl->getLocation(), diag::err_objc_direct_on_protocol) << true; } else if (getLangOpts().ObjCRuntime.allowsDirectDispatch()) { - PDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_direct); + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_direct); } else { Diag(PDecl->getLocation(), diag::warn_objc_direct_property_ignored) << PDecl->getDeclName(); @@ -781,9 +781,10 @@ static void checkARCPropertyImpl(Sema &S, SourceLocation propertyImplLoc, case Qualifiers::OCL_ExplicitNone: S.Diag(ivar->getLocation(), diag::err_arc_assign_property_ownership) - << property->getDeclName() << ivar->getDeclName() - << ((property->getPropertyAttributesAsWritten() & - ObjCPropertyAttribute::kind_assign) != 0); + << property->getDeclName() + << ivar->getDeclName() + << ((property->getPropertyAttributesAsWritten() + & ObjCPropertyDecl::OBJC_PR_assign) != 0); break; case Qualifiers::OCL_Autoreleasing: @@ -814,20 +815,21 @@ static void setImpliedPropertyAttributeForReadOnlyProperty( if (!ivar) { // if no backing ivar, make property 'strong'. - property->setPropertyAttributes(ObjCPropertyAttribute::kind_strong); + property->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong); return; } // property assumes owenership of backing ivar. QualType ivarType = ivar->getType(); Qualifiers::ObjCLifetime ivarLifetime = ivarType.getObjCLifetime(); if (ivarLifetime == Qualifiers::OCL_Strong) - property->setPropertyAttributes(ObjCPropertyAttribute::kind_strong); + property->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong); else if (ivarLifetime == Qualifiers::OCL_Weak) - property->setPropertyAttributes(ObjCPropertyAttribute::kind_weak); + property->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_weak); } -static bool isIncompatiblePropertyAttribute(unsigned Attr1, unsigned Attr2, - ObjCPropertyAttribute::Kind Kind) { +static bool +isIncompatiblePropertyAttribute(unsigned Attr1, unsigned Attr2, + ObjCPropertyDecl::PropertyAttributeKind Kind) { return (Attr1 & Kind) != (Attr2 & Kind); } @@ -910,31 +912,30 @@ SelectPropertyForSynthesisFromProtocols(Sema &S, SourceLocation AtLoc, }; // The ownership might be incompatible unless the property has no explicit // ownership. - bool HasOwnership = - (Attr & (ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_strong | - ObjCPropertyAttribute::kind_copy | - ObjCPropertyAttribute::kind_assign | - ObjCPropertyAttribute::kind_unsafe_unretained | - ObjCPropertyAttribute::kind_weak)) != 0; + bool HasOwnership = (Attr & (ObjCPropertyDecl::OBJC_PR_retain | + ObjCPropertyDecl::OBJC_PR_strong | + ObjCPropertyDecl::OBJC_PR_copy | + ObjCPropertyDecl::OBJC_PR_assign | + ObjCPropertyDecl::OBJC_PR_unsafe_unretained | + ObjCPropertyDecl::OBJC_PR_weak)) != 0; if (HasOwnership && isIncompatiblePropertyAttribute(OriginalAttributes, Attr, - ObjCPropertyAttribute::kind_copy)) { - Diag(OriginalAttributes & ObjCPropertyAttribute::kind_copy, "copy"); + ObjCPropertyDecl::OBJC_PR_copy)) { + Diag(OriginalAttributes & ObjCPropertyDecl::OBJC_PR_copy, "copy"); continue; } if (HasOwnership && areIncompatiblePropertyAttributes( OriginalAttributes, Attr, - ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_strong)) { - Diag(OriginalAttributes & (ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_strong), + ObjCPropertyDecl::OBJC_PR_retain | + ObjCPropertyDecl::OBJC_PR_strong)) { + Diag(OriginalAttributes & (ObjCPropertyDecl::OBJC_PR_retain | + ObjCPropertyDecl::OBJC_PR_strong), "retain (or strong)"); continue; } if (isIncompatiblePropertyAttribute(OriginalAttributes, Attr, - ObjCPropertyAttribute::kind_atomic)) { - Diag(OriginalAttributes & ObjCPropertyAttribute::kind_atomic, "atomic"); + ObjCPropertyDecl::OBJC_PR_atomic)) { + Diag(OriginalAttributes & ObjCPropertyDecl::OBJC_PR_atomic, "atomic"); continue; } } @@ -1125,8 +1126,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, return nullptr; } unsigned PIkind = property->getPropertyAttributesAsWritten(); - if ((PIkind & (ObjCPropertyAttribute::kind_atomic | - ObjCPropertyAttribute::kind_nonatomic)) == 0) { + if ((PIkind & (ObjCPropertyDecl::OBJC_PR_atomic | + ObjCPropertyDecl::OBJC_PR_nonatomic) ) == 0) { if (AtLoc.isValid()) Diag(AtLoc, diag::warn_implicit_atomic_property); else @@ -1142,8 +1143,10 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, return nullptr; } } - if (Synthesize && (PIkind & ObjCPropertyAttribute::kind_readonly) && - property->hasAttr() && !AtLoc.isValid()) { + if (Synthesize&& + (PIkind & ObjCPropertyDecl::OBJC_PR_readonly) && + property->hasAttr() && + !AtLoc.isValid()) { bool ReadWriteProperty = false; // Search into the class extensions and see if 'readonly property is // redeclared 'readwrite', then no warning is to be issued. @@ -1152,7 +1155,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, if (!R.empty()) if (ObjCPropertyDecl *ExtProp = dyn_cast(R[0])) { PIkind = ExtProp->getPropertyAttributesAsWritten(); - if (PIkind & ObjCPropertyAttribute::kind_readwrite) { + if (PIkind & ObjCPropertyDecl::OBJC_PR_readwrite) { ReadWriteProperty = true; break; } @@ -1229,15 +1232,16 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, if (getLangOpts().ObjCAutoRefCount && (property->getPropertyAttributesAsWritten() & - ObjCPropertyAttribute::kind_readonly) && + ObjCPropertyDecl::OBJC_PR_readonly) && PropertyIvarType->isObjCRetainableType()) { setImpliedPropertyAttributeForReadOnlyProperty(property, Ivar); } - ObjCPropertyAttribute::Kind kind = property->getPropertyAttributes(); + ObjCPropertyDecl::PropertyAttributeKind kind + = property->getPropertyAttributes(); bool isARCWeak = false; - if (kind & ObjCPropertyAttribute::kind_weak) { + if (kind & ObjCPropertyDecl::OBJC_PR_weak) { // Add GC __weak to the ivar type if the property is weak. if (getLangOpts().getGC() != LangOptions::NonGC) { assert(!getLangOpts().ObjCAutoRefCount); @@ -1308,7 +1312,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, // It's an error if we have to do this and the user didn't // explicitly write an ownership attribute on the property. if (!hasWrittenStorageAttribute(property, QueryKind) && - !(kind & ObjCPropertyAttribute::kind_strong)) { + !(kind & ObjCPropertyDecl::OBJC_PR_strong)) { Diag(PropertyDiagLoc, diag::err_arc_objc_property_default_assign_on_object); Diag(property->getLocation(), diag::note_property_declare); @@ -1547,7 +1551,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, ExprResult Res = BuildBinOp(S, PropertyDiagLoc, BO_Assign, lhs, rhs); if (property->getPropertyAttributes() & - ObjCPropertyAttribute::kind_atomic) { + ObjCPropertyDecl::OBJC_PR_atomic) { Expr *callExpr = Res.getAs(); if (const CXXOperatorCallExpr *CXXCE = dyn_cast_or_null(callExpr)) @@ -1647,8 +1651,10 @@ Sema::DiagnosePropertyMismatch(ObjCPropertyDecl *Property, ObjCPropertyDecl *SuperProperty, const IdentifierInfo *inheritedName, bool OverridingProtocolProperty) { - ObjCPropertyAttribute::Kind CAttr = Property->getPropertyAttributes(); - ObjCPropertyAttribute::Kind SAttr = SuperProperty->getPropertyAttributes(); + ObjCPropertyDecl::PropertyAttributeKind CAttr = + Property->getPropertyAttributes(); + ObjCPropertyDecl::PropertyAttributeKind SAttr = + SuperProperty->getPropertyAttributes(); // We allow readonly properties without an explicit ownership // (assign/unsafe_unretained/weak/retain/strong/copy) in super class @@ -1657,19 +1663,21 @@ Sema::DiagnosePropertyMismatch(ObjCPropertyDecl *Property, !getOwnershipRule(SAttr) && getOwnershipRule(CAttr)) ; else { - if ((CAttr & ObjCPropertyAttribute::kind_readonly) && - (SAttr & ObjCPropertyAttribute::kind_readwrite)) + if ((CAttr & ObjCPropertyDecl::OBJC_PR_readonly) + && (SAttr & ObjCPropertyDecl::OBJC_PR_readwrite)) Diag(Property->getLocation(), diag::warn_readonly_property) << Property->getDeclName() << inheritedName; - if ((CAttr & ObjCPropertyAttribute::kind_copy) != - (SAttr & ObjCPropertyAttribute::kind_copy)) + if ((CAttr & ObjCPropertyDecl::OBJC_PR_copy) + != (SAttr & ObjCPropertyDecl::OBJC_PR_copy)) Diag(Property->getLocation(), diag::warn_property_attribute) << Property->getDeclName() << "copy" << inheritedName; - else if (!(SAttr & ObjCPropertyAttribute::kind_readonly)) { - unsigned CAttrRetain = (CAttr & (ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_strong)); - unsigned SAttrRetain = (SAttr & (ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_strong)); + else if (!(SAttr & ObjCPropertyDecl::OBJC_PR_readonly)){ + unsigned CAttrRetain = + (CAttr & + (ObjCPropertyDecl::OBJC_PR_retain | ObjCPropertyDecl::OBJC_PR_strong)); + unsigned SAttrRetain = + (SAttr & + (ObjCPropertyDecl::OBJC_PR_retain | ObjCPropertyDecl::OBJC_PR_strong)); bool CStrong = (CAttrRetain != 0); bool SStrong = (SAttrRetain != 0); if (CStrong != SStrong) @@ -1877,7 +1885,7 @@ static bool SuperClassImplementsProperty(ObjCInterfaceDecl *IDecl, ObjCPropertyDecl *Prop) { bool SuperClassImplementsGetter = false; bool SuperClassImplementsSetter = false; - if (Prop->getPropertyAttributes() & ObjCPropertyAttribute::kind_readonly) + if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readonly) SuperClassImplementsSetter = true; while (IDecl->getSuperClass()) { @@ -1920,7 +1928,7 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, continue; ObjCMethodDecl *ImpMethod = IMPDecl->getInstanceMethod(Prop->getGetterName()); if (ImpMethod && !ImpMethod->getBody()) { - if (Prop->getPropertyAttributes() & ObjCPropertyAttribute::kind_readonly) + if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readonly) continue; ImpMethod = IMPDecl->getInstanceMethod(Prop->getSetterName()); if (ImpMethod && !ImpMethod->getBody()) @@ -1957,16 +1965,16 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, } // If property to be implemented in the super class, ignore. if (PropInSuperClass) { - if ((Prop->getPropertyAttributes() & - ObjCPropertyAttribute::kind_readwrite) && + if ((Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite) && (PropInSuperClass->getPropertyAttributes() & - ObjCPropertyAttribute::kind_readonly) && + ObjCPropertyDecl::OBJC_PR_readonly) && !IMPDecl->getInstanceMethod(Prop->getSetterName()) && !IDecl->HasUserDeclaredSetterMethod(Prop)) { Diag(Prop->getLocation(), diag::warn_no_autosynthesis_property) << Prop->getIdentifier(); Diag(PropInSuperClass->getLocation(), diag::note_property_declare); - } else { + } + else { Diag(Prop->getLocation(), diag::warn_autosynthesis_property_in_superclass) << Prop->getIdentifier(); Diag(PropInSuperClass->getLocation(), diag::note_property_declare); @@ -2153,11 +2161,12 @@ void Sema::diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl) const auto *property = propertyImpl->getPropertyDecl(); // Warn about null_resettable properties with synthesized setters, // because the setter won't properly handle nil. - if (propertyImpl->getPropertyImplementation() == - ObjCPropertyImplDecl::Synthesize && + if (propertyImpl->getPropertyImplementation() + == ObjCPropertyImplDecl::Synthesize && (property->getPropertyAttributes() & - ObjCPropertyAttribute::kind_null_resettable) && - property->getGetterMethodDecl() && property->getSetterMethodDecl()) { + ObjCPropertyDecl::OBJC_PR_null_resettable) && + property->getGetterMethodDecl() && + property->getSetterMethodDecl()) { auto *getterImpl = propertyImpl->getGetterMethodDecl(); auto *setterImpl = propertyImpl->getSetterMethodDecl(); if ((!getterImpl || getterImpl->isSynthesizedAccessorStub()) && @@ -2195,8 +2204,8 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl, unsigned Attributes = Property->getPropertyAttributes(); unsigned AttributesAsWritten = Property->getPropertyAttributesAsWritten(); - if (!(AttributesAsWritten & ObjCPropertyAttribute::kind_atomic) && - !(AttributesAsWritten & ObjCPropertyAttribute::kind_nonatomic)) { + if (!(AttributesAsWritten & ObjCPropertyDecl::OBJC_PR_atomic) && + !(AttributesAsWritten & ObjCPropertyDecl::OBJC_PR_nonatomic)) { GetterMethod = Property->isClassProperty() ? IMPDecl->getClassMethod(Property->getGetterName()) : IMPDecl->getInstanceMethod(Property->getGetterName()); @@ -2222,8 +2231,8 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl, } // We only care about readwrite atomic property. - if ((Attributes & ObjCPropertyAttribute::kind_nonatomic) || - !(Attributes & ObjCPropertyAttribute::kind_readwrite)) + if ((Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) || + !(Attributes & ObjCPropertyDecl::OBJC_PR_readwrite)) continue; if (const ObjCPropertyImplDecl *PIDecl = IMPDecl->FindPropertyImplDecl( Property->getIdentifier(), Property->getQueryKind())) { @@ -2244,7 +2253,7 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl, << (SetterMethod != nullptr); // fixit stuff. if (Property->getLParenLoc().isValid() && - !(AttributesAsWritten & ObjCPropertyAttribute::kind_atomic)) { + !(AttributesAsWritten & ObjCPropertyDecl::OBJC_PR_atomic)) { // @property () ... case. SourceLocation AfterLParen = getLocForEndOfToken(Property->getLParenLoc()); @@ -2260,7 +2269,8 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl, Diag(Property->getLocation(), diag::note_atomic_property_fixup_suggest) << FixItHint::CreateInsertion(startLoc, "(nonatomic) "); - } else + } + else Diag(MethodLoc, diag::note_atomic_property_fixup_suggest); Diag(Property->getLocation(), diag::note_property_declare); } @@ -2488,7 +2498,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property) { // If the property is null_resettable, the getter returns nonnull. if (property->getPropertyAttributes() & - ObjCPropertyAttribute::kind_null_resettable) { + ObjCPropertyDecl::OBJC_PR_null_resettable) { QualType modifiedTy = resultTy; if (auto nullability = AttributedType::stripOuterNullability(modifiedTy)) { if (*nullability == NullabilityKind::Unspecified) @@ -2567,7 +2577,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property) { // If the property is null_resettable, the setter accepts a // nullable value. if (property->getPropertyAttributes() & - ObjCPropertyAttribute::kind_null_resettable) { + ObjCPropertyDecl::OBJC_PR_null_resettable) { QualType modifiedTy = paramTy; if (auto nullability = AttributedType::stripOuterNullability(modifiedTy)){ if (*nullability == NullabilityKind::Unspecified) @@ -2655,8 +2665,8 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, if (!PDecl || PDecl->isInvalidDecl()) return; - if ((Attributes & ObjCPropertyAttribute::kind_readonly) && - (Attributes & ObjCPropertyAttribute::kind_readwrite)) + if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) && + (Attributes & ObjCDeclSpec::DQ_PR_readwrite)) Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "readonly" << "readwrite"; @@ -2664,109 +2674,104 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, QualType PropertyTy = PropertyDecl->getType(); // Check for copy or retain on non-object types. - if ((Attributes & - (ObjCPropertyAttribute::kind_weak | ObjCPropertyAttribute::kind_copy | - ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_strong)) && + if ((Attributes & (ObjCDeclSpec::DQ_PR_weak | ObjCDeclSpec::DQ_PR_copy | + ObjCDeclSpec::DQ_PR_retain | ObjCDeclSpec::DQ_PR_strong)) && !PropertyTy->isObjCRetainableType() && !PropertyDecl->hasAttr()) { Diag(Loc, diag::err_objc_property_requires_object) - << (Attributes & ObjCPropertyAttribute::kind_weak - ? "weak" - : Attributes & ObjCPropertyAttribute::kind_copy - ? "copy" - : "retain (or strong)"); - Attributes &= - ~(ObjCPropertyAttribute::kind_weak | ObjCPropertyAttribute::kind_copy | - ObjCPropertyAttribute::kind_retain | - ObjCPropertyAttribute::kind_strong); + << (Attributes & ObjCDeclSpec::DQ_PR_weak ? "weak" : + Attributes & ObjCDeclSpec::DQ_PR_copy ? "copy" : "retain (or strong)"); + Attributes &= ~(ObjCDeclSpec::DQ_PR_weak | ObjCDeclSpec::DQ_PR_copy | + ObjCDeclSpec::DQ_PR_retain | ObjCDeclSpec::DQ_PR_strong); PropertyDecl->setInvalidDecl(); } // Check for assign on object types. - if ((Attributes & ObjCPropertyAttribute::kind_assign) && - !(Attributes & ObjCPropertyAttribute::kind_unsafe_unretained) && + if ((Attributes & ObjCDeclSpec::DQ_PR_assign) && + !(Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained) && PropertyTy->isObjCRetainableType() && !PropertyTy->isObjCARCImplicitlyUnretainedType()) { Diag(Loc, diag::warn_objc_property_assign_on_object); } // Check for more than one of { assign, copy, retain }. - if (Attributes & ObjCPropertyAttribute::kind_assign) { - if (Attributes & ObjCPropertyAttribute::kind_copy) { + if (Attributes & ObjCDeclSpec::DQ_PR_assign) { + if (Attributes & ObjCDeclSpec::DQ_PR_copy) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "assign" << "copy"; - Attributes &= ~ObjCPropertyAttribute::kind_copy; + Attributes &= ~ObjCDeclSpec::DQ_PR_copy; } - if (Attributes & ObjCPropertyAttribute::kind_retain) { + if (Attributes & ObjCDeclSpec::DQ_PR_retain) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "assign" << "retain"; - Attributes &= ~ObjCPropertyAttribute::kind_retain; + Attributes &= ~ObjCDeclSpec::DQ_PR_retain; } - if (Attributes & ObjCPropertyAttribute::kind_strong) { + if (Attributes & ObjCDeclSpec::DQ_PR_strong) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "assign" << "strong"; - Attributes &= ~ObjCPropertyAttribute::kind_strong; + Attributes &= ~ObjCDeclSpec::DQ_PR_strong; } - if (getLangOpts().ObjCAutoRefCount && - (Attributes & ObjCPropertyAttribute::kind_weak)) { + if (getLangOpts().ObjCAutoRefCount && + (Attributes & ObjCDeclSpec::DQ_PR_weak)) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "assign" << "weak"; - Attributes &= ~ObjCPropertyAttribute::kind_weak; + Attributes &= ~ObjCDeclSpec::DQ_PR_weak; } if (PropertyDecl->hasAttr()) Diag(Loc, diag::warn_iboutletcollection_property_assign); - } else if (Attributes & ObjCPropertyAttribute::kind_unsafe_unretained) { - if (Attributes & ObjCPropertyAttribute::kind_copy) { + } else if (Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained) { + if (Attributes & ObjCDeclSpec::DQ_PR_copy) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "unsafe_unretained" << "copy"; - Attributes &= ~ObjCPropertyAttribute::kind_copy; + Attributes &= ~ObjCDeclSpec::DQ_PR_copy; } - if (Attributes & ObjCPropertyAttribute::kind_retain) { + if (Attributes & ObjCDeclSpec::DQ_PR_retain) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "unsafe_unretained" << "retain"; - Attributes &= ~ObjCPropertyAttribute::kind_retain; + Attributes &= ~ObjCDeclSpec::DQ_PR_retain; } - if (Attributes & ObjCPropertyAttribute::kind_strong) { + if (Attributes & ObjCDeclSpec::DQ_PR_strong) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "unsafe_unretained" << "strong"; - Attributes &= ~ObjCPropertyAttribute::kind_strong; + Attributes &= ~ObjCDeclSpec::DQ_PR_strong; } - if (getLangOpts().ObjCAutoRefCount && - (Attributes & ObjCPropertyAttribute::kind_weak)) { + if (getLangOpts().ObjCAutoRefCount && + (Attributes & ObjCDeclSpec::DQ_PR_weak)) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "unsafe_unretained" << "weak"; - Attributes &= ~ObjCPropertyAttribute::kind_weak; + Attributes &= ~ObjCDeclSpec::DQ_PR_weak; } - } else if (Attributes & ObjCPropertyAttribute::kind_copy) { - if (Attributes & ObjCPropertyAttribute::kind_retain) { + } else if (Attributes & ObjCDeclSpec::DQ_PR_copy) { + if (Attributes & ObjCDeclSpec::DQ_PR_retain) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "copy" << "retain"; - Attributes &= ~ObjCPropertyAttribute::kind_retain; + Attributes &= ~ObjCDeclSpec::DQ_PR_retain; } - if (Attributes & ObjCPropertyAttribute::kind_strong) { + if (Attributes & ObjCDeclSpec::DQ_PR_strong) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "copy" << "strong"; - Attributes &= ~ObjCPropertyAttribute::kind_strong; + Attributes &= ~ObjCDeclSpec::DQ_PR_strong; } - if (Attributes & ObjCPropertyAttribute::kind_weak) { + if (Attributes & ObjCDeclSpec::DQ_PR_weak) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "copy" << "weak"; - Attributes &= ~ObjCPropertyAttribute::kind_weak; + Attributes &= ~ObjCDeclSpec::DQ_PR_weak; } - } else if ((Attributes & ObjCPropertyAttribute::kind_retain) && - (Attributes & ObjCPropertyAttribute::kind_weak)) { - Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "retain" - << "weak"; - Attributes &= ~ObjCPropertyAttribute::kind_retain; - } else if ((Attributes & ObjCPropertyAttribute::kind_strong) && - (Attributes & ObjCPropertyAttribute::kind_weak)) { - Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "strong" - << "weak"; - Attributes &= ~ObjCPropertyAttribute::kind_weak; + } + else if ((Attributes & ObjCDeclSpec::DQ_PR_retain) && + (Attributes & ObjCDeclSpec::DQ_PR_weak)) { + Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) + << "retain" << "weak"; + Attributes &= ~ObjCDeclSpec::DQ_PR_retain; + } + else if ((Attributes & ObjCDeclSpec::DQ_PR_strong) && + (Attributes & ObjCDeclSpec::DQ_PR_weak)) { + Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) + << "strong" << "weak"; + Attributes &= ~ObjCDeclSpec::DQ_PR_weak; } - if (Attributes & ObjCPropertyAttribute::kind_weak) { + if (Attributes & ObjCDeclSpec::DQ_PR_weak) { // 'weak' and 'nonnull' are mutually exclusive. if (auto nullability = PropertyTy->getNullability(Context)) { if (*nullability == NullabilityKind::NonNull) @@ -2775,40 +2780,41 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, } } - if ((Attributes & ObjCPropertyAttribute::kind_atomic) && - (Attributes & ObjCPropertyAttribute::kind_nonatomic)) { - Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "atomic" - << "nonatomic"; - Attributes &= ~ObjCPropertyAttribute::kind_atomic; + if ((Attributes & ObjCDeclSpec::DQ_PR_atomic) && + (Attributes & ObjCDeclSpec::DQ_PR_nonatomic)) { + Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) + << "atomic" << "nonatomic"; + Attributes &= ~ObjCDeclSpec::DQ_PR_atomic; } // Warn if user supplied no assignment attribute, property is // readwrite, and this is an object type. if (!getOwnershipRule(Attributes) && PropertyTy->isObjCRetainableType()) { - if (Attributes & ObjCPropertyAttribute::kind_readonly) { + if (Attributes & ObjCDeclSpec::DQ_PR_readonly) { // do nothing } else if (getLangOpts().ObjCAutoRefCount) { // With arc, @property definitions should default to strong when // not specified. - PropertyDecl->setPropertyAttributes(ObjCPropertyAttribute::kind_strong); + PropertyDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong); } else if (PropertyTy->isObjCObjectPointerType()) { - bool isAnyClassTy = (PropertyTy->isObjCClassType() || - PropertyTy->isObjCQualifiedClassType()); - // In non-gc, non-arc mode, 'Class' is treated as a 'void *' no need to - // issue any warning. - if (isAnyClassTy && getLangOpts().getGC() == LangOptions::NonGC) - ; - else if (propertyInPrimaryClass) { - // Don't issue warning on property with no life time in class - // extension as it is inherited from property in primary class. - // Skip this warning in gc-only mode. - if (getLangOpts().getGC() != LangOptions::GCOnly) - Diag(Loc, diag::warn_objc_property_no_assignment_attribute); - - // If non-gc code warn that this is likely inappropriate. - if (getLangOpts().getGC() == LangOptions::NonGC) - Diag(Loc, diag::warn_objc_property_default_assign_on_object); - } + bool isAnyClassTy = + (PropertyTy->isObjCClassType() || + PropertyTy->isObjCQualifiedClassType()); + // In non-gc, non-arc mode, 'Class' is treated as a 'void *' no need to + // issue any warning. + if (isAnyClassTy && getLangOpts().getGC() == LangOptions::NonGC) + ; + else if (propertyInPrimaryClass) { + // Don't issue warning on property with no life time in class + // extension as it is inherited from property in primary class. + // Skip this warning in gc-only mode. + if (getLangOpts().getGC() != LangOptions::GCOnly) + Diag(Loc, diag::warn_objc_property_no_assignment_attribute); + + // If non-gc code warn that this is likely inappropriate. + if (getLangOpts().getGC() == LangOptions::NonGC) + Diag(Loc, diag::warn_objc_property_default_assign_on_object); + } } // FIXME: Implement warning dependent on NSCopying being @@ -2817,18 +2823,18 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, // (please trim this list while you are at it). } - if (!(Attributes & ObjCPropertyAttribute::kind_copy) && - !(Attributes & ObjCPropertyAttribute::kind_readonly) && - getLangOpts().getGC() == LangOptions::GCOnly && - PropertyTy->isBlockPointerType()) + if (!(Attributes & ObjCDeclSpec::DQ_PR_copy) + &&!(Attributes & ObjCDeclSpec::DQ_PR_readonly) + && getLangOpts().getGC() == LangOptions::GCOnly + && PropertyTy->isBlockPointerType()) Diag(Loc, diag::warn_objc_property_copy_missing_on_block); - else if ((Attributes & ObjCPropertyAttribute::kind_retain) && - !(Attributes & ObjCPropertyAttribute::kind_readonly) && - !(Attributes & ObjCPropertyAttribute::kind_strong) && + else if ((Attributes & ObjCDeclSpec::DQ_PR_retain) && + !(Attributes & ObjCDeclSpec::DQ_PR_readonly) && + !(Attributes & ObjCDeclSpec::DQ_PR_strong) && PropertyTy->isBlockPointerType()) - Diag(Loc, diag::warn_objc_property_retain_of_block); + Diag(Loc, diag::warn_objc_property_retain_of_block); - if ((Attributes & ObjCPropertyAttribute::kind_readonly) && - (Attributes & ObjCPropertyAttribute::kind_setter)) + if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) && + (Attributes & ObjCDeclSpec::DQ_PR_setter)) Diag(Loc, diag::warn_objc_readonly_property_has_setter); } diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp index 0ed45221177b9e..4413b24fa95811 100644 --- a/clang/lib/Sema/SemaPseudoObject.cpp +++ b/clang/lib/Sema/SemaPseudoObject.cpp @@ -580,7 +580,7 @@ bool ObjCPropertyOpBuilder::isWeakProperty() const { QualType T; if (RefExpr->isExplicitProperty()) { const ObjCPropertyDecl *Prop = RefExpr->getExplicitProperty(); - if (Prop->getPropertyAttributes() & ObjCPropertyAttribute::kind_weak) + if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak) return true; T = Prop->getType(); diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index b53653852f02a9..0a278c7506e1f6 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -1280,9 +1280,10 @@ void ASTDeclReader::VisitObjCPropertyDecl(ObjCPropertyDecl *D) { QualType T = Record.readType(); TypeSourceInfo *TSI = readTypeSourceInfo(); D->setType(T, TSI); - D->setPropertyAttributes((ObjCPropertyAttribute::Kind)Record.readInt()); + D->setPropertyAttributes( + (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt()); D->setPropertyAttributesAsWritten( - (ObjCPropertyAttribute::Kind)Record.readInt()); + (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt()); D->setPropertyImplementation( (ObjCPropertyDecl::PropertyControl)Record.readInt()); DeclarationName GetterName = Record.readDeclarationName(); diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index e441b19f9a17a7..dafe4ccda05f9d 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -22,7 +22,6 @@ #include "CursorVisitor.h" #include "clang-c/FatalErrorHandler.h" #include "clang/AST/Attr.h" -#include "clang/AST/DeclObjCCommon.h" #include "clang/AST/Mangle.h" #include "clang/AST/OpenMPClause.h" #include "clang/AST/StmtVisitor.h" @@ -8147,10 +8146,11 @@ unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C, unsigned reserved) { unsigned Result = CXObjCPropertyAttr_noattr; const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C)); - ObjCPropertyAttribute::Kind Attr = PD->getPropertyAttributesAsWritten(); + ObjCPropertyDecl::PropertyAttributeKind Attr = + PD->getPropertyAttributesAsWritten(); #define SET_CXOBJCPROP_ATTR(A) \ - if (Attr & ObjCPropertyAttribute::kind_##A) \ + if (Attr & ObjCPropertyDecl::OBJC_PR_##A) \ Result |= CXObjCPropertyAttr_##A SET_CXOBJCPROP_ATTR(readonly); SET_CXOBJCPROP_ATTR(getter); diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def index e2700d5a8639ba..b9a04b06a814e4 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.def +++ b/llvm/include/llvm/BinaryFormat/Dwarf.def @@ -898,8 +898,7 @@ HANDLE_DW_CFA_PRED(0x2d, AARCH64_negate_ra_state, SELECT_AARCH64) HANDLE_DW_CFA_PRED(0x2e, GNU_args_size, SELECT_X86) // Apple Objective-C Property Attributes. -// Keep this list in sync with clang's DeclObjCCommon.h -// ObjCPropertyAttribute::Kind! +// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind! HANDLE_DW_APPLE_PROPERTY(0x01, readonly) HANDLE_DW_APPLE_PROPERTY(0x02, getter) HANDLE_DW_APPLE_PROPERTY(0x04, assign) diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.h b/llvm/include/llvm/BinaryFormat/Dwarf.h index 3f3622149dfe33..45a3fc98d4b5bd 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.h +++ b/llvm/include/llvm/BinaryFormat/Dwarf.h @@ -357,8 +357,7 @@ enum Constants { }; /// Constants for the DW_APPLE_PROPERTY_attributes attribute. -/// Keep this list in sync with clang's DeclObjCCommon.h -/// ObjCPropertyAttribute::Kind! +/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind! enum ApplePropertyAttributes { #define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID, #include "llvm/BinaryFormat/Dwarf.def"