r227528 - clang-cl: Enable -fexceptions but not -fcxx-exceptions by default

Reid Kleckner reid at kleckner.net
Thu Jan 29 17:04:17 PST 2015


Author: rnk
Date: Thu Jan 29 19:04:16 2015
New Revision: 227528

URL: http://llvm.org/viewvc/llvm-project?rev=227528&view=rev
Log:
clang-cl: Enable -fexceptions but not -fcxx-exceptions by default

This enables proper IRgen of SEH constructs.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/cl-eh.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=227528&r1=227527&r2=227528&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Jan 29 19:04:16 2015
@@ -4820,10 +4820,10 @@ void Clang::AddClangCLArgs(const ArgList
   const Driver &D = getToolChain().getDriver();
   EHFlags EH = parseClangCLEHFlags(D, Args);
   // FIXME: Do something with NoExceptC.
-  if (EH.Synch || EH.Asynch) {
-    CmdArgs.push_back("-fexceptions");
+  if (EH.Synch || EH.Asynch)
     CmdArgs.push_back("-fcxx-exceptions");
-  }
+  // Always add -fexceptions to allow SEH __try.
+  CmdArgs.push_back("-fexceptions");
 
   // /EP should expand to -E -P.
   if (Args.hasArg(options::OPT__SLASH_EP)) {

Modified: cfe/trunk/test/Driver/cl-eh.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-eh.cpp?rev=227528&r1=227527&r2=227528&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-eh.cpp (original)
+++ cfe/trunk/test/Driver/cl-eh.cpp Thu Jan 29 19:04:16 2015
@@ -5,18 +5,23 @@
 // 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: "-fcxx-exceptions"
 // EHsc: "-fexceptions"
 
 // RUN: %clang_cl /c /EHs-c- -### -- %s 2>&1 | FileCheck -check-prefix=EHs_c_ %s
-// EHs_c_-NOT: "-fexceptions"
+// EHs_c_-NOT: "-fcxx-exceptions"
+// EHs_c_: "-fexceptions"
 
 // RUN: %clang_cl /c /EHs- /EHc- -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHc_ %s
-// EHs_EHc_-NOT: "-fexceptions"
+// EHs_EHc_-NOT: "-fcxx-exceptions"
+// EHs_EHc_: "-fexceptions"
 
 // RUN: %clang_cl /c /EHs- /EHs -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHs %s
+// EHs_EHs: "-fcxx-exceptions"
 // EHs_EHs: "-fexceptions"
 
 // RUN: %clang_cl /c /EHs- /EHsa -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHa %s
+// EHs_EHa: "-fcxx-exceptions"
 // EHs_EHa: "-fexceptions"
 
 // RUN: %clang_cl /c /EHinvalid -### -- %s 2>&1 | FileCheck -check-prefix=EHinvalid %s





More information about the cfe-commits mailing list