[cfe-users] Basic AST-dump when errors are encountered
Lander Brandt via cfe-users
cfe-users at lists.llvm.org
Tue Apr 26 12:00:48 PDT 2016
I’m trying to parse the following file: http://opensource.apple.com/source/IOUSBFamily/IOUSBFamily-630.4.5/IOUSBUserClient/Classes/IOUSBInterfaceUserClientV3.cpp
With the following command:
clang -ferror-limit=1000 -Xclang -ast-dump -I$HOME/Downloads/IOUSBFamily-630.4.5/IOUSBUserClient/Headers ~/Downloads/IOUSBFamily-630.4.5/IOUSBUserClient/Classes/IOUSBInterfaceUserClientV3.cpp
Since so many errors occur though, clang does not emit nearly as much information as I’d like. Specifically I’m trying to get the `IOUSBInterfaceUserClientV3::sV3Methods[kIOUSBLibInterfaceUserClientV3NumCommands]` definition but the following error occurs:
IOUSBFamily-630.4.5/IOUSBUserClient/Classes/IOUSBInterfaceUserClientV3.cpp:56:7: error: expected function body after function
declarator
const IOExternalMethodDispatch
^
The `OSDefineMetaClassAndStructors` macro seems to throw off parsing (even within Xcode).
You can download the full source at http://opensource.apple.com/tarballs/IOUSBFamily/IOUSBFamily-630.4.5.tar.gz to try reproducing.
I was wondering if there’s any way to use libclang or clang’s `-ast-dump` switch to get something resembling the output I desire? Specifically the `IOUSBInterfaceUserClientV3::sV3Methods[kIOUSBLibInterfaceUserClientV3NumCommands]` definition (I’m just trying to get info about the elements).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20160426/54df9791/attachment.html>
More information about the cfe-users
mailing list