File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -130,9 +130,14 @@ impl Cursor {
130
130
/// Return the number of template arguments used by this cursor's referent,
131
131
/// if the referent is either a template specialization or
132
132
/// declaration. Returns -1 otherwise.
133
- pub fn num_template_args ( & self ) -> c_int {
134
- unsafe {
135
- clang_Cursor_getNumTemplateArguments ( self . x )
133
+ pub fn num_template_args ( & self ) -> Option < u32 > {
134
+ let n : c_int = unsafe { clang_Cursor_getNumTemplateArguments ( self . x ) } ;
135
+
136
+ if n >= 0 {
137
+ Some ( n as u32 )
138
+ } else {
139
+ debug_assert_eq ! ( n, -1 ) ;
140
+ None
136
141
}
137
142
}
138
143
@@ -192,7 +197,8 @@ impl Cursor {
192
197
/// Is the referent a fully specialized template specialization without any
193
198
/// remaining free template arguments?
194
199
pub fn is_fully_specialized_template ( & self ) -> bool {
195
- self . is_template ( ) && self . num_template_args ( ) > 0
200
+ self . is_template ( ) && self . num_template_args ( )
201
+ . expect ( "Not a class template specialization" ) > 0
196
202
}
197
203
198
204
/// Is the referent a template specialization that still has remaining free
You can’t perform that action at this time.
0 commit comments