[cfe-dev] What does clang::ObjCPropertyDecl::getPropertyAttributes() really gets?

Joseph Pan cs.wzpan at gmail.com
Mon Jan 5 23:16:41 PST 2015


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.

-- 

Yours respectfully,

潘伟洲(Weizhou Pan)

hahack.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150106/b6c82863/attachment.html>


More information about the cfe-dev mailing list