From 83a019d42787a627567f1aec100a3bb4b232c4b9 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 22 Jul 2015 20:54:24 +0000 Subject: [PATCH] [asan] Test clang's SEH implementation as well as MSVC's llvm-svn: 242933 --- compiler-rt/test/asan/TestCases/Windows/seh.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/compiler-rt/test/asan/TestCases/Windows/seh.cc b/compiler-rt/test/asan/TestCases/Windows/seh.cc index 50cf6dd..4cb0c55 100644 --- a/compiler-rt/test/asan/TestCases/Windows/seh.cc +++ b/compiler-rt/test/asan/TestCases/Windows/seh.cc @@ -1,16 +1,17 @@ -// Clang doesn't support SEH on Windows yet, so for the time being we -// build this program in two parts: the code with SEH is built with CL, -// the rest is built with Clang. This represents the typical scenario when we -// build a large project using "clang-cl -fallback -fsanitize=address". +// Make sure that ASan works with SEH in both Clang and MSVC. MSVC uses a +// different EH personality depending on the -GS setting, so test both -GS+ and +// -GS-. // -// Check both -GS and -GS- builds: -// RUN: cl -c %s -Fo%t.obj +// RUN: cl -c %s -Fo%t.obj -DCOMPILE_SEH // RUN: %clangxx_asan -o %t.exe %s %t.obj // RUN: %run %t.exe // -// RUN: cl -GS- -c %s -Fo%t.obj +// RUN: cl -GS- -c %s -Fo%t.obj -DCOMPILE_SEH // RUN: %clangxx_asan -o %t.exe %s %t.obj // RUN: %run %t.exe +// +// RUN: %clang_cl_asan %s -DCOMPILE_SEH -Fe%t.exe +// RUN: %run %t.exe #include #include @@ -22,7 +23,7 @@ extern "C" bool __asan_address_is_poisoned(void *p); void ThrowAndCatch(); -#if !defined(__clang__) +#if defined(COMPILE_SEH) __declspec(noinline) void Throw() { int local, zero = 0; @@ -39,8 +40,9 @@ void ThrowAndCatch() { fprintf(stderr, "__except: %p\n", &local); } } -#else +#endif +#if defined(__clang__) int main() { char x[32]; fprintf(stderr, "Before: %p poisoned: %d\n", &x, -- 2.7.4