Rollup merge of #52573 - oli-obk:cleanups, r=RalfJung

Cleanups

r? @RalfJung
This commit is contained in:
kennytm
2018-07-21 02:59:13 +08:00
2 changed files with 8 additions and 19 deletions
+7 -1
View File
@@ -51,6 +51,12 @@ fn is_fn_like(&self) -> bool {
}
}
impl MaybeFnLike for ast::ImplItem {
fn is_fn_like(&self) -> bool {
match self.node { ast::ImplItemKind::Method(..) => true, _ => false, }
}
}
impl MaybeFnLike for ast::TraitItem {
fn is_fn_like(&self) -> bool {
match self.node {
@@ -141,7 +147,7 @@ pub fn from_node(node: Node) -> Option<FnLikeNode> {
let fn_like = match node {
map::NodeItem(item) => item.is_fn_like(),
map::NodeTraitItem(tm) => tm.is_fn_like(),
map::NodeImplItem(_) => true,
map::NodeImplItem(it) => it.is_fn_like(),
map::NodeExpr(e) => e.is_fn_like(),
_ => false
};
+1 -18
View File
@@ -13,7 +13,7 @@
use llvm;
use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
use llvm::{Opcode, IntPredicate, RealPredicate, False, OperandBundleDef};
use llvm::{ValueRef, BasicBlockRef, BuilderRef, ModuleRef};
use llvm::{ValueRef, BasicBlockRef, BuilderRef};
use common::*;
use type_::Type;
use value::Value;
@@ -1157,23 +1157,6 @@ pub fn ptrdiff(&self, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
}
}
pub fn trap(&self) {
unsafe {
let bb: BasicBlockRef = llvm::LLVMGetInsertBlock(self.llbuilder);
let fn_: ValueRef = llvm::LLVMGetBasicBlockParent(bb);
let m: ModuleRef = llvm::LLVMGetGlobalParent(fn_);
let p = "llvm.trap\0".as_ptr();
let t: ValueRef = llvm::LLVMGetNamedFunction(m, p as *const _);
assert!((t as isize != 0));
let args: &[ValueRef] = &[];
self.count_insn("trap");
llvm::LLVMRustBuildCall(self.llbuilder, t,
args.as_ptr(), args.len() as c_uint,
ptr::null_mut(),
noname());
}
}
pub fn landing_pad(&self, ty: Type, pers_fn: ValueRef,
num_clauses: usize) -> ValueRef {
self.count_insn("landingpad");