[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-12 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi marked 2 inline comments as done.
plotfi added inline comments.



Comment at: clang/include/clang/AST/DeclObjCCommon.h:21
+/// Keep this list in sync with LLVM's Dwarf.h ApplePropertyAttributes.
+enum ObjCPropertyAttributeKind {
+  OBJC_PR_noattr = 0x00,

plotfi wrote:
> compnerd wrote:
> > It seems that you are touching all the sites that use this, so perhaps this 
> > is the time to change this to `enum class` and drop the `OBJC_PR_` prefixes 
> > and explicitly inherit from `uint16_t`.  This should be named 
> > `ObjCPropertyAttribute` I think.
> Ah yeah, that sounds pretty good. Will do. 
Talked offline: update is that its not so easy to change these enums to enum 
classes because of how they are constantly used with unsigned ints. I could try 
and implement lots of operator overloads but I think that could be potentially 
buggy and not so NFC-like. @compnerd you wanted to leave the OBJC_PR_  and 
dropped the DQ prefixes right? Other than that, ping (for others)? I think this 
could be a nice cleanup. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-12 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added inline comments.



Comment at: clang/include/clang/AST/DeclObjCCommon.h:21
+/// Keep this list in sync with LLVM's Dwarf.h ApplePropertyAttributes.
+enum ObjCPropertyAttributeKind {
+  OBJC_PR_noattr = 0x00,

plotfi wrote:
> plotfi wrote:
> > compnerd wrote:
> > > It seems that you are touching all the sites that use this, so perhaps 
> > > this is the time to change this to `enum class` and drop the `OBJC_PR_` 
> > > prefixes and explicitly inherit from `uint16_t`.  This should be named 
> > > `ObjCPropertyAttribute` I think.
> > Ah yeah, that sounds pretty good. Will do. 
> Talked offline: update is that its not so easy to change these enums to enum 
> classes because of how they are constantly used with unsigned ints. I could 
> try and implement lots of operator overloads but I think that could be 
> potentially buggy and not so NFC-like. @compnerd you wanted to leave the 
> OBJC_PR_  and dropped the DQ prefixes right? Other than that, ping (for 
> others)? I think this could be a nice cleanup. 
If you just want the scoping benefits of the enum class you can simulate it 
with a `namespace`:

```
namespace ObjCPropertyAttribute {
enum {
  noattr,
  readonly,
  ...
};
}
```

Which would make the users of this enum look a bit nicer. I agree that adding 
overloading operators is over-engineering this. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-12 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi marked an inline comment as done.
plotfi added inline comments.



Comment at: clang/include/clang/AST/DeclObjCCommon.h:21
+/// Keep this list in sync with LLVM's Dwarf.h ApplePropertyAttributes.
+enum ObjCPropertyAttributeKind {
+  OBJC_PR_noattr = 0x00,

erik.pilkington wrote:
> plotfi wrote:
> > plotfi wrote:
> > > compnerd wrote:
> > > > It seems that you are touching all the sites that use this, so perhaps 
> > > > this is the time to change this to `enum class` and drop the `OBJC_PR_` 
> > > > prefixes and explicitly inherit from `uint16_t`.  This should be named 
> > > > `ObjCPropertyAttribute` I think.
> > > Ah yeah, that sounds pretty good. Will do. 
> > Talked offline: update is that its not so easy to change these enums to 
> > enum classes because of how they are constantly used with unsigned ints. I 
> > could try and implement lots of operator overloads but I think that could 
> > be potentially buggy and not so NFC-like. @compnerd you wanted to leave the 
> > OBJC_PR_  and dropped the DQ prefixes right? Other than that, ping (for 
> > others)? I think this could be a nice cleanup. 
> If you just want the scoping benefits of the enum class you can simulate it 
> with a `namespace`:
> 
> ```
> namespace ObjCPropertyAttribute {
> enum {
>   noattr,
>   readonly,
>   ...
> };
> }
> ```
> 
> Which would make the users of this enum look a bit nicer. I agree that adding 
> overloading operators is over-engineering this. 
Ah yeah, nice. so the prefixes can be dropped. Another reason I don't want to 
change the enum to an enun class is, from the comments it seems a lot of the 
use of unsigned is to avoid the differences in how Win32 vs *nix handle enums 
(signed vs unsigned I think). I'll post a follow up with the scoping. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-12 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi updated this revision to Diff 256931.
plotfi added a comment.

Move ObjCPropertyAttributeKind to namespace ObjCPropertyAttribute { enum Kind { 
... }}


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233

Files:
  clang/include/clang-c/Index.h
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclObjCCommon.h
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/ARCMigrate/TransGCAttrs.cpp
  clang/lib/ARCMigrate/TransProperties.cpp
  clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Frontend/Rewrite/RewriteObjC.cpp
  clang/lib/Parse/ParseObjc.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaPseudoObject.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/tools/c-index-test/c-index-test.c
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/BinaryFormat/Dwarf.def
  llvm/include/llvm/BinaryFormat/Dwarf.h

Index: llvm/include/llvm/BinaryFormat/Dwarf.h
===
--- llvm/include/llvm/BinaryFormat/Dwarf.h
+++ llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -357,7 +357,7 @@
 };
 
 /// Constants for the DW_APPLE_PROPERTY_attributes attribute.
-/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttribute::Kind!
 enum ApplePropertyAttributes {
 #define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID,
 #include "llvm/BinaryFormat/Dwarf.def"
Index: llvm/include/llvm/BinaryFormat/Dwarf.def
===
--- llvm/include/llvm/BinaryFormat/Dwarf.def
+++ llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -897,7 +897,7 @@
 HANDLE_DW_CFA_PRED(0x2e, GNU_args_size, SELECT_X86)
 
 // Apple Objective-C Property Attributes.
-// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttribute::Kind!
 HANDLE_DW_APPLE_PROPERTY(0x01, readonly)
 HANDLE_DW_APPLE_PROPERTY(0x02, getter)
 HANDLE_DW_APPLE_PROPERTY(0x04, assign)
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -22,6 +22,7 @@
 #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"
@@ -8143,11 +8144,10 @@
 
   unsigned Result = CXObjCPropertyAttr_noattr;
   const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C));
-  ObjCPropertyDecl::PropertyAttributeKind Attr =
-  PD->getPropertyAttributesAsWritten();
+  ObjCPropertyAttribute::Kind Attr = PD->getPropertyAttributesAsWritten();
 
 #define SET_CXOBJCPROP_ATTR(A) \
-  if (Attr & ObjCPropertyDecl::OBJC_PR_##A)\
+  if (Attr & ObjCPropertyAttribute::Kind::A)   \
   Result |= CXObjCPropertyAttr_##A
   SET_CXOBJCPROP_ATTR(readonly);
   SET_CXOBJCPROP_ATTR(getter);
@@ -8161,7 +8161,7 @@
   SET_CXOBJCPROP_ATTR(weak);
   SET_CXOBJCPROP_ATTR(strong);
   SET_CXOBJCPROP_ATTR(unsafe_unretained);
-  SET_CXOBJCPROP_ATTR(class);
+  SET_CXOBJCPROP_ATTR(classattr);
 #undef SET_CXOBJCPROP_ATTR
 
   return Result;
Index: clang/tools/c-index-test/c-index-test.c
===
--- clang/tools/c-index-test/c-index-test.c
+++ clang/tools/c-index-test/c-index-test.c
@@ -1104,7 +1104,7 @@
 PRINT_PROP_ATTR(weak);
 PRINT_PROP_ATTR(strong);
 PRINT_PROP_ATTR(unsafe_unretained);
-PRINT_PROP_ATTR(class);
+PRINT_PROP_ATTR(classattr);
 printf("]");
   }
 }
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1279,10 +1279,9 @@
   QualType T = Record.readType();
   TypeSourceInfo *TSI = readTypeSourceInfo();
   D->setType(T, TSI);
-  D->setPropertyAttributes(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  D->setPropertyAttributes((ObjCPropertyAttribute::Kind)Record.readInt());
   D->setPropertyAttributesAsWritten(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  (ObjCPropertyAttribute::Kind)Reco

[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-13 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington accepted this revision.
erik.pilkington added a comment.
This revision is now accepted and ready to land.

LGTM (after fixing those tests). Thanks for cleaning this up!




Comment at: clang/tools/c-index-test/c-index-test.c:1107
 PRINT_PROP_ATTR(unsafe_unretained);
-PRINT_PROP_ATTR(class);
+PRINT_PROP_ATTR(classattr);
 printf("]");

Hm, looks like this change is breaking some CHECK lines in the indexer tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-13 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added inline comments.



Comment at: clang/include/clang-c/Index.h:4503
   CXObjCPropertyAttr_unsafe_unretained = 0x800,
-  CXObjCPropertyAttr_class = 0x1000
+  CXObjCPropertyAttr_classattr = 0x1000
 } CXObjCPropertyAttrKind;

@erik.pilkington  Do you think we should be adding the C-API analogs of 
nullability / null_resettable (and direct) to clang/include/clang-c/Index.h? 

I noticed those are missing.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-13 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington requested changes to this revision.
erik.pilkington added inline comments.
This revision now requires changes to proceed.



Comment at: clang/include/clang-c/Index.h:4503
   CXObjCPropertyAttr_unsafe_unretained = 0x800,
-  CXObjCPropertyAttr_class = 0x1000
+  CXObjCPropertyAttr_classattr = 0x1000
 } CXObjCPropertyAttrKind;

plotfi wrote:
> @erik.pilkington  Do you think we should be adding the C-API analogs of 
> nullability / null_resettable (and direct) to clang/include/clang-c/Index.h? 
> 
> I noticed those are missing.
> 
> 
Oh, sorry, I missed this. The C API is supposed to be stable, so I don't think 
we should change the name of this enumerator (@arphaman can you confirm?). 
Adding the missing attributes seem fine though. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-13 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi marked an inline comment as done.
plotfi added inline comments.



Comment at: clang/include/clang-c/Index.h:4503
   CXObjCPropertyAttr_unsafe_unretained = 0x800,
-  CXObjCPropertyAttr_class = 0x1000
+  CXObjCPropertyAttr_classattr = 0x1000
 } CXObjCPropertyAttrKind;

erik.pilkington wrote:
> plotfi wrote:
> > @erik.pilkington  Do you think we should be adding the C-API analogs of 
> > nullability / null_resettable (and direct) to 
> > clang/include/clang-c/Index.h? 
> > 
> > I noticed those are missing.
> > 
> > 
> Oh, sorry, I missed this. The C API is supposed to be stable, so I don't 
> think we should change the name of this enumerator (@arphaman can you 
> confirm?). Adding the missing attributes seem fine though. 
@erik.pilkington  @arphaman Any chance I can land the C API changes in a follow 
up commit? That's what I was thinking. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-13 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi updated this revision to Diff 257207.
plotfi added a comment.

adding fixes for class -> classattr change for tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233

Files:
  clang/include/clang-c/Index.h
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclObjCCommon.h
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/ARCMigrate/TransGCAttrs.cpp
  clang/lib/ARCMigrate/TransProperties.cpp
  clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Frontend/Rewrite/RewriteObjC.cpp
  clang/lib/Parse/ParseObjc.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaPseudoObject.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/test/Index/c-index-api-loadTU-test.m
  clang/test/Index/index-decls.m
  clang/test/Index/print-type.m
  clang/tools/c-index-test/c-index-test.c
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/BinaryFormat/Dwarf.def
  llvm/include/llvm/BinaryFormat/Dwarf.h

Index: llvm/include/llvm/BinaryFormat/Dwarf.h
===
--- llvm/include/llvm/BinaryFormat/Dwarf.h
+++ llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -357,7 +357,7 @@
 };
 
 /// Constants for the DW_APPLE_PROPERTY_attributes attribute.
-/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttribute::Kind!
 enum ApplePropertyAttributes {
 #define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID,
 #include "llvm/BinaryFormat/Dwarf.def"
Index: llvm/include/llvm/BinaryFormat/Dwarf.def
===
--- llvm/include/llvm/BinaryFormat/Dwarf.def
+++ llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -897,7 +897,7 @@
 HANDLE_DW_CFA_PRED(0x2e, GNU_args_size, SELECT_X86)
 
 // Apple Objective-C Property Attributes.
-// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttribute::Kind!
 HANDLE_DW_APPLE_PROPERTY(0x01, readonly)
 HANDLE_DW_APPLE_PROPERTY(0x02, getter)
 HANDLE_DW_APPLE_PROPERTY(0x04, assign)
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -22,6 +22,7 @@
 #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"
@@ -8143,11 +8144,10 @@
 
   unsigned Result = CXObjCPropertyAttr_noattr;
   const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C));
-  ObjCPropertyDecl::PropertyAttributeKind Attr =
-  PD->getPropertyAttributesAsWritten();
+  ObjCPropertyAttribute::Kind Attr = PD->getPropertyAttributesAsWritten();
 
 #define SET_CXOBJCPROP_ATTR(A) \
-  if (Attr & ObjCPropertyDecl::OBJC_PR_##A)\
+  if (Attr & ObjCPropertyAttribute::Kind::A)   \
   Result |= CXObjCPropertyAttr_##A
   SET_CXOBJCPROP_ATTR(readonly);
   SET_CXOBJCPROP_ATTR(getter);
@@ -8161,7 +8161,7 @@
   SET_CXOBJCPROP_ATTR(weak);
   SET_CXOBJCPROP_ATTR(strong);
   SET_CXOBJCPROP_ATTR(unsafe_unretained);
-  SET_CXOBJCPROP_ATTR(class);
+  SET_CXOBJCPROP_ATTR(classattr);
 #undef SET_CXOBJCPROP_ATTR
 
   return Result;
Index: clang/tools/c-index-test/c-index-test.c
===
--- clang/tools/c-index-test/c-index-test.c
+++ clang/tools/c-index-test/c-index-test.c
@@ -1104,7 +1104,7 @@
 PRINT_PROP_ATTR(weak);
 PRINT_PROP_ATTR(strong);
 PRINT_PROP_ATTR(unsafe_unretained);
-PRINT_PROP_ATTR(class);
+PRINT_PROP_ATTR(classattr);
 printf("]");
   }
 }
Index: clang/test/Index/print-type.m
===
--- clang/test/Index/print-type.m
+++ clang/test/Index/print-type.m
@@ -20,5 +20,5 @@
 // CHECK: ParmDecl=i:5:27 (Definition) [In,] [type=int] [typekind=Int] [isPOD=1]
 // CHECK: ParmDecl=j:5:49 (Definition) [Out,] [type=short *] [typekind=Pointer] [isPOD=1] [pointeetype=short] [pointeekind=Short]
 // CHECK: ParmDecl=p:6:36 (Definition) [type=__kindof Foo *] [typekind=ObjCObjectPointer] [canonicaltype=__kindof Foo *] [canonicaltypekind=ObjCObjectPointer] [basetype=Foo] 

[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-14 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added inline comments.



Comment at: clang/include/clang-c/Index.h:4503
   CXObjCPropertyAttr_unsafe_unretained = 0x800,
-  CXObjCPropertyAttr_class = 0x1000
+  CXObjCPropertyAttr_classattr = 0x1000
 } CXObjCPropertyAttrKind;

plotfi wrote:
> erik.pilkington wrote:
> > plotfi wrote:
> > > @erik.pilkington  Do you think we should be adding the C-API analogs of 
> > > nullability / null_resettable (and direct) to 
> > > clang/include/clang-c/Index.h? 
> > > 
> > > I noticed those are missing.
> > > 
> > > 
> > Oh, sorry, I missed this. The C API is supposed to be stable, so I don't 
> > think we should change the name of this enumerator (@arphaman can you 
> > confirm?). Adding the missing attributes seem fine though. 
> @erik.pilkington  @arphaman Any chance I can land the C API changes in a 
> follow up commit? That's what I was thinking. 
I think this enumerator should stay named `CXObjCPropertyAttr_class`, changing 
the name to `CXObjCPropertyAttr_classattr` is API breaking, and the C API 
should be stable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-14 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi marked an inline comment as done.
plotfi added inline comments.



Comment at: clang/include/clang-c/Index.h:4503
   CXObjCPropertyAttr_unsafe_unretained = 0x800,
-  CXObjCPropertyAttr_class = 0x1000
+  CXObjCPropertyAttr_classattr = 0x1000
 } CXObjCPropertyAttrKind;

erik.pilkington wrote:
> plotfi wrote:
> > erik.pilkington wrote:
> > > plotfi wrote:
> > > > @erik.pilkington  Do you think we should be adding the C-API analogs of 
> > > > nullability / null_resettable (and direct) to 
> > > > clang/include/clang-c/Index.h? 
> > > > 
> > > > I noticed those are missing.
> > > > 
> > > > 
> > > Oh, sorry, I missed this. The C API is supposed to be stable, so I don't 
> > > think we should change the name of this enumerator (@arphaman can you 
> > > confirm?). Adding the missing attributes seem fine though. 
> > @erik.pilkington  @arphaman Any chance I can land the C API changes in a 
> > follow up commit? That's what I was thinking. 
> I think this enumerator should stay named `CXObjCPropertyAttr_class`, 
> changing the name to `CXObjCPropertyAttr_classattr` is API breaking, and the 
> C API should be stable.
Ah yeah! Good catch. Makes total sense. What do you think about dropping the C 
macro usage in clang/tools/c-index-test/c-index-test.c (ie PRINT_PROP_ATTR)? I 
can't drop the prefix in the c++ enum completely without changing class to 
classattr since it is a keyword. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-14 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi updated this revision to Diff 257431.
plotfi added a comment.

Removing unintended change to Clang C API


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233

Files:
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclObjCCommon.h
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/ARCMigrate/TransGCAttrs.cpp
  clang/lib/ARCMigrate/TransProperties.cpp
  clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Frontend/Rewrite/RewriteObjC.cpp
  clang/lib/Parse/ParseObjc.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaPseudoObject.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/BinaryFormat/Dwarf.def
  llvm/include/llvm/BinaryFormat/Dwarf.h

Index: llvm/include/llvm/BinaryFormat/Dwarf.h
===
--- llvm/include/llvm/BinaryFormat/Dwarf.h
+++ llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -357,7 +357,7 @@
 };
 
 /// Constants for the DW_APPLE_PROPERTY_attributes attribute.
-/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttribute::Kind!
 enum ApplePropertyAttributes {
 #define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID,
 #include "llvm/BinaryFormat/Dwarf.def"
Index: llvm/include/llvm/BinaryFormat/Dwarf.def
===
--- llvm/include/llvm/BinaryFormat/Dwarf.def
+++ llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -897,7 +897,7 @@
 HANDLE_DW_CFA_PRED(0x2e, GNU_args_size, SELECT_X86)
 
 // Apple Objective-C Property Attributes.
-// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttribute::Kind!
 HANDLE_DW_APPLE_PROPERTY(0x01, readonly)
 HANDLE_DW_APPLE_PROPERTY(0x02, getter)
 HANDLE_DW_APPLE_PROPERTY(0x04, assign)
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -22,6 +22,7 @@
 #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"
@@ -8143,25 +8144,24 @@
 
   unsigned Result = CXObjCPropertyAttr_noattr;
   const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C));
-  ObjCPropertyDecl::PropertyAttributeKind Attr =
-  PD->getPropertyAttributesAsWritten();
-
-#define SET_CXOBJCPROP_ATTR(A) \
-  if (Attr & ObjCPropertyDecl::OBJC_PR_##A)\
-  Result |= CXObjCPropertyAttr_##A
-  SET_CXOBJCPROP_ATTR(readonly);
-  SET_CXOBJCPROP_ATTR(getter);
-  SET_CXOBJCPROP_ATTR(assign);
-  SET_CXOBJCPROP_ATTR(readwrite);
-  SET_CXOBJCPROP_ATTR(retain);
-  SET_CXOBJCPROP_ATTR(copy);
-  SET_CXOBJCPROP_ATTR(nonatomic);
-  SET_CXOBJCPROP_ATTR(setter);
-  SET_CXOBJCPROP_ATTR(atomic);
-  SET_CXOBJCPROP_ATTR(weak);
-  SET_CXOBJCPROP_ATTR(strong);
-  SET_CXOBJCPROP_ATTR(unsafe_unretained);
-  SET_CXOBJCPROP_ATTR(class);
+  ObjCPropertyAttribute::Kind Attr = PD->getPropertyAttributesAsWritten();
+
+#define SET_CXOBJCPROP_ATTR(A, B)  \
+  if (Attr & ObjCPropertyAttribute::Kind::A)   \
+  Result |= CXObjCPropertyAttr_##B
+  SET_CXOBJCPROP_ATTR(readonly, readonly);
+  SET_CXOBJCPROP_ATTR(getter, getter);
+  SET_CXOBJCPROP_ATTR(assign, assign);
+  SET_CXOBJCPROP_ATTR(readwrite, readwrite);
+  SET_CXOBJCPROP_ATTR(retain, retain);
+  SET_CXOBJCPROP_ATTR(copy, copy);
+  SET_CXOBJCPROP_ATTR(nonatomic, nonatomic);
+  SET_CXOBJCPROP_ATTR(setter, setter);
+  SET_CXOBJCPROP_ATTR(atomic, atomic);
+  SET_CXOBJCPROP_ATTR(weak, weak);
+  SET_CXOBJCPROP_ATTR(strong, strong);
+  SET_CXOBJCPROP_ATTR(unsafe_unretained, unsafe_unretained);
+  SET_CXOBJCPROP_ATTR(classattr, class);
 #undef SET_CXOBJCPROP_ATTR
 
   return Result;
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1279,10 +1279,9 @@
   QualType T = Record.readType();
   TypeSourceInfo *TSI = readTypeSourceInfo();
   D->setType(T, TSI);
-  D->setPropertyAttributes(
-  (O

[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-14 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi marked an inline comment as done.
plotfi added inline comments.



Comment at: llvm/include/llvm/BinaryFormat/Dwarf.def:915
 HANDLE_DW_APPLE_PROPERTY(0x2000, null_resettable)
 HANDLE_DW_APPLE_PROPERTY(0x4000, class)
 

I have some concerns here too. How would this affect the Dwarf apple property? 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-14 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi updated this revision to Diff 257550.
plotfi added a comment.

Adding a kind_ prefix to avoid any keywords being used in the 
ObjCPropertyAttribute enum.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233

Files:
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclObjCCommon.h
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/ARCMigrate/TransGCAttrs.cpp
  clang/lib/ARCMigrate/TransProperties.cpp
  clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Frontend/Rewrite/RewriteObjC.cpp
  clang/lib/Parse/ParseObjc.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaPseudoObject.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/BinaryFormat/Dwarf.def
  llvm/include/llvm/BinaryFormat/Dwarf.h

Index: llvm/include/llvm/BinaryFormat/Dwarf.h
===
--- llvm/include/llvm/BinaryFormat/Dwarf.h
+++ llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -357,7 +357,7 @@
 };
 
 /// Constants for the DW_APPLE_PROPERTY_attributes attribute.
-/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttribute::Kind!
 enum ApplePropertyAttributes {
 #define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID,
 #include "llvm/BinaryFormat/Dwarf.def"
Index: llvm/include/llvm/BinaryFormat/Dwarf.def
===
--- llvm/include/llvm/BinaryFormat/Dwarf.def
+++ llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -897,7 +897,7 @@
 HANDLE_DW_CFA_PRED(0x2e, GNU_args_size, SELECT_X86)
 
 // Apple Objective-C Property Attributes.
-// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttribute::Kind!
 HANDLE_DW_APPLE_PROPERTY(0x01, readonly)
 HANDLE_DW_APPLE_PROPERTY(0x02, getter)
 HANDLE_DW_APPLE_PROPERTY(0x04, assign)
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -22,6 +22,7 @@
 #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"
@@ -8143,11 +8144,11 @@
 
   unsigned Result = CXObjCPropertyAttr_noattr;
   const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C));
-  ObjCPropertyDecl::PropertyAttributeKind Attr =
+  ObjCPropertyAttribute::Kind Attr =
   PD->getPropertyAttributesAsWritten();
 
 #define SET_CXOBJCPROP_ATTR(A) \
-  if (Attr & ObjCPropertyDecl::OBJC_PR_##A)\
+  if (Attr & ObjCPropertyAttribute::kind_##A)  \
   Result |= CXObjCPropertyAttr_##A
   SET_CXOBJCPROP_ATTR(readonly);
   SET_CXOBJCPROP_ATTR(getter);
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1279,10 +1279,9 @@
   QualType T = Record.readType();
   TypeSourceInfo *TSI = readTypeSourceInfo();
   D->setType(T, TSI);
-  D->setPropertyAttributes(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  D->setPropertyAttributes((ObjCPropertyAttribute::Kind)Record.readInt());
   D->setPropertyAttributesAsWritten(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  (ObjCPropertyAttribute::Kind)Record.readInt());
   D->setPropertyImplementation(
   (ObjCPropertyDecl::PropertyControl)Record.readInt());
   DeclarationName GetterName = Record.readDeclarationName();
Index: clang/lib/Sema/SemaPseudoObject.cpp
===
--- clang/lib/Sema/SemaPseudoObject.cpp
+++ clang/lib/Sema/SemaPseudoObject.cpp
@@ -585,7 +585,7 @@
   QualType T;
   if (RefExpr->isExplicitProperty()) {
 const ObjCPropertyDecl *Prop = RefExpr->getExplicitProperty();
-if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak)
+if (Prop->getPropertyAttributes() & ObjCPropertyAttribute::kind_weak)
   return true;
 
 T = Prop->getType();
Index: clang/lib/Sema/SemaObjCProperty.cpp
==

[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-14 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi updated this revision to Diff 257577.
plotfi added a comment.

Update for clang-format changes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233

Files:
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclObjCCommon.h
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/ARCMigrate/TransGCAttrs.cpp
  clang/lib/ARCMigrate/TransProperties.cpp
  clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Frontend/Rewrite/RewriteObjC.cpp
  clang/lib/Parse/ParseObjc.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaPseudoObject.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/BinaryFormat/Dwarf.def
  llvm/include/llvm/BinaryFormat/Dwarf.h

Index: llvm/include/llvm/BinaryFormat/Dwarf.h
===
--- llvm/include/llvm/BinaryFormat/Dwarf.h
+++ llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -357,7 +357,8 @@
 };
 
 /// Constants for the DW_APPLE_PROPERTY_attributes attribute.
-/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+/// Keep this list in sync with clang's DeclObjCCommon.h
+/// ObjCPropertyAttribute::Kind!
 enum ApplePropertyAttributes {
 #define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID,
 #include "llvm/BinaryFormat/Dwarf.def"
Index: llvm/include/llvm/BinaryFormat/Dwarf.def
===
--- llvm/include/llvm/BinaryFormat/Dwarf.def
+++ llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -897,7 +897,8 @@
 HANDLE_DW_CFA_PRED(0x2e, GNU_args_size, SELECT_X86)
 
 // Apple Objective-C Property Attributes.
-// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+// Keep this list in sync with clang's DeclObjCCommon.h
+// ObjCPropertyAttribute::Kind!
 HANDLE_DW_APPLE_PROPERTY(0x01, readonly)
 HANDLE_DW_APPLE_PROPERTY(0x02, getter)
 HANDLE_DW_APPLE_PROPERTY(0x04, assign)
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -22,6 +22,7 @@
 #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"
@@ -8143,11 +8144,10 @@
 
   unsigned Result = CXObjCPropertyAttr_noattr;
   const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C));
-  ObjCPropertyDecl::PropertyAttributeKind Attr =
-  PD->getPropertyAttributesAsWritten();
+  ObjCPropertyAttribute::Kind Attr = PD->getPropertyAttributesAsWritten();
 
 #define SET_CXOBJCPROP_ATTR(A) \
-  if (Attr & ObjCPropertyDecl::OBJC_PR_##A)\
+  if (Attr & ObjCPropertyAttribute::kind_##A)  \
   Result |= CXObjCPropertyAttr_##A
   SET_CXOBJCPROP_ATTR(readonly);
   SET_CXOBJCPROP_ATTR(getter);
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1279,10 +1279,9 @@
   QualType T = Record.readType();
   TypeSourceInfo *TSI = readTypeSourceInfo();
   D->setType(T, TSI);
-  D->setPropertyAttributes(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  D->setPropertyAttributes((ObjCPropertyAttribute::Kind)Record.readInt());
   D->setPropertyAttributesAsWritten(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  (ObjCPropertyAttribute::Kind)Record.readInt());
   D->setPropertyImplementation(
   (ObjCPropertyDecl::PropertyControl)Record.readInt());
   DeclarationName GetterName = Record.readDeclarationName();
Index: clang/lib/Sema/SemaPseudoObject.cpp
===
--- clang/lib/Sema/SemaPseudoObject.cpp
+++ clang/lib/Sema/SemaPseudoObject.cpp
@@ -585,7 +585,7 @@
   QualType T;
   if (RefExpr->isExplicitProperty()) {
 const ObjCPropertyDecl *Prop = RefExpr->getExplicitProperty();
-if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak)
+if (Prop->getPropertyAttributes() & ObjCPropertyAttribute::kind_weak)
   return true;
 
 T = Prop->getType();
Index: clang/lib/Sema/SemaObjCProperty.cpp
=

[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-15 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

Ping


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-17 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

In D77233#1977671 , @erik.pilkington 
wrote:

> LGTM (after fixing those tests). Thanks for cleaning this up!


Can this be a LGTM again  @erik.pilkington @arphaman? I have managed to undo 
any unintended C API changes. Tests appear to all pass too. I had to add a 
short prefix to the enum values to avoid hitting any C++ keywords (ie class). 
Is there anything else needed for this refactor to go in?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-21 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

@erik.pilkington @arphaman ping.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-22 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington accepted this revision.
erik.pilkington added a comment.
This revision is now accepted and ready to land.

LGTM, again :) Thanks for cleaning this up.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-22 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

In D77233#1997294 , @erik.pilkington 
wrote:

> LGTM, again :) Thanks for cleaning this up.


Thank you Erik!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-22 Thread Puyan Lotfi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2aa044ed088a: [NFC] Refactoring PropertyAttributeKind for 
ObjCPropertyDecl and ObjCDeclSpec. (authored by plotfi).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233

Files:
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclObjCCommon.h
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/ARCMigrate/TransGCAttrs.cpp
  clang/lib/ARCMigrate/TransProperties.cpp
  clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Frontend/Rewrite/RewriteObjC.cpp
  clang/lib/Parse/ParseObjc.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaPseudoObject.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/BinaryFormat/Dwarf.def
  llvm/include/llvm/BinaryFormat/Dwarf.h

Index: llvm/include/llvm/BinaryFormat/Dwarf.h
===
--- llvm/include/llvm/BinaryFormat/Dwarf.h
+++ llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -357,7 +357,8 @@
 };
 
 /// Constants for the DW_APPLE_PROPERTY_attributes attribute.
-/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+/// Keep this list in sync with clang's DeclObjCCommon.h
+/// ObjCPropertyAttribute::Kind!
 enum ApplePropertyAttributes {
 #define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID,
 #include "llvm/BinaryFormat/Dwarf.def"
Index: llvm/include/llvm/BinaryFormat/Dwarf.def
===
--- llvm/include/llvm/BinaryFormat/Dwarf.def
+++ llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -898,7 +898,8 @@
 HANDLE_DW_CFA_PRED(0x2e, GNU_args_size, SELECT_X86)
 
 // Apple Objective-C Property Attributes.
-// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+// Keep this list in sync with clang's DeclObjCCommon.h
+// ObjCPropertyAttribute::Kind!
 HANDLE_DW_APPLE_PROPERTY(0x01, readonly)
 HANDLE_DW_APPLE_PROPERTY(0x02, getter)
 HANDLE_DW_APPLE_PROPERTY(0x04, assign)
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -22,6 +22,7 @@
 #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"
@@ -8146,11 +8147,10 @@
 
   unsigned Result = CXObjCPropertyAttr_noattr;
   const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C));
-  ObjCPropertyDecl::PropertyAttributeKind Attr =
-  PD->getPropertyAttributesAsWritten();
+  ObjCPropertyAttribute::Kind Attr = PD->getPropertyAttributesAsWritten();
 
 #define SET_CXOBJCPROP_ATTR(A) \
-  if (Attr & ObjCPropertyDecl::OBJC_PR_##A)\
+  if (Attr & ObjCPropertyAttribute::kind_##A)  \
   Result |= CXObjCPropertyAttr_##A
   SET_CXOBJCPROP_ATTR(readonly);
   SET_CXOBJCPROP_ATTR(getter);
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1280,10 +1280,9 @@
   QualType T = Record.readType();
   TypeSourceInfo *TSI = readTypeSourceInfo();
   D->setType(T, TSI);
-  D->setPropertyAttributes(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  D->setPropertyAttributes((ObjCPropertyAttribute::Kind)Record.readInt());
   D->setPropertyAttributesAsWritten(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  (ObjCPropertyAttribute::Kind)Record.readInt());
   D->setPropertyImplementation(
   (ObjCPropertyDecl::PropertyControl)Record.readInt());
   DeclarationName GetterName = Record.readDeclarationName();
Index: clang/lib/Sema/SemaPseudoObject.cpp
===
--- clang/lib/Sema/SemaPseudoObject.cpp
+++ clang/lib/Sema/SemaPseudoObject.cpp
@@ -580,7 +580,7 @@
   QualType T;
   if (RefExpr->isExplicitProperty()) {
 const ObjCPropertyDecl *Prop = RefExpr->getExplicitProperty();
-if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak)
+if (Prop->getPropertyAttributes() & ObjCPropertyAttribute::kind_weak)
   return true;
 
 T = Prop

[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-01 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi created this revision.
plotfi added reviewers: compnerd, manmanren.
Herald added subscribers: cfe-commits, arphaman.
Herald added a project: clang.
plotfi edited the summary of this revision.
plotfi updated this revision to Diff 254259.
plotfi added a comment.
Herald added a subscriber: jfb.
plotfi added a reviewer: jfb.
Herald added a subscriber: dexonsmith.

 Clipboard gave me junk the first submit. Sorry


I noticed PropertyAttributeKind / ObjCPropertyAttributeKind enums in 
ObjCPropertyDecl and ObjCDeclSpec are exactly identical. This is a 
non-functional change to make these two enums less redundant.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77233

Files:
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclObjCCommon.h
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/ARCMigrate/TransGCAttrs.cpp
  clang/lib/ARCMigrate/TransProperties.cpp
  clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Frontend/Rewrite/RewriteObjC.cpp
  clang/lib/Parse/ParseObjc.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaPseudoObject.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/tools/libclang/CIndex.cpp

Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -8141,11 +8141,10 @@
 
   unsigned Result = CXObjCPropertyAttr_noattr;
   const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C));
-  ObjCPropertyDecl::PropertyAttributeKind Attr =
-  PD->getPropertyAttributesAsWritten();
+  ObjCPropertyAttributeKind Attr = PD->getPropertyAttributesAsWritten();
 
 #define SET_CXOBJCPROP_ATTR(A) \
-  if (Attr & ObjCPropertyDecl::OBJC_PR_##A)\
+  if (Attr & ObjCPropertyAttributeKind::OBJC_PR_##A)   \
   Result |= CXObjCPropertyAttr_##A
   SET_CXOBJCPROP_ATTR(readonly);
   SET_CXOBJCPROP_ATTR(getter);
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1280,9 +1280,9 @@
   TypeSourceInfo *TSI = readTypeSourceInfo();
   D->setType(T, TSI);
   D->setPropertyAttributes(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  (ObjCPropertyAttributeKind)Record.readInt());
   D->setPropertyAttributesAsWritten(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  (ObjCPropertyAttributeKind)Record.readInt());
   D->setPropertyImplementation(
   (ObjCPropertyDecl::PropertyControl)Record.readInt());
   DeclarationName GetterName = Record.readDeclarationName();
Index: clang/lib/Sema/SemaPseudoObject.cpp
===
--- clang/lib/Sema/SemaPseudoObject.cpp
+++ clang/lib/Sema/SemaPseudoObject.cpp
@@ -585,7 +585,7 @@
   QualType T;
   if (RefExpr->isExplicitProperty()) {
 const ObjCPropertyDecl *Prop = RefExpr->getExplicitProperty();
-if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak)
+if (Prop->getPropertyAttributes() & ObjCPropertyAttributeKind::OBJC_PR_weak)
   return true;
 
 T = Prop->getType();
Index: clang/lib/Sema/SemaObjCProperty.cpp
===
--- clang/lib/Sema/SemaObjCProperty.cpp
+++ clang/lib/Sema/SemaObjCProperty.cpp
@@ -35,24 +35,23 @@
 ///
 /// Returns OCL_None if the attributes as stated do not imply an ownership.
 /// Never returns OCL_Autoreleasing.
-static Qualifiers::ObjCLifetime getImpliedARCOwnership(
-   ObjCPropertyDecl::PropertyAttributeKind attrs,
-QualType type) {
+static Qualifiers::ObjCLifetime
+getImpliedARCOwnership(ObjCPropertyAttributeKind attrs, QualType type) {
   // retain, strong, copy, weak, and unsafe_unretained are only legal
   // on properties of retainable pointer type.
-  if (attrs & (ObjCPropertyDecl::OBJC_PR_retain |
-   ObjCPropertyDecl::OBJC_PR_strong |
-   ObjCPropertyDecl::OBJC_PR_copy)) {
+  if (attrs & (ObjCPropertyAttributeKind::OBJC_PR_retain |
+   ObjCPropertyAttributeKind::OBJC_PR_strong |
+   ObjCPropertyAttributeKind::OBJC_PR_copy)) {
 return Qualifiers::OCL_Strong;
-  } else if (attrs & ObjCPropertyDecl::OBJC_PR_weak) {
+  } else if (attrs & ObjCPropertyAttributeKind::OBJC_PR_weak) {
 retur

[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-01 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi updated this revision to Diff 254259.
plotfi added a comment.
Herald added a subscriber: jfb.

 Clipboard gave me junk the first submit. Sorry


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233

Files:
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclObjCCommon.h
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/ARCMigrate/TransGCAttrs.cpp
  clang/lib/ARCMigrate/TransProperties.cpp
  clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Frontend/Rewrite/RewriteObjC.cpp
  clang/lib/Parse/ParseObjc.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaPseudoObject.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/tools/libclang/CIndex.cpp

Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -8141,11 +8141,10 @@
 
   unsigned Result = CXObjCPropertyAttr_noattr;
   const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C));
-  ObjCPropertyDecl::PropertyAttributeKind Attr =
-  PD->getPropertyAttributesAsWritten();
+  ObjCPropertyAttributeKind Attr = PD->getPropertyAttributesAsWritten();
 
 #define SET_CXOBJCPROP_ATTR(A) \
-  if (Attr & ObjCPropertyDecl::OBJC_PR_##A)\
+  if (Attr & ObjCPropertyAttributeKind::OBJC_PR_##A)   \
   Result |= CXObjCPropertyAttr_##A
   SET_CXOBJCPROP_ATTR(readonly);
   SET_CXOBJCPROP_ATTR(getter);
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1280,9 +1280,9 @@
   TypeSourceInfo *TSI = readTypeSourceInfo();
   D->setType(T, TSI);
   D->setPropertyAttributes(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  (ObjCPropertyAttributeKind)Record.readInt());
   D->setPropertyAttributesAsWritten(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  (ObjCPropertyAttributeKind)Record.readInt());
   D->setPropertyImplementation(
   (ObjCPropertyDecl::PropertyControl)Record.readInt());
   DeclarationName GetterName = Record.readDeclarationName();
Index: clang/lib/Sema/SemaPseudoObject.cpp
===
--- clang/lib/Sema/SemaPseudoObject.cpp
+++ clang/lib/Sema/SemaPseudoObject.cpp
@@ -585,7 +585,7 @@
   QualType T;
   if (RefExpr->isExplicitProperty()) {
 const ObjCPropertyDecl *Prop = RefExpr->getExplicitProperty();
-if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak)
+if (Prop->getPropertyAttributes() & ObjCPropertyAttributeKind::OBJC_PR_weak)
   return true;
 
 T = Prop->getType();
Index: clang/lib/Sema/SemaObjCProperty.cpp
===
--- clang/lib/Sema/SemaObjCProperty.cpp
+++ clang/lib/Sema/SemaObjCProperty.cpp
@@ -35,24 +35,23 @@
 ///
 /// Returns OCL_None if the attributes as stated do not imply an ownership.
 /// Never returns OCL_Autoreleasing.
-static Qualifiers::ObjCLifetime getImpliedARCOwnership(
-   ObjCPropertyDecl::PropertyAttributeKind attrs,
-QualType type) {
+static Qualifiers::ObjCLifetime
+getImpliedARCOwnership(ObjCPropertyAttributeKind attrs, QualType type) {
   // retain, strong, copy, weak, and unsafe_unretained are only legal
   // on properties of retainable pointer type.
-  if (attrs & (ObjCPropertyDecl::OBJC_PR_retain |
-   ObjCPropertyDecl::OBJC_PR_strong |
-   ObjCPropertyDecl::OBJC_PR_copy)) {
+  if (attrs & (ObjCPropertyAttributeKind::OBJC_PR_retain |
+   ObjCPropertyAttributeKind::OBJC_PR_strong |
+   ObjCPropertyAttributeKind::OBJC_PR_copy)) {
 return Qualifiers::OCL_Strong;
-  } else if (attrs & ObjCPropertyDecl::OBJC_PR_weak) {
+  } else if (attrs & ObjCPropertyAttributeKind::OBJC_PR_weak) {
 return Qualifiers::OCL_Weak;
-  } else if (attrs & ObjCPropertyDecl::OBJC_PR_unsafe_unretained) {
+  } else if (attrs & ObjCPropertyAttributeKind::OBJC_PR_unsafe_unretained) {
 return Qualifiers::OCL_ExplicitNone;
   }
 
   // assign can appear on other types, so we have to check the
   // property type.
-  if (attrs & ObjCPropertyDecl::OBJC_PR_assign &&
+  if (attrs & ObjCPropertyAttributeKind::OBJC_P

[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-01 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi updated this revision to Diff 254297.
plotfi added a comment.

Applying clang-format suggestions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233

Files:
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclObjCCommon.h
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/ARCMigrate/TransGCAttrs.cpp
  clang/lib/ARCMigrate/TransProperties.cpp
  clang/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Frontend/Rewrite/RewriteObjC.cpp
  clang/lib/Parse/ParseObjc.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaPseudoObject.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/tools/libclang/CIndex.cpp

Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -22,6 +22,7 @@
 #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"
@@ -8141,11 +8142,10 @@
 
   unsigned Result = CXObjCPropertyAttr_noattr;
   const ObjCPropertyDecl *PD = dyn_cast(getCursorDecl(C));
-  ObjCPropertyDecl::PropertyAttributeKind Attr =
-  PD->getPropertyAttributesAsWritten();
+  ObjCPropertyAttributeKind Attr = PD->getPropertyAttributesAsWritten();
 
 #define SET_CXOBJCPROP_ATTR(A) \
-  if (Attr & ObjCPropertyDecl::OBJC_PR_##A)\
+  if (Attr & ObjCPropertyAttributeKind::OBJC_PR_##A)   \
   Result |= CXObjCPropertyAttr_##A
   SET_CXOBJCPROP_ATTR(readonly);
   SET_CXOBJCPROP_ATTR(getter);
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1279,10 +1279,9 @@
   QualType T = Record.readType();
   TypeSourceInfo *TSI = readTypeSourceInfo();
   D->setType(T, TSI);
-  D->setPropertyAttributes(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  D->setPropertyAttributes((ObjCPropertyAttributeKind)Record.readInt());
   D->setPropertyAttributesAsWritten(
-  (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
+  (ObjCPropertyAttributeKind)Record.readInt());
   D->setPropertyImplementation(
   (ObjCPropertyDecl::PropertyControl)Record.readInt());
   DeclarationName GetterName = Record.readDeclarationName();
Index: clang/lib/Sema/SemaPseudoObject.cpp
===
--- clang/lib/Sema/SemaPseudoObject.cpp
+++ clang/lib/Sema/SemaPseudoObject.cpp
@@ -585,7 +585,7 @@
   QualType T;
   if (RefExpr->isExplicitProperty()) {
 const ObjCPropertyDecl *Prop = RefExpr->getExplicitProperty();
-if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak)
+if (Prop->getPropertyAttributes() & ObjCPropertyAttributeKind::OBJC_PR_weak)
   return true;
 
 T = Prop->getType();
Index: clang/lib/Sema/SemaObjCProperty.cpp
===
--- clang/lib/Sema/SemaObjCProperty.cpp
+++ clang/lib/Sema/SemaObjCProperty.cpp
@@ -35,24 +35,23 @@
 ///
 /// Returns OCL_None if the attributes as stated do not imply an ownership.
 /// Never returns OCL_Autoreleasing.
-static Qualifiers::ObjCLifetime getImpliedARCOwnership(
-   ObjCPropertyDecl::PropertyAttributeKind attrs,
-QualType type) {
+static Qualifiers::ObjCLifetime
+getImpliedARCOwnership(ObjCPropertyAttributeKind attrs, QualType type) {
   // retain, strong, copy, weak, and unsafe_unretained are only legal
   // on properties of retainable pointer type.
-  if (attrs & (ObjCPropertyDecl::OBJC_PR_retain |
-   ObjCPropertyDecl::OBJC_PR_strong |
-   ObjCPropertyDecl::OBJC_PR_copy)) {
+  if (attrs & (ObjCPropertyAttributeKind::OBJC_PR_retain |
+   ObjCPropertyAttributeKind::OBJC_PR_strong |
+   ObjCPropertyAttributeKind::OBJC_PR_copy)) {
 return Qualifiers::OCL_Strong;
-  } else if (attrs & ObjCPropertyDecl::OBJC_PR_weak) {
+  } else if (attrs & ObjCPropertyAttributeKind::OBJC_PR_weak) {
 return Qualifiers::OCL_Weak;
-  } else if (attrs & ObjCPropertyDecl::OBJC_PR_unsafe_unretained) {
+  } else if (attrs & ObjCPropertyAttribut

[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-01 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added inline comments.



Comment at: clang/include/clang/AST/DeclObjCCommon.h:21
+/// Keep this list in sync with LLVM's Dwarf.h ApplePropertyAttributes.
+enum ObjCPropertyAttributeKind {
+  OBJC_PR_noattr = 0x00,

It seems that you are touching all the sites that use this, so perhaps this is 
the time to change this to `enum class` and drop the `OBJC_PR_` prefixes and 
explicitly inherit from `uint16_t`.  This should be named 
`ObjCPropertyAttribute` I think.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-01 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi marked an inline comment as done.
plotfi added inline comments.



Comment at: clang/include/clang/AST/DeclObjCCommon.h:21
+/// Keep this list in sync with LLVM's Dwarf.h ApplePropertyAttributes.
+enum ObjCPropertyAttributeKind {
+  OBJC_PR_noattr = 0x00,

compnerd wrote:
> It seems that you are touching all the sites that use this, so perhaps this 
> is the time to change this to `enum class` and drop the `OBJC_PR_` prefixes 
> and explicitly inherit from `uint16_t`.  This should be named 
> `ObjCPropertyAttribute` I think.
Ah yeah, that sounds pretty good. Will do. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77233/new/

https://reviews.llvm.org/D77233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits