(ping) Hi everyone. Attached is a patch that augments the libclang API with some additional functions to introspect macro definitions referenced by CXCursor_MacroDefinition cursors:
* clang_isMacroFunctionLike, to return whether a macro is function-like; * clang_getMacroVarargsKind, to return whether a macro is GNU-style, C99-style, or not variadic; * clang_isMacroBuiltin, to return whether a macro is builtin; * clang_numMacroArgs and clang_getMacroArgNames, to return the count and names of a function-like macro's arguments; * and clang_getMacroReplacementTokens, to return an array of CXTokens making up the macro's body. To implement this, I modified the MacroDefinition type to hold a reference to its originating MacroInfo, and modified Preprocessor not to deallocate MacroInfo records when a detailed preprocessing record is being taken. This way, MacroDefinitions remain associated with the proper MacroInfo even if a macro is subsequently #undef-ed or re-#define-ed. If there's a better way to handle undefined MacroInfos, or if you have any other suggestions, let me know. Thanks. -Joe
libclang-macro-info.diff
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
