I've been digging around parsing for some time, and I've discovered the following : clang seems to mishandle the following construct (test.txt, a reduced version of git2/sys/transport.h). If you use the following script, you'll get back the AST from clang. Notice that version gets its comment, as well as set_callbacks. But everything else does not. It seems the culprit is the GIT_CALLBACK macro, which seems to prevent clang (as it comes "first", before the actual documented identifier) from attaching the comment to where it belongs.
This should probably be filed upstream as well, but LLVM's bugzilla is under account spam lockdown, and I have a hunch comment parsing is pretty low-priority. For now, just document that this is the "expected" behavior (and publish the helpful script).
I've been digging around parsing for some time, and I've discovered the following : clang seems to mishandle the following construct (test.txt, a reduced version of
git2/sys/transport.h
). If you use the following script, you'll get back the AST from clang. Notice thatversion
gets its comment, as well asset_callbacks
. But everything else does not. It seems the culprit is theGIT_CALLBACK
macro, which seems to prevent clang (as it comes "first", before the actual documented identifier) from attaching the comment to where it belongs.This should probably be filed upstream as well, but LLVM's bugzilla is under account spam lockdown, and I have a hunch comment parsing is pretty low-priority. For now, just document that this is the "expected" behavior (and publish the helpful script).