Skip to content

Commit

Permalink
improper_ctypes: also check extern fn's
Browse files Browse the repository at this point in the history
  • Loading branch information
TimNN committed Dec 20, 2015
1 parent 9953eaf commit cc3d5e3
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/librustc_lint/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ use syntax::{abi, ast};
use syntax::attr::{self, AttrMetaMethods};
use syntax::codemap::{self, Span};
use syntax::feature_gate::{emit_feature_err, GateIssue};
use syntax::ast::{TyIs, TyUs, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64};
use syntax::ast::{NodeId, TyIs, TyUs, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64};

use rustc_front::hir;
use rustc_front::intravisit::{self, Visitor};
use rustc_front::intravisit::{self, FnKind, Visitor};
use rustc_front::util::is_shift_binop;

declare_lint! {
Expand Down Expand Up @@ -674,4 +674,21 @@ impl LateLintPass for ImproperCTypes {
}
}
}

fn check_fn(&mut self, cx: &LateContext,
kind: FnKind,
decl: &hir::FnDecl,
_: &hir::Block,
_: Span,
_: NodeId) {
let abi = match kind {
FnKind::ItemFn(_, _, _, _, abi, _) => abi,
FnKind::Method(_, sig, _) => sig.abi,
FnKind::Closure => return,
};

if should_check_abi(abi) {
check_foreign_fn(cx, decl);
}
}
}

0 comments on commit cc3d5e3

Please sign in to comment.