Skip to content

Commit 25364c6

Browse files
committed
Explain flag value of 8 for msvc_try
1 parent a8568db commit 25364c6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustc_codegen_llvm/intrinsic.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -952,11 +952,15 @@ fn codegen_msvc_try(
952952
let cs = catchswitch.catch_switch(None, None, 1);
953953
catchswitch.add_handler(cs, catchpad.llbb());
954954

955+
// The flag value of 8 indicates that we are catching the exception by
956+
// reference instead of by value.
957+
//
958+
// Source: MicrosoftCXXABI::getAddrOfCXXCatchHandlerType in clang
959+
let flags = bx.const_i32(8);
955960
let tydesc = match bx.tcx().lang_items().eh_catch_typeinfo() {
956961
Some(did) => bx.get_static(did),
957962
None => bug!("eh_catch_typeinfo not defined, but needed for SEH unwinding"),
958963
};
959-
let flags = bx.const_i32(8); // Catch by reference
960964
let funclet = catchpad.catch_pad(cs, &[tydesc, flags, slot]);
961965

962966
let i64_align = bx.tcx().data_layout.i64_align.abi;

0 commit comments

Comments
 (0)