[compiler-rt] [llvm] [ASan] Do not instrument catch block parameters on Windows (PR #159618)
David Justo via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 17 09:13:38 PDT 2025
================
@@ -0,0 +1,63 @@
+; This test ensures that catch parameters are not instrumented on Windows.
+
+; This file was generated using the following source
+;
+; ```C++
+; #include <exception>
+; #include <cstdio>
+;
+; int main() {
+; try {
+; throw 1;
+; } catch (const int ex) {
+; printf("%d\n", ex);
+; return -1;
+; }
+; return 0;
+; }
+;
+; ```
+; then running the following sequence of commands
+;
+; ```
+; clang.exe -g0 -O0 -emit-llvm -c main.cpp -o main.bc
+; llvm-extract.exe -func=main main.bc -o main_func.bc
+; llvm-dis.exe main_func.bc -o main_func_dis.ll
+; ```
+; and finally manually trimming the resulting `.ll` file to remove
+; unnecessary metadata, and manually adding the `sanitize_address` annotation;
+; needed for the ASan pass to run.
+
+; RUN: opt < %s -passes=asan -S | FileCheck %s
+; CHECK: %ex = alloca i32, align 4
+; CHECK: catchpad within %{{.*}} [ptr @"??_R0H at 8", i32 0, ptr %ex]
----------------
davidmrdavid wrote:
good idea, incorporated: https://github.com/llvm/llvm-project/pull/159618/commits/980e31d8c29da954f2820c4041445bdee0fa0fc4
thanks!
https://github.com/llvm/llvm-project/pull/159618
More information about the llvm-commits
mailing list