[cfe-dev] Type>>isObjCInterfaceType() blows up

Steve Naroff snaroff at apple.com
Fri Apr 18 11:01:26 PDT 2008


On Apr 18, 2008, at 10:52 AM, Emerson Murphy-Hill wrote:

> Ahoy!
>
> 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:
>
>     clang::ObjCIvarDecl* iVar = ... //your ivar here...
>     clang::Type* t = iVar->getType().getTypePtr();
>     t->isObjCInterfaceType();
>
> 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.
>

I don't know if this is your problem, but...

There shouldn't be a reason to use getTypePtr() explicitly...just do  
iVar->getType()->isObjCInterfaceType()...

Another point...since most types are uniqued, we don't have a  
SourceLocation to identify them.

snaroff

> Thanks in advance,
>
> Emerson
> _______________________________________________
> 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/20080418/5c824622/attachment.html>


More information about the cfe-dev mailing list