@@ -14,7 +14,7 @@ use crate::parse::{
14
14
} ;
15
15
use std:: io;
16
16
use std:: collections:: HashMap ;
17
- use rcc :: { InternedStr , Literal } ;
17
+ use saltwater :: { InternedStr , Literal } ;
18
18
19
19
/// The type for a constant variable.
20
20
#[ derive( Debug ) ]
@@ -245,7 +245,7 @@ impl ClangSubItemParser for Var {
245
245
let parse_int = |value| {
246
246
let kind = ctx
247
247
. parse_callbacks ( )
248
- . and_then ( |c| c. int_macro ( rcc :: get_str!( id) , value) )
248
+ . and_then ( |c| c. int_macro ( saltwater :: get_str!( id) , value) )
249
249
. unwrap_or_else ( || {
250
250
default_macro_constant_type ( value)
251
251
} ) ;
@@ -267,7 +267,7 @@ impl ClangSubItemParser for Var {
267
267
ctx,
268
268
) ;
269
269
if let Some ( callbacks) = ctx. parse_callbacks ( ) {
270
- callbacks. str_macro ( rcc :: get_str!( id) , & val) ;
270
+ callbacks. str_macro ( saltwater :: get_str!( id) , & val) ;
271
271
}
272
272
( TypeKind :: Pointer ( char_ty) , VarType :: String ( val) )
273
273
}
@@ -377,10 +377,10 @@ fn parse_macro(
377
377
ctx : & BindgenContext ,
378
378
tokens : & [ ClangToken ] ,
379
379
) -> Option < ( InternedStr , Literal ) > {
380
- use rcc :: Token ;
380
+ use saltwater :: Token ;
381
381
382
- let mut rcc_tokens = tokens. iter ( ) . filter_map ( ClangToken :: as_rcc_token ) ;
383
- let ident_str = match rcc_tokens . next ( ) ?. data {
382
+ let mut swcc_tokens = tokens. iter ( ) . filter_map ( ClangToken :: as_swcc_token ) ;
383
+ let ident_str = match swcc_tokens . next ( ) ?. data {
384
384
Token :: Id ( id) => id,
385
385
_ => return None ,
386
386
} ;
@@ -389,8 +389,8 @@ fn parse_macro(
389
389
}
390
390
let parsed_macros = ctx. parsed_macros ( ) ;
391
391
392
- // TODO: remove this clone (will need changes in rcc )
393
- if let Some ( literal) = rcc_expr ( rcc_tokens . clone ( ) , & parsed_macros) {
392
+ // TODO: remove this clone (will need changes in saltwater )
393
+ if let Some ( literal) = swcc_expr ( swcc_tokens . clone ( ) , & parsed_macros) {
394
394
return Some ( ( ident_str, literal) ) ;
395
395
}
396
396
@@ -400,27 +400,27 @@ fn parse_macro(
400
400
// See:
401
401
// https://bugs.llvm.org//show_bug.cgi?id=9069
402
402
// https://reviews.llvm.org/D26446
403
- let tokens = tokens[ 1 ..tokens. len ( ) - 1 ] . iter ( ) . filter_map ( ClangToken :: as_rcc_token ) ;
404
- if let Some ( literal) = rcc_expr ( tokens, & parsed_macros) {
403
+ let tokens = tokens[ 1 ..tokens. len ( ) - 1 ] . iter ( ) . filter_map ( ClangToken :: as_swcc_token ) ;
404
+ if let Some ( literal) = swcc_expr ( tokens, & parsed_macros) {
405
405
Some ( ( ident_str, literal) )
406
406
} else {
407
407
None
408
408
}
409
409
}
410
410
411
- fn rcc_expr ( rcc_tokens : impl Iterator < Item = rcc :: Locatable < rcc :: Token > > , definitions : & HashMap < InternedStr , rcc :: Definition > ) -> Option < Literal > {
412
- use rcc :: PreProcessor ;
411
+ fn swcc_expr ( swcc_tokens : impl Iterator < Item = saltwater :: Locatable < saltwater :: Token > > , definitions : & HashMap < InternedStr , saltwater :: Definition > ) -> Option < Literal > {
412
+ use saltwater :: PreProcessor ;
413
413
414
- let mut rcc_tokens = rcc_tokens . peekable ( ) ;
415
- let location = rcc_tokens . peek ( ) ?. location ;
416
- PreProcessor :: cpp_expr ( definitions, rcc_tokens , location) . ok ( ) ?. const_fold ( ) . ok ( ) ?. into_literal ( ) . ok ( )
414
+ let mut swcc_tokens = swcc_tokens . peekable ( ) ;
415
+ let location = swcc_tokens . peek ( ) ?. location ;
416
+ PreProcessor :: cpp_expr ( definitions, swcc_tokens , location) . ok ( ) ?. const_fold ( ) . ok ( ) ?. into_literal ( ) . ok ( )
417
417
}
418
418
419
419
fn parse_int_literal_tokens ( cursor : & clang:: Cursor ) -> Option < i64 > {
420
- let rcc_tokens = cursor. rcc_tokens ( ) . into_iter ( ) ;
420
+ let swcc_tokens = cursor. swcc_tokens ( ) . into_iter ( ) ;
421
421
422
422
// TODO(emilio): We can try to parse other kinds of literals.
423
- match rcc_expr ( rcc_tokens , & HashMap :: new ( ) ) {
423
+ match swcc_expr ( swcc_tokens , & HashMap :: new ( ) ) {
424
424
Some ( Literal :: Int ( i) ) => Some ( i) ,
425
425
Some ( Literal :: UnsignedInt ( u) ) => Some ( u as i64 ) ,
426
426
_ => None ,
0 commit comments