================
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
----------------
rspringer wrote:
> eliben wrote:
> > Why the ctypes casts here?
> get_template_argument_value and get_template_argument_unsigned_value return 
> the values as 64-bit signed and unsigned integers, respectively, but the 
> values as declared in the template are ints and bools, respectively, so I 
> want to cast them to 32-bit values to make sure they're extracted correctly 
> as those values.
> 
> It's really not necessary for the bools (obviously), but I suppose I'm a fan 
> of symmetry. I'm happy to change that, though, if you think they're just 
> clutter.
After further thought, I realized this was only necessary b/c I was defining 
get_template_argument_value in terms of get_template_argument_unsigned_value 
(which zero-extends, rather than sign-extends, its argument). When going to fix 
that, I realized that a large body of the code in that area could be 
refactored, which I've now done.
It's a lot better now; PTAL.

http://reviews.llvm.org/D5621



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to