about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2020-01-01 22:24:39 +0100
committerAmanieu d'Antras <amanieu@gmail.com>2020-01-11 10:18:44 +0000
commited217a53ff959414e9c723d8fecf80bc797a5a77 (patch)
tree70a5cb523568d9f6a7cb708428244e06686a50cc
parent838e3874fc11f24ebe8a7dff02a7f7614a5d2938 (diff)
downloadrust-ed217a53ff959414e9c723d8fecf80bc797a5a77.tar.gz
rust-ed217a53ff959414e9c723d8fecf80bc797a5a77.zip
Explain flag value of 8 for msvc_try
-rw-r--r--src/librustc_codegen_llvm/intrinsic.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs
index 5adff0d1f92..27308cabd45 100644
--- a/src/librustc_codegen_llvm/intrinsic.rs
+++ b/src/librustc_codegen_llvm/intrinsic.rs
@@ -952,11 +952,15 @@ fn codegen_msvc_try(
         let cs = catchswitch.catch_switch(None, None, 1);
         catchswitch.add_handler(cs, catchpad.llbb());
 
+        // The flag value of 8 indicates that we are catching the exception by
+        // reference instead of by value.
+        //
+        // Source: MicrosoftCXXABI::getAddrOfCXXCatchHandlerType in clang
+        let flags = bx.const_i32(8);
         let tydesc = match bx.tcx().lang_items().eh_catch_typeinfo() {
             Some(did) => bx.get_static(did),
             None => bug!("eh_catch_typeinfo not defined, but needed for SEH unwinding"),
         };
-        let flags = bx.const_i32(8); // Catch by reference
         let funclet = catchpad.catch_pad(cs, &[tydesc, flags, slot]);
 
         let i64_align = bx.tcx().data_layout.i64_align.abi;