File tree 2 files changed +8
-6
lines changed
2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ impl Cursor {
182
182
183
183
/// Is the referent a template specialization?
184
184
pub fn is_template ( & self ) -> bool {
185
- self . specialized ( ) . is_valid ( )
185
+ self . specialized ( ) . is_some ( )
186
186
}
187
187
188
188
/// Is the referent a fully specialized template specialization without any
@@ -282,11 +282,12 @@ impl Cursor {
282
282
283
283
/// Given that this cursor points to a template specialization, get a cursor
284
284
/// pointing to the template definition that is being specialized.
285
- pub fn specialized ( & self ) -> Cursor {
285
+ pub fn specialized ( & self ) -> Option < Cursor > {
286
286
unsafe {
287
- Cursor {
288
- x : clang_getSpecializedCursorTemplate ( self . x ) ,
289
- }
287
+ let ret = Cursor {
288
+ x : clang_getSpecializedCursorTemplate ( self . x )
289
+ } ;
290
+ if ret. is_valid ( ) { Some ( ret) } else { None }
290
291
}
291
292
}
292
293
Original file line number Diff line number Diff line change @@ -512,7 +512,8 @@ impl CompInfo {
512
512
}
513
513
} ;
514
514
515
- ci. ref_template = Item :: parse ( cursor. specialized ( ) , None , ctx) . ok ( ) ;
515
+ ci. ref_template = cursor. specialized ( )
516
+ . and_then ( |c| Item :: parse ( c, None , ctx) . ok ( ) ) ;
516
517
517
518
let mut maybe_anonymous_struct_field = None ;
518
519
cursor. visit ( |cur| {
You can’t perform that action at this time.
0 commit comments