@@ -1875,27 +1875,25 @@ impl EvalResult {
18751875 return None ;
18761876 }
18771877
1878- // Clang has an internal assertion we can trigger if we try to evaluate
1879- // a cursor containing a variadic template type reference. Triggering
1880- // the assertion aborts the process, and we don't want that. Clang
1881- // *also* doesn't expose any API for finding variadic vs non-variadic
1882- // template type references, let alone whether a type referenced is a
1883- // template type, instead they seem to show up as type references to an
1884- // unexposed type. Our solution is to just flat out ban all
1885- // `CXType_Unexposed` from evaluation.
1886- let mut found_cant_eval = false ;
1887- cursor. visit ( |c| if c. kind ( ) == CXCursor_TypeRef &&
1888- c. cur_type ( ) . kind ( ) == CXType_Unexposed
1878+ // Work around https://bugs.llvm.org/show_bug.cgi?id=42532, see:
1879+ // * https://github.com/rust-lang/rust-bindgen/issues/283
1880+ // * https://github.com/rust-lang/rust-bindgen/issues/1590
18891881 {
1890- found_cant_eval = true ;
1891- CXChildVisit_Break
1892- } else {
1893- CXChildVisit_Recurse
1894- } ) ;
1895- if found_cant_eval {
1896- return None ;
1897- }
1882+ let mut found_cant_eval = false ;
1883+ cursor. visit ( |c| {
1884+ if c. kind ( ) == CXCursor_TypeRef &&
1885+ c. cur_type ( ) . canonical_type ( ) . kind ( ) == CXType_Unexposed {
1886+ found_cant_eval = true ;
1887+ return CXChildVisit_Break ;
1888+ }
1889+
1890+ CXChildVisit_Recurse
1891+ } ) ;
18981892
1893+ if found_cant_eval {
1894+ return None ;
1895+ }
1896+ }
18991897 Some ( EvalResult {
19001898 x : unsafe { clang_Cursor_Evaluate ( cursor. x ) } ,
19011899 } )
0 commit comments