Clang.jl icon indicating copy to clipboard operation
Clang.jl copied to clipboard

Documentation for `#define` macros

Open sjkelly opened this issue 4 years ago • 1 comments

For some packages there are many constants that are nice to have documented. For example, in this format:

/*!
 * Indicate end of burst for transmit or receive.
 * For write, end of burst if set by the caller.
 * For read, end of burst is set by the driver.
 */
#define END_BURST (1 << 1)

is output as:

const END_BURST = 1 << 1

I am attempting the changes for this but I am having difficulty tracking down where the comment is dropped from the parser.

sjkelly avatar Jan 27 '22 15:01 sjkelly

Libclang does not provide these information. From https://github.com/llvm/llvm-project/blob/8f972cb0fd0cf2513a1134a5f37b3c059376ca47/clang/tools/libclang/CIndex.cpp#L8429-L8431 and https://github.com/llvm/llvm-project/blob/8f972cb0fd0cf2513a1134a5f37b3c059376ca47/clang/tools/libclang/CXComment.cpp#L28-L32, we can see that libclang only provides comment information for declarations, while a macro #define is, unfortunately, a MacroDefinition.

melonedo avatar Jan 27 '22 16:01 melonedo