Skip to content

Cleanups #52573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2018
Merged

Cleanups #52573

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/librustc/hir/map/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ impl MaybeFnLike for ast::Item {
}
}

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 {
Expand Down Expand Up @@ -141,7 +147,7 @@ impl<'a> FnLikeNode<'a> {
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
};
Expand Down
19 changes: 1 addition & 18 deletions src/librustc_codegen_llvm/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1157,23 +1157,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
}

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");
Expand Down