[PATCH] Add [some] template argument-extraction calls to libclang & cindex
Eli Bendersky
eliben at google.com
Mon Oct 6 09:25:09 PDT 2014
================
Comment at: bindings/python/tests/cindex/test_cursor.py:260
@@ +259,3 @@
+
+ found = False
+ for foo in foos:
----------------
Since you're really only looking for one cursor for 'foo' here, maybe this loop can be simplified away? I.g. no need for 'found' etc. The test and its kin can be made shorter
================
Comment at: bindings/python/tests/cindex/test_cursor.py:264
@@ +263,3 @@
+ found = True
+ num_template_args = foo.get_num_template_arguments()
+ assert num_template_args == 3
----------------
Just:
assert foo.get_num_template_arguments() == 3
?
================
Comment at: bindings/python/tests/cindex/test_cursor.py:287
@@ +286,3 @@
+ found = True
+ assert ctypes.c_int(foo.get_template_argument_value(0)).value == -7
+ assert ctypes.c_bool(foo.get_template_argument_value(2)).value == True
----------------
Why the ctypes casts here?
================
Comment at: include/clang-c/Index.h:2947
@@ +2946,3 @@
+ */
+CINDEX_LINKAGE int clang_Cursor_getNumTemplateArguments(CXCursor C);
+
----------------
Since this is all only for function decls that are specializations, IMHO the comment should mention this. A small code sample could help too
================
Comment at: tools/libclang/CXCursor.cpp:1091
@@ +1090,3 @@
+ assert(0 && "NULL FunctionTemplateSpecializationInfo retrieved");
+ return 0;
+ }
----------------
Why 0 and not -1 here?
http://reviews.llvm.org/D5621
More information about the cfe-commits
mailing list