From 0761e44550f094633bbe7fd4ae1d79ec456fca69 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Wed, 23 Feb 2011 03:16:42 +0000 Subject: [PATCH] Add a -fcxx-exceptions flag to clang -cc1. This controls the newly added CXXExceptions flag. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126300 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/CC1Options.td | 6 ++++-- lib/Frontend/CompilerInvocation.cpp | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 8d56a4230e..d5e4d00c7f 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -418,10 +418,12 @@ def fblocks : Flag<"-fblocks">, def fheinous_gnu_extensions : Flag<"-fheinous-gnu-extensions">; def fexceptions : Flag<"-fexceptions">, HelpText<"Enable support for exception handling">; +def fobjc_exceptions : Flag<"-fobjc-exceptions">, + HelpText<"Enable Objective-C exceptions">; +def fcxx_exceptions : Flag<"-fcxx-exceptions">, + HelpText<"Enable C++ exceptions">; def fsjlj_exceptions : Flag<"-fsjlj-exceptions">, HelpText<"Use SjLj style exceptions">; -def fobjc_exceptions : Flag<"-fobjc-exceptions">, - HelpText<"Disable Objective-C exceptions">; def ffreestanding : Flag<"-ffreestanding">, HelpText<"Assert that the compilation takes place in a freestanding environment">; def fgnu_runtime : Flag<"-fgnu-runtime">, diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 17daca8a7b..026508ac0e 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -585,10 +585,12 @@ static void LangOptsToArgs(const LangOptions &Opts, Res.push_back("-faltivec"); if (Opts.Exceptions) Res.push_back("-fexceptions"); + if (Opts.ObjCExceptions) + Res.push_back("-fobjc-exceptions"); + if (Opts.CXXExceptions) + Res.push_back("-fcxx-exceptions"); if (Opts.SjLjExceptions) Res.push_back("-fsjlj-exceptions"); - if (!Opts.ObjCExceptions) - Res.push_back("-fno-objc-exceptions"); if (!Opts.RTTI) Res.push_back("-fno-rtti"); if (Opts.MSBitfields) @@ -1456,6 +1458,9 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.ThreadsafeStatics = 0; Opts.Exceptions = Args.hasArg(OPT_fexceptions); Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions); + Opts.CXXExceptions = Args.hasArg(OPT_fcxx_exceptions); + Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions); + Opts.RTTI = !Args.hasArg(OPT_fno_rtti); Opts.Blocks = Args.hasArg(OPT_fblocks); Opts.CharIsSigned = !Args.hasArg(OPT_fno_signed_char); @@ -1484,8 +1489,6 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.CatchUndefined = Args.hasArg(OPT_fcatch_undefined_behavior); Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls); Opts.PICLevel = Args.getLastArgIntValue(OPT_pic_level, 0, Diags); - Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions); - Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions); Opts.Static = Args.hasArg(OPT_static_define); Opts.DumpRecordLayouts = Args.hasArg(OPT_fdump_record_layouts); Opts.DumpVTableLayouts = Args.hasArg(OPT_fdump_vtable_layouts); -- 2.40.0