aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorPuyan Lotfi <puyan@puyan.org>2020-04-23 02:20:56 -0400
committerPuyan Lotfi <puyan@puyan.org>2020-04-23 17:21:25 -0400
commit9721fbf85b83c1cb67cea542c5558f99a07766cf (patch)
tree2dc3ecc4cd3fa0f73a367db1f97272920d27609e /clang/lib/Parse/ParseObjc.cpp
parentb53fd70b9eccdcd228c26b3e12dc984fe9acf23b (diff)
downloadllvm-9721fbf85b83c1cb67cea542c5558f99a07766cf.zip
llvm-9721fbf85b83c1cb67cea542c5558f99a07766cf.tar.gz
llvm-9721fbf85b83c1cb67cea542c5558f99a07766cf.tar.bz2
[NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.
This is a code clean up of the PropertyAttributeKind and ObjCPropertyAttributeKind enums in ObjCPropertyDecl and ObjCDeclSpec that are exactly identical. This non-functional change consolidates these enums into one. The changes are to many files across clang (and comments in LLVM) so that everything refers to the new consolidated enum in DeclObjCCommon.h. 2nd Landing Attempt... Differential Revision: https://reviews.llvm.org/D77233
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r--clang/lib/Parse/ParseObjc.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 10252b0..eaea866 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -740,7 +740,8 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey,
// Map a nullability property attribute to a context-sensitive keyword
// attribute.
- if (OCDS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nullability)
+ if (OCDS.getPropertyAttributes() &
+ ObjCPropertyAttribute::kind_nullability)
addContextSensitiveTypeNullability(*this, FD.D, OCDS.getNullability(),
OCDS.getNullabilityLoc(),
addedToDeclSpec);
@@ -860,25 +861,25 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) {
SourceLocation AttrName = ConsumeToken(); // consume last attribute name
if (II->isStr("readonly"))
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_readonly);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_readonly);
else if (II->isStr("assign"))
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_assign);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_assign);
else if (II->isStr("unsafe_unretained"))
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_unsafe_unretained);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_unsafe_unretained);
else if (II->isStr("readwrite"))
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_readwrite);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_readwrite);
else if (II->isStr("retain"))
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_retain);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_retain);
else if (II->isStr("strong"))
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_strong);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_strong);
else if (II->isStr("copy"))
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_copy);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_copy);
else if (II->isStr("nonatomic"))
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nonatomic);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_nonatomic);
else if (II->isStr("atomic"))
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_atomic);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_atomic);
else if (II->isStr("weak"))
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_weak);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_weak);
else if (II->isStr("getter") || II->isStr("setter")) {
bool IsSetter = II->getNameStart()[0] == 's';
@@ -910,7 +911,7 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) {
}
if (IsSetter) {
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_setter);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_setter);
DS.setSetterName(SelIdent, SelLoc);
if (ExpectAndConsume(tok::colon,
@@ -919,44 +920,44 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) {
return;
}
} else {
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_getter);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_getter);
DS.setGetterName(SelIdent, SelLoc);
}
} else if (II->isStr("nonnull")) {
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nullability)
+ if (DS.getPropertyAttributes() & ObjCPropertyAttribute::kind_nullability)
diagnoseRedundantPropertyNullability(*this, DS,
NullabilityKind::NonNull,
Tok.getLocation());
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nullability);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_nullability);
DS.setNullability(Tok.getLocation(), NullabilityKind::NonNull);
} else if (II->isStr("nullable")) {
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nullability)
+ if (DS.getPropertyAttributes() & ObjCPropertyAttribute::kind_nullability)
diagnoseRedundantPropertyNullability(*this, DS,
NullabilityKind::Nullable,
Tok.getLocation());
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nullability);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_nullability);
DS.setNullability(Tok.getLocation(), NullabilityKind::Nullable);
} else if (II->isStr("null_unspecified")) {
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nullability)
+ if (DS.getPropertyAttributes() & ObjCPropertyAttribute::kind_nullability)
diagnoseRedundantPropertyNullability(*this, DS,
NullabilityKind::Unspecified,
Tok.getLocation());
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nullability);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_nullability);
DS.setNullability(Tok.getLocation(), NullabilityKind::Unspecified);
} else if (II->isStr("null_resettable")) {
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nullability)
+ if (DS.getPropertyAttributes() & ObjCPropertyAttribute::kind_nullability)
diagnoseRedundantPropertyNullability(*this, DS,
NullabilityKind::Unspecified,
Tok.getLocation());
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nullability);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_nullability);
DS.setNullability(Tok.getLocation(), NullabilityKind::Unspecified);
// Also set the null_resettable bit.
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_null_resettable);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_null_resettable);
} else if (II->isStr("class")) {
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_class);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_class);
} else if (II->isStr("direct")) {
- DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_direct);
+ DS.setPropertyAttributes(ObjCPropertyAttribute::kind_direct);
} else {
Diag(AttrName, diag::err_objc_expected_property_attr) << II;
SkipUntil(tok::r_paren, StopAtSemi);