r242176 - [clang-cl] Disable C++ exceptions a different way
Reid Kleckner
reid at kleckner.net
Tue Jul 14 11:16:49 PDT 2015
Author: rnk
Date: Tue Jul 14 13:16:48 2015
New Revision: 242176
URL: http://llvm.org/viewvc/llvm-project?rev=242176&view=rev
Log:
[clang-cl] Disable C++ exceptions a different way
Rather than making -fexceptions a core option that enables C++ EH in
clang-cl, users can use the '-Xclang -fexceptions -Xclang
-fcxx-exceptions' flag set. We weren't going to expose -fexceptions in
clang-cl in the long run, so this way we don't add and then remove a
flag.
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/cl-eh.cpp
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=242176&r1=242175&r2=242176&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Jul 14 13:16:48 2015
@@ -512,7 +512,7 @@ def femit_all_decls : Flag<["-"], "femit
HelpText<"Emit all declarations, even if unused">;
def fencoding_EQ : Joined<["-"], "fencoding=">, Group<f_Group>;
def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group<f_Group>, Flags<[CoreOption]>;
-def fexceptions : Flag<["-"], "fexceptions">, Group<f_Group>, Flags<[CC1Option, CoreOption]>,
+def fexceptions : Flag<["-"], "fexceptions">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Enable support for exception handling">;
def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">,
Group<clang_ignored_gcc_optimization_f_Group>;
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=242176&r1=242175&r2=242176&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Jul 14 13:16:48 2015
@@ -5086,13 +5086,9 @@ static EHFlags parseClangCLEHFlags(const
}
}
- // Only enable C++ exceptions if the user opts into it by passing
- // -fexceptions. Lots of build systems implicitly pass /EHsc when users don't
- // actually need it.
- // FIXME: Remove this when they work out of the box.
- if (!Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions,
- /*default=*/false))
- EH = EHFlags();
+ // FIXME: Disable C++ EH completely, until it becomes more reliable. Users
+ // can use -Xclang to manually enable C++ EH until then.
+ EH = EHFlags();
return EH;
}
Modified: cfe/trunk/test/Driver/cl-eh.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-eh.cpp?rev=242176&r1=242175&r2=242176&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-eh.cpp (original)
+++ cfe/trunk/test/Driver/cl-eh.cpp Tue Jul 14 13:16:48 2015
@@ -4,9 +4,7 @@
// 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 -fexceptions -### -- %s 2>&1 | FileCheck -check-prefix=EHscfex %s
-// EHscfex: "-fcxx-exceptions"
-// EHscfex: "-fexceptions"
+// FIXME: When C++ EH works, we can make this flag turn things back on.
// RUN: %clang_cl /c /EHsc -### -- %s 2>&1 | FileCheck -check-prefix=EHsc %s
// EHsc-NOT: "-fcxx-exceptions"
@@ -20,14 +18,14 @@
// EHs_EHc_-NOT: "-fcxx-exceptions"
// EHs_EHc_-NOT: "-fexceptions"
-// RUN: %clang_cl /c /EHs- /EHs -fexceptions -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHs %s
-// EHs_EHs: "-fcxx-exceptions"
-// EHs_EHs: "-fexceptions"
-
-// RUN: %clang_cl /c /EHs- /EHsa -fexceptions -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHa %s
-// EHs_EHa: "-fcxx-exceptions"
-// EHs_EHa: "-fexceptions"
+// RUN: %clang_cl /c /EHs- /EHs -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHs %s
+// EHs_EHs-NOT: "-fcxx-exceptions"
+// EHs_EHs-NOT: "-fexceptions"
+
+// RUN: %clang_cl /c /EHs- /EHsa -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHa %s
+// EHs_EHa-NOT: "-fcxx-exceptions"
+// EHs_EHa-NOT: "-fexceptions"
-// RUN: %clang_cl /c /EHinvalid -fexceptions -### -- %s 2>&1 | FileCheck -check-prefix=EHinvalid %s
+// RUN: %clang_cl /c /EHinvalid -### -- %s 2>&1 | FileCheck -check-prefix=EHinvalid %s
// EHinvalid: error: invalid value 'invalid' in '/EH'
// EHinvalid-NOT: error:
More information about the cfe-commits
mailing list