[cfe-dev] What does clang::ObjCPropertyDecl::getPropertyAttributes() really gets?
jahanian
fjahanian at apple.com
Tue Jan 6 16:52:44 PST 2015
> On Jan 5, 2015, at 11:16 PM, Joseph Pan <cs.wzpan at gmail.com> wrote:
>
> Hi all,
>
> I'm trying to extract all attributes from an ObjCPropertyDecl such as:
>
> ```
> @property (strong, nonatomic) NSMutableDictionary* fieldsToBePosted;
> ```
>
> So I refered to the clang docs and found the function `clang::ObjCPropertyDecl::getPropertyAttributes()`, which looks like what I need. Then I wrote a piece of code like this:
>
> ```
> clang::ObjCPropertyDecl::PropertyAttributeKind kind = decl->getPropertyAttributes();
> cout << kind << endl;
> ```
>
> What surprised me is that I got 64 (0x40), which is OBJC_PR_nonatomic. What I expected is OBJC_PR_nonatomic | OBJC_PR_strong a.k.a. 1088(0x440).
>
> Also, as I tried to dump the decl, it looks like this:
>
> ```
> ObjCPropertyDecl 0x7fc9ac66c640 </Users/wzpan/Documents/workspace/HelloWorld/HelloWorldViewController.m:14:1, col:52> col:52 fieldsToBePosted 'NSMutableDictionary *' nonatomic
> ```
>
> Where has the `strong` attributes gone? Can anyone please tell me how to get all the attributes? Thanks.
Try: getPropertyAttributesAsWritten
- Fariborz
>
> --
> Yours respectfully,
> 潘伟洲(Weizhou Pan)
> hahack.com <http://hahack.com/>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150106/ae8a9068/attachment.html>
More information about the cfe-dev
mailing list