[PATCH] Add [some] template argument-extraction calls to libclang & cindex
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Oct 9 20:07:22 PDT 2014
On Oct 8, 2014, at 9:54 AM, Rob Springer <rspringer at google.com> wrote:
> One question: ...getNumTemplateArguments and other functions depend on the helper clang_Cursor_getTemplateArgument, which also has an unambiguous "bad" return ("false"), so I've removed the asserts there, as well (or else getNumTemplateArguments would still throw them). It seems like a shame, though, to lose the debugging information that was captured in the assert message ("Invalid template argument index", for example, in the prior patch revision). Is there a convention to preserve that information somehow, or is that not standard Clang practice?
See example of clang_Type_getSizeOf which returns different negative numbers for different kind of failure.
+ * If the argument CXCursor does not represent a FunctionDecl whose I'th
+ * template argument has a kind of ArgKind::Integral, an invalid type is\
+ * returned (in debug mode, this will assert).
This should mention 'CXTemplateArgumentKind_Integral' (not ArgKind::Integral) and it's not asserting now right ?
Otherwise, LGTM!
On Oct 8, 2014, at 4:07 PM, Rob Springer <rspringer at google.com> wrote:
> Added some tests to index-templates.cpp; I can add more if necessary/desired (...but I was having some difficulty getting more TemplateArgument::ArgKinds to be expressed).
>
> http://reviews.llvm.org/D5621
>
> Files:
> bindings/python/clang/cindex.py
> bindings/python/tests/cindex/test_cursor.py
> include/clang-c/Index.h
> test/Index/index-templates.cpp
> test/Index/preamble_macro_template.cpp
> tools/c-index-test/c-index-test.c
> tools/libclang/CXCursor.cpp
> tools/libclang/libclang.exports
> <D5621.14606.patch>
More information about the cfe-commits
mailing list