From: David Majnemer Date: Mon, 29 Feb 2016 01:40:30 +0000 (+0000) Subject: [clang-cl] /EHc should not have an effect on /EHa X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=387fccd8dad1ab16f4d7332e8462b88bcbb2b26e;p=platform%2Fupstream%2Fllvm.git [clang-cl] /EHc should not have an effect on /EHa This matches behavior with MSVC. llvm-svn: 262197 --- diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index d81b0ae..2841dab 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -5829,12 +5829,16 @@ static EHFlags parseClangCLEHFlags(const Driver &D, const ArgList &Args) { switch (EHVal[I]) { case 'a': EH.Asynch = maybeConsumeDash(EHVal, I); + if (EH.Asynch) + EH.Synch = false; continue; case 'c': EH.NoUnwindC = maybeConsumeDash(EHVal, I); continue; case 's': EH.Synch = maybeConsumeDash(EHVal, I); + if (EH.Synch) + EH.Asynch = false; continue; default: break; @@ -5932,7 +5936,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs, if (EH.Synch || EH.Asynch) { CmdArgs.push_back("-fcxx-exceptions"); CmdArgs.push_back("-fexceptions"); - if (EH.NoUnwindC) + if (EH.Synch && EH.NoUnwindC) CmdArgs.push_back("-fexternc-nounwind"); } diff --git a/clang/test/Driver/cl-eh.cpp b/clang/test/Driver/cl-eh.cpp index 1745616..c54544b 100644 --- a/clang/test/Driver/cl-eh.cpp +++ b/clang/test/Driver/cl-eh.cpp @@ -21,6 +21,11 @@ // EHs_EHa: "-fcxx-exceptions" // EHs_EHa: "-fexceptions" +// RUN: %clang_cl /c /EHa /EHc -### -- %s 2>&1 | FileCheck -check-prefix=EHa_EHc %s +// EHa_EHc: "-fcxx-exceptions" +// EHa_EHc: "-fexceptions" +// EHa_EHc-NOT: "-fexternc-nounwind" + // RUN: %clang_cl /c /EHinvalid -### -- %s 2>&1 | FileCheck -check-prefix=EHinvalid %s // EHinvalid: error: invalid value 'invalid' in '/EH' // EHinvalid-NOT: error: