diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-06-27 17:02:02 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-06-27 17:02:02 +0000 |
commit | ba02d7e2a8adb18f8b4ca6e486a68105a31c52ca (patch) | |
tree | ee30c116af0de60de3b6871ab2c24ab5e54ea56a /test | |
parent | a7effd2e25558b216d02389d3ee655173ffcea6e (diff) | |
download | clang-ba02d7e2a8adb18f8b4ca6e486a68105a31c52ca.tar.gz clang-ba02d7e2a8adb18f8b4ca6e486a68105a31c52ca.tar.bz2 clang-ba02d7e2a8adb18f8b4ca6e486a68105a31c52ca.tar.xz |
clang-cl: Map /EHs- to -fno-exceptions
This isn't 100% compatible with MSVC, but it's close enough. MSVC's /EH
flag doesn't really control exceptions so much as how to clean up after
an exception is thrown. The upshot is that cl.exe /EHs- will compile
try, throw, and catch statements with a warning, but clang-cl will
reject such constructs with a hard error. We can't compile such EH
constructs anyway, but this may matter to consumers of the AST.
Reviewers: hans
Differential Revision: http://reviews.llvm.org/D4317
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Driver/cl-eh.cpp | 24 | ||||
-rw-r--r-- | test/Driver/cl-fallback.c | 4 |
2 files changed, 27 insertions, 1 deletions
diff --git a/test/Driver/cl-eh.cpp b/test/Driver/cl-eh.cpp new file mode 100644 index 0000000000..8a3450a88c --- /dev/null +++ b/test/Driver/cl-eh.cpp @@ -0,0 +1,24 @@ +// Don't attempt slash switches on msys bash. +// REQUIRES: shell-preserves-root + +// Note: %s must be preceded by --, otherwise it may be interpreted as a +// command-line option, e.g. on Mac where %s is commonly under /Users. + +// RUN: %clang_cl /c /EHsc -### -- %s 2>&1 | FileCheck -check-prefix=EHsc %s +// EHsc: "-fexceptions" + +// RUN: %clang_cl /c /EHs-c- -### -- %s 2>&1 | FileCheck -check-prefix=EHs_c_ %s +// EHs_c_-NOT: "-fexceptions" + +// RUN: %clang_cl /c /EHs- /EHc- -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHc_ %s +// EHs_EHc_-NOT: "-fexceptions" + +// RUN: %clang_cl /c /EHs- /EHs -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHs %s +// EHs_EHs: "-fexceptions" + +// RUN: %clang_cl /c /EHs- /EHsa -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHa %s +// EHs_EHa: "-fexceptions" + +// RUN: %clang_cl /c /EHinvalid -### -- %s 2>&1 | FileCheck -check-prefix=EHinvalid %s +// EHinvalid: error: invalid value 'invalid' in '/EH' +// EHinvalid-NOT: error: diff --git a/test/Driver/cl-fallback.c b/test/Driver/cl-fallback.c index 1bb0993d27..99cf627f7b 100644 --- a/test/Driver/cl-fallback.c +++ b/test/Driver/cl-fallback.c @@ -5,7 +5,7 @@ // command-line option, e.g. on Mac where %s is commonly under /Users. // RUN: %clang_cl /fallback /Dfoo=bar /Ubaz /Ifoo /O0 /Ox /GR /GR- /Gy /Gy- \ -// RUN: /Gw /Gw- /LD /LDd /MD /MDd /MTd /MT /FImyheader.h /Zi \ +// RUN: /Gw /Gw- /LD /LDd /EHs /EHs- /MD /MDd /MTd /MT /FImyheader.h /Zi \ // RUN: -### -- %s 2>&1 \ // RUN: | FileCheck %s // CHECK: "-fdiagnostics-format" "msvc-fallback" @@ -25,6 +25,8 @@ // CHECK: "/FImyheader.h" // CHECK: "/LD" // CHECK: "/LDd" +// CHECK: "/EHs" +// CHECK: "/EHs-" // CHECK: "/MT" // CHECK: "/Tc" "{{.*cl-fallback.c}}" // CHECK: "/Fo{{.*cl-fallback.*.obj}}" |