[cfe-dev] Libclang and Objective-C headers

David Chisnall csdavec at swan.ac.uk
Fri Dec 31 09:47:44 PST 2010


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





More information about the cfe-dev mailing list