diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index fd647a484e68..b04ef6c03090 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/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/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 0f9f9a4fcc07..8a3cb4473e69 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/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"