diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2016-02-29 01:40:36 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2016-02-29 01:40:36 +0000 |
| commit | cd5855e3549eebbf2a22d31b37f36d223c4c7b62 (patch) | |
| tree | 2e2885e4d9f404f48923f7d0f87ded7ff0c4490a /clang/lib/Driver | |
| parent | 387fccd8dad1ab16f4d7332e8462b88bcbb2b26e (diff) | |
| download | bcm5719-llvm-cd5855e3549eebbf2a22d31b37f36d223c4c7b62.tar.gz bcm5719-llvm-cd5855e3549eebbf2a22d31b37f36d223c4c7b62.zip | |
[clang-cl] /EHc should not effect functions with explicit exception specifications
Functions with an explicit exception specification have their behavior
dictated by the specification. The additional /EHc behavior only comes
into play if no exception specification is given.
llvm-svn: 262198
Diffstat (limited to 'clang/lib/Driver')
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 14 | ||||
| -rw-r--r-- | clang/lib/Driver/Tools.h | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 2841dab169e..e5dbe9bae0c 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -4119,8 +4119,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, bool EmitCodeView = false; // Add clang-cl arguments. + types::ID InputType = Input.getType(); if (getToolChain().getDriver().IsCLMode()) - AddClangCLArgs(Args, CmdArgs, &DebugInfoKind, &EmitCodeView); + AddClangCLArgs(Args, InputType, CmdArgs, &DebugInfoKind, &EmitCodeView); // Pass the linker version in use. if (Arg *A = Args.getLastArg(options::OPT_mlinker_version_EQ)) { @@ -4133,7 +4134,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // Explicitly error on some things we know we don't support and can't just // ignore. - types::ID InputType = Input.getType(); if (!Args.hasArg(options::OPT_fallow_unsupported)) { Arg *Unsupported; if (types::isCXX(InputType) && getToolChain().getTriple().isOSDarwin() && @@ -5859,7 +5859,8 @@ static EHFlags parseClangCLEHFlags(const Driver &D, const ArgList &Args) { return EH; } -void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs, +void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType, + ArgStringList &CmdArgs, codegenoptions::DebugInfoKind *DebugInfoKind, bool *EmitCodeView) const { unsigned RTOptionID = options::OPT__SLASH_MT; @@ -5934,11 +5935,12 @@ void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs, const Driver &D = getToolChain().getDriver(); EHFlags EH = parseClangCLEHFlags(D, Args); if (EH.Synch || EH.Asynch) { - CmdArgs.push_back("-fcxx-exceptions"); + if (types::isCXX(InputType)) + CmdArgs.push_back("-fcxx-exceptions"); CmdArgs.push_back("-fexceptions"); - if (EH.Synch && EH.NoUnwindC) - CmdArgs.push_back("-fexternc-nounwind"); } + if (types::isCXX(InputType) && EH.Synch && EH.NoUnwindC) + CmdArgs.push_back("-fexternc-nounwind"); // /EP should expand to -E -P. if (Args.hasArg(options::OPT__SLASH_EP)) { diff --git a/clang/lib/Driver/Tools.h b/clang/lib/Driver/Tools.h index 1d348bbbd68..6884cd42f3b 100644 --- a/clang/lib/Driver/Tools.h +++ b/clang/lib/Driver/Tools.h @@ -91,7 +91,7 @@ private: llvm::opt::ArgStringList &cmdArgs, RewriteKind rewrite) const; - void AddClangCLArgs(const llvm::opt::ArgList &Args, + void AddClangCLArgs(const llvm::opt::ArgList &Args, types::ID InputType, llvm::opt::ArgStringList &CmdArgs, codegenoptions::DebugInfoKind *DebugInfoKind, bool *EmitCodeView) const; |

