Skip to content

Commit c2c951c

Browse files
committed
---
yaml --- r: 277422 b: refs/heads/try c: b5d7783 h: refs/heads/master
1 parent a6f7873 commit c2c951c

File tree

2 files changed

+42
-16
lines changed

2 files changed

+42
-16
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 3bcee269b50def69d73bd588b1619ec6a4756662
4+
refs/heads/try: b5d7783546f938c7c2903b4d5143ff8e8e612674
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_trans/builder.rs

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
165165
args: &[ValueRef],
166166
then: BasicBlockRef,
167167
catch: BasicBlockRef,
168-
bundle: Option<&OperandBundleDef>)
169-
-> ValueRef {
168+
bundle: Option<&OperandBundleDef>) -> ValueRef {
170169
self.count_insn("invoke");
171170

172171
debug!("Invoke {:?} with args ({})",
@@ -176,6 +175,31 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
176175
.collect::<Vec<String>>()
177176
.join(", "));
178177

178+
if cfg!(debug_assertions) {
179+
let mut fn_ty = val_ty(llfn);
180+
// Strip off pointers
181+
while fn_ty.kind() == llvm::TypeKind::Pointer {
182+
fn_ty = fn_ty.element_type();
183+
}
184+
185+
assert!(fn_ty.kind() == llvm::TypeKind::Function,
186+
"builder::invoke not passed a function");
187+
188+
let param_tys = fn_ty.func_params();
189+
190+
let iter = param_tys.into_iter()
191+
.zip(args.iter().map(|&v| val_ty(v)));
192+
for (i, (expected_ty, actual_ty)) in iter.enumerate() {
193+
if expected_ty != actual_ty {
194+
bug!("Type mismatch in invoke of {:?}. \
195+
Expected {:?} for param {}, got {:?}",
196+
Value(llfn),
197+
expected_ty, i, actual_ty);
198+
199+
}
200+
}
201+
}
202+
179203
let bundle = bundle.as_ref().map(|b| b.raw()).unwrap_or(0 as *mut _);
180204

181205
unsafe {
@@ -856,26 +880,28 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
856880
.collect::<Vec<String>>()
857881
.join(", "));
858882

859-
let mut fn_ty = val_ty(llfn);
860-
// Strip off pointers
861-
while fn_ty.kind() == llvm::TypeKind::Pointer {
862-
fn_ty = fn_ty.element_type();
863-
}
883+
if cfg!(debug_assertions) {
884+
let mut fn_ty = val_ty(llfn);
885+
// Strip off pointers
886+
while fn_ty.kind() == llvm::TypeKind::Pointer {
887+
fn_ty = fn_ty.element_type();
888+
}
864889

865-
assert!(fn_ty.kind() == llvm::TypeKind::Function,
866-
"builder::call not passed a function");
890+
assert!(fn_ty.kind() == llvm::TypeKind::Function,
891+
"builder::call not passed a function");
867892

868-
let param_tys = fn_ty.func_params();
893+
let param_tys = fn_ty.func_params();
869894

870-
let iter = param_tys.into_iter()
871-
.zip(args.iter().map(|&v| val_ty(v)));
872-
for (i, (expected_ty, actual_ty)) in iter.enumerate() {
873-
if expected_ty != actual_ty {
874-
bug!("Type mismatch in function call of {:?}. \
895+
let iter = param_tys.into_iter()
896+
.zip(args.iter().map(|&v| val_ty(v)));
897+
for (i, (expected_ty, actual_ty)) in iter.enumerate() {
898+
if expected_ty != actual_ty {
899+
bug!("Type mismatch in function call of {:?}. \
875900
Expected {:?} for param {}, got {:?}",
876901
Value(llfn),
877902
expected_ty, i, actual_ty);
878903

904+
}
879905
}
880906
}
881907

0 commit comments

Comments
 (0)