@@ -1435,8 +1435,8 @@ impl Builder {
1435
1435
self
1436
1436
}
1437
1437
1438
- /// Generate the Rust bindings using the options built up thus far.
1439
- pub fn generate ( mut self ) -> Result < Bindings , ( ) > {
1438
+ /// Generate the Rust bindings options
1439
+ pub fn generate_options ( & mut self ) -> & Self {
1440
1440
// Add any extra arguments from the environment to the clang command line.
1441
1441
if let Some ( extra_clang_args) =
1442
1442
get_target_dependent_env_var ( "BINDGEN_EXTRA_CLANG_ARGS" )
@@ -1451,7 +1451,7 @@ impl Builder {
1451
1451
1452
1452
// Transform input headers to arguments on the clang command line.
1453
1453
self . options . input_header = self . input_headers . pop ( ) ;
1454
- self . options . extra_input_headers = self . input_headers ;
1454
+ self . options . extra_input_headers = self . input_headers . to_vec ( ) ;
1455
1455
self . options . clang_args . extend (
1456
1456
self . options . extra_input_headers . iter ( ) . flat_map ( |header| {
1457
1457
iter:: once ( "-include" . into ( ) )
@@ -1466,7 +1466,12 @@ impl Builder {
1466
1466
clang:: UnsavedFile :: new ( & name, & contents)
1467
1467
} ) ,
1468
1468
) ;
1469
+ self
1470
+ }
1469
1471
1472
+ /// Generate the Rust bindings using the options built up thus far.
1473
+ pub fn generate ( mut self ) -> Result < Bindings , ( ) > {
1474
+ self . generate_options ( ) ;
1470
1475
Bindings :: generate ( self . options )
1471
1476
}
1472
1477
@@ -1475,7 +1480,7 @@ impl Builder {
1475
1480
/// This is useful when debugging bindgen, using C-Reduce, or when filing
1476
1481
/// issues. The resulting file will be named something like `__bindgen.i` or
1477
1482
/// `__bindgen.ii`
1478
- pub fn dump_preprocessed_input ( & self ) -> io:: Result < ( ) > {
1483
+ pub fn dump_preprocessed_input ( & mut self ) -> io:: Result < ( ) > {
1479
1484
let clang =
1480
1485
clang_sys:: support:: Clang :: find ( None , & [ ] ) . ok_or_else ( || {
1481
1486
io:: Error :: new (
@@ -1543,6 +1548,7 @@ impl Builder {
1543
1548
"__bindgen.i"
1544
1549
} ) ?;
1545
1550
io:: copy ( & mut preprocessed, & mut file) ?;
1551
+ self . generate_options ( ) ;
1546
1552
1547
1553
if child. wait ( ) ?. success ( ) {
1548
1554
Ok ( ( ) )
0 commit comments