<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 5, 2015, at 11:16 PM, Joseph Pan <<a href="mailto:cs.wzpan@gmail.com" class="">cs.wzpan@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi all,<div class=""><br class=""></div><div class="">I'm trying to extract all attributes from an ObjCPropertyDecl such as:</div><div class=""><br class=""></div><div class="">```</div><div class="">@property (strong, nonatomic) NSMutableDictionary* fieldsToBePosted;<br class=""></div><div class="">```</div><div class=""><br class=""></div><div class="">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:</div><div class=""><br class=""></div><div class="">```</div><div class="">clang::ObjCPropertyDecl::PropertyAttributeKind kind = decl->getPropertyAttributes();<br class=""></div><div class="">cout << kind << endl;</div><div class="">```</div><div class=""><br class=""></div><div class="">What surprised me is that I got 64 (0x40), which is OBJC_PR_nonatomic. What I expected is OBJC_PR_nonatomic | OBJC_PR_strong <i class="">a.k.a.</i> 1088(0x440).</div><div class=""><br class=""></div><div class="">Also, as I tried to dump the decl, it looks like this:</div><div class=""><br class=""></div><div class="">```</div><div class=""><div class="">ObjCPropertyDecl 0x7fc9ac66c640 </Users/wzpan/Documents/workspace/HelloWorld/HelloWorldViewController.m:14:1, col:52> col:52 fieldsToBePosted 'NSMutableDictionary *' nonatomic</div></div><div class="">```<br class=""></div><div class=""><br class=""></div><div class="">Where has the `strong` attributes gone? Can anyone please tell me how to get all the attributes? Thanks.</div></div></div></blockquote><div><br class=""></div>Try: <span style="font-family: Menlo; font-size: 11px;" class="">getPropertyAttributesAsWritten</span></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">- Fariborz</span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature"><div dir="ltr" class=""><span style="font-family:Arial,Helvetica,sans-serif,SimSun;font-size:14px;line-height:22px" class=""><pre style="margin:0px;padding:0px;white-space:pre-wrap" class="">Yours respectfully,</pre><pre style="margin:0px;padding:0px;white-space:pre-wrap" class="">潘伟洲(Weizhou Pan)</pre><pre style="margin:0px;padding:0px;white-space:pre-wrap" class=""><a href="http://hahack.com/" target="_blank" class="">hahack.com</a></pre></span></div></div>
</div></div>
_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@cs.uiuc.edu" class="">cfe-dev@cs.uiuc.edu</a><br class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br class=""></div></blockquote></div><br class=""></body></html>