brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · e38da0b Raw
64 lines · plain
1; RUN: opt < %s -passes=asan -S | FileCheck %s2; CHECK: %ex = alloca i32, align 43; CHECK: catchpad within %{{.*}} [ptr @"??_R0H@8", i32 0, ptr %ex]4 5; This test ensures that catch parameters are not instrumented on Windows.6 7; This file was generated using the following source8;9; ```C++10; #include <exception>11; #include <cstdio>12;13; int main() {14;  try {15;   throw 1;16;  } catch (const int ex) {17;   printf("%d\n", ex);18;   return -1;19;  }20;  return 0;21; }22;23; ```24; then running the following sequence of commands25;26; ```27; clang.exe -g0 -O0 -emit-llvm -c main.cpp -o main.bc28; llvm-extract.exe -func=main main.bc -o main_func.bc29; llvm-dis.exe main_func.bc -o main_func_dis.ll30; ```31; and finally manually trimming the resulting `.ll` file to remove32; unnecessary metadata, and manually adding the `sanitize_address` annotation;33; needed for the ASan pass to run.34 35target triple = "x86_64-pc-windows-msvc"36 37@"??_R0H@8" = external global ptr38 39; Function Attrs: sanitize_address40define i32 @main() sanitize_address personality ptr @__CxxFrameHandler3 {41entry:42  %ex = alloca i32, align 443  invoke void @throw()44          to label %unreachable unwind label %catch.dispatch45 46catch.dispatch:                                   ; preds = %entry47  %0 = catchswitch within none [label %catch] unwind to caller48 49catch:                                            ; preds = %catch.dispatch50  %1 = catchpad within %0 [ptr @"??_R0H@8", i32 0, ptr %ex]51  call void @opaque() [ "funclet"(token %1) ]52  catchret from %1 to label %return53 54return:                                           ; preds = %catch55  ret i32 056 57unreachable:                                      ; preds = %entry58  unreachable59}60 61declare void @throw() noreturn62declare void @opaque()63declare i32 @__CxxFrameHandler3(...)64