[cfe-dev] Libclang and Objective-C headers

Ted Kremenek kremenek at apple.com
Sat Jan 1 22:08:50 PST 2011


Back pedaling a bit, I'll freely admit that my second sentence here wasn't really a super useful suggestion on it's own.  In the back of my mind were the other issues I mentioned with regards to header files, and wanted to draw then out.  The main thing I can see with creating a fake t.m is that if the header relies on being #import'ed (for automatic inclusion guards) or otherwise included in a specific way it may impact in subtle ways how a header is processed.  At any rate, the most accurate syntax highlighting will come from seeing how a header is actually used within a project by actual sources.  That, however, might not be necessary for your application.

On Jan 1, 2011, at 2:38 PM, Ted Kremenek <kremenek at apple.com> wrote:

> 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
> _______________________________________________
> 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