I need to do parsing of some Objective-C headers.
Doxygen
and parsing the XML output, but it doesn't fully support Objective C headers without comments (it chokes on macros defined in properties, check Doxygen not properly recognizing properties)appledoc
, but the XML output is not complete enough (for example, there is no information of inheritance for classes) and it has the same problem with macros on properties.otool
), but noticed that the metadata doesn't keep the types on methods (so you get method:(id)param:(id)
)Does anyone know a good tool to do what I want? I'm suspecting clang
will help me, but so far the -ast-dump
and similar options just tries to generate an AST for a source I don't have (only headers).
You may be able to use libclang. libclang is a programmatic interface designed for implementing tools like syntax highlighting and code completion.
clang -ast-dump
works for me. (Note that -ast-dump
is not supported by the driver, so you have to do some extra work to pass the flags that the driver usually handles. You can use clang -### ...
to see exactly what the driver is doing.)
% clang -cc1 -ast-dump -fblocks -x objective-c /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h
[...]
|-ObjCInterfaceDecl 0x1023727c0 <line:50:1, line:96:2> NSObject
| |-ObjCProtocol 0x102371350 'NSObject'
[...]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With