<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Apr 18, 2008, at 10:52 AM, Emerson Murphy-Hill wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Ahoy!<div><br></div><div>I'm trying to determine the SourceLocation of an Objective-C instance variable's type, if there is one. This seemed like a reasonable way to start:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> <span style="color: #3f6e74">clang</span>::<span style="color: #5c2699">ObjCIvarDecl</span>* iVar = ... //your ivar here...</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> <span style="color: #3f6e74">clang</span>::<span style="color: #3f6e74">Type</span>* t = iVar-><span style="color: #2e0d6e">getType</span>().<span style="color: #2e0d6e">getTypePtr</span>();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(46, 13, 110); "><span style="color: #000000"> t-></span>isObjCInterfaceType<span style="color: #000000">();</span></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div>Unfortunately, I get an EXC_BAD_ACCESS on the final line. For the test case I'm working on, I would have expected it to simply return false, since my ivar is an int.</div><div><br></div></div></div></blockquote><div><br class="webkit-block-placeholder"></div>I don't know if this is your problem, but...</div><div><br class="webkit-block-placeholder"></div><div>There shouldn't be a reason to use getTypePtr() explicitly...just do iVar->getType()->isObjCInterfaceType()...</div><div><br class="webkit-block-placeholder"></div><div>Another point...since most types are uniqued, we don't have a SourceLocation to identify them.</div><div><br class="webkit-block-placeholder"></div><div>snaroff</div><div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Thanks in advance,</div><div><br></div><div>Emerson</div></div></div>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br></blockquote></div><br></body></html>