@@ -342,7 +342,12 @@ pub(super) fn gather_foreign_sigs<'tcx>(gacx: &mut GlobalAnalysisCtxt<'tcx>, tcx
342
342
343
343
let inputs = gacx. lcx . mk_slice ( & inputs) ;
344
344
let output = gacx. assign_pointer_ids_with_info ( sig. output ( ) , PointerInfo :: ANNOTATED ) ;
345
- let lsig = LFnSig { inputs, output } ;
345
+ let c_variadic = sig. c_variadic ;
346
+ let lsig = LFnSig {
347
+ inputs,
348
+ output,
349
+ c_variadic,
350
+ } ;
346
351
gacx. fn_sigs . insert ( did, lsig) ;
347
352
}
348
353
}
@@ -607,8 +612,13 @@ fn run(tcx: TyCtxt) {
607
612
. collect :: < Vec < _ > > ( ) ;
608
613
let inputs = gacx. lcx . mk_slice ( & inputs) ;
609
614
let output = gacx. assign_pointer_ids_with_info ( sig. output ( ) , PointerInfo :: ANNOTATED ) ;
615
+ let c_variadic = sig. c_variadic ;
610
616
611
- let lsig = LFnSig { inputs, output } ;
617
+ let lsig = LFnSig {
618
+ inputs,
619
+ output,
620
+ c_variadic,
621
+ } ;
612
622
gacx. fn_sigs . insert ( ldid. to_def_id ( ) , lsig) ;
613
623
}
614
624
@@ -666,6 +676,14 @@ fn run(tcx: TyCtxt) {
666
676
// TODO: set PointerInfo::ANNOTATED for the parts of the type with user annotations
667
677
let lty = match mir. local_kind ( local) {
668
678
LocalKind :: Var | LocalKind :: Temp => acx. assign_pointer_ids ( decl. ty ) ,
679
+ LocalKind :: Arg
680
+ if lsig. c_variadic && local. as_usize ( ) - 1 == lsig. inputs . len ( ) =>
681
+ {
682
+ // This is the hidden VaList<'a> argument at the end
683
+ // of the argument list of a variadic function. It does not
684
+ // appear in lsig.inputs, so we handle it separately here.
685
+ acx. assign_pointer_ids ( decl. ty )
686
+ }
669
687
LocalKind :: Arg => {
670
688
debug_assert ! ( local. as_usize( ) >= 1 && local. as_usize( ) <= mir. arg_count) ;
671
689
lsig. inputs [ local. as_usize ( ) - 1 ]
0 commit comments