From: David Majnemer Date: Mon, 22 Feb 2016 17:44:51 +0000 (+0000) Subject: Don't enable /GX by default X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=20cd05eb619b939c94a00313140fc39286808919;p=clang Don't enable /GX by default The /GX flag is disabled unless explicitly specified on the command line. This partially addresses PR26698. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261537 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index fd647a484e..b04ef6c030 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -5813,8 +5813,10 @@ static EHFlags parseClangCLEHFlags(const Driver &D, const ArgList &Args) { } } // The /GX, /GX- flags are only processed if there are not /EH flags. + // The default is that /GX is not specified. if (EHArgs.empty() && - Args.hasFlag(options::OPT__SLASH_GX, options::OPT__SLASH_GX_)) { + Args.hasFlag(options::OPT__SLASH_GX, options::OPT__SLASH_GX_, + /*default=*/false)) { EH.Synch = true; EH.NoUnwindC = true; } diff --git a/test/Driver/cl-options.c b/test/Driver/cl-options.c index 0f9f9a4fcc..8a3cb4473e 100644 --- a/test/Driver/cl-options.c +++ b/test/Driver/cl-options.c @@ -211,6 +211,9 @@ // RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s // FI_: "-include" "asdf.h" +// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=NO-GX %s +// NO-GX-NOT: "-fcxx-exceptions" "-fexceptions" + // RUN: %clang_cl /c /GX -### -- %s 2>&1 | FileCheck -check-prefix=GX %s // GX: "-fcxx-exceptions" "-fexceptions"