[cfe-dev] Libclang and Objective-C headers

Ted Kremenek kremenek at apple.com
Sat Jan 1 14:38:19 PST 2011


Header files inherently have less meaning until they are actually included.  How about create a fake t.m that includes the header, and analyze that?

On Dec 31, 2010, at 9:47 AM, David Chisnall <csdavec at swan.ac.uk> wrote:

> Hi,
> 
> I'm trying to use libclang to gather information about Objective-C headers.  Unfortunately, clang appears to default to C for .h files (probably sensible) and to refer to ignore -x options passed in to clang_createTranslationUnitFromSourceFile() and clang_parseTranslationUnit().  
> 
> Is there an existing way of overriding the default language choice when parsing headers (I assume that the XCode people needed this for editing Objective-C headers?), and if so what is it?  
> 
> Alternatively, would it be possible for libclang to automatically detect the language of header files?  It's relatively easy to tell C[++] and Objective-C[++] apart (spot an #import or an @-keyword anywhere), but telling C and C++ apart is probably a bit harder.
> 
> David
> 
> -- Sent from my STANTEC-ZEBRA
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list