зеркало из https://github.com/microsoft/clang.git
[MSVC Compat] Add support for /GX, /GX-
These are legacy flags which map to /EHsc and /EHs-c- respectively. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261424 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
aed82c0255
Коммит
bc29610042
|
@ -205,6 +205,10 @@ def _SLASH_Fi : CLCompileJoined<"Fi">,
|
|||
def _SLASH_Fo : CLCompileJoined<"Fo">,
|
||||
HelpText<"Set output object file, or directory (ends in / or \\) (with /c)">,
|
||||
MetaVarName<"<file or directory>">;
|
||||
def _SLASH_GX : CLFlag<"GX">,
|
||||
HelpText<"Enable exception handling">;
|
||||
def _SLASH_GX_ : CLFlag<"GX-">,
|
||||
HelpText<"Enable exception handling">;
|
||||
def _SLASH_LD : CLFlag<"LD">, HelpText<"Create DLL">;
|
||||
def _SLASH_LDd : CLFlag<"LDd">, HelpText<"Create debug DLL">;
|
||||
def _SLASH_link : CLRemainingArgs<"link">,
|
||||
|
@ -308,7 +312,6 @@ def _SLASH_Gr : CLFlag<"Gr">;
|
|||
def _SLASH_GS : CLFlag<"GS">;
|
||||
def _SLASH_GT : CLFlag<"GT">;
|
||||
def _SLASH_Guard : CLJoined<"guard:">;
|
||||
def _SLASH_GX : CLFlag<"GX">;
|
||||
def _SLASH_Gv : CLFlag<"Gv">;
|
||||
def _SLASH_Gz : CLFlag<"Gz">;
|
||||
def _SLASH_GZ : CLFlag<"GZ">;
|
||||
|
|
|
@ -5775,10 +5775,9 @@ static bool maybeConsumeDash(const std::string &EH, size_t &I) {
|
|||
|
||||
namespace {
|
||||
struct EHFlags {
|
||||
EHFlags() : Synch(false), Asynch(false), NoExceptC(false) {}
|
||||
bool Synch;
|
||||
bool Asynch;
|
||||
bool NoExceptC;
|
||||
bool Synch = false;
|
||||
bool Asynch = false;
|
||||
bool NoUnwindC = false;
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
|
@ -5802,7 +5801,7 @@ static EHFlags parseClangCLEHFlags(const Driver &D, const ArgList &Args) {
|
|||
EH.Asynch = maybeConsumeDash(EHVal, I);
|
||||
continue;
|
||||
case 'c':
|
||||
EH.NoExceptC = maybeConsumeDash(EHVal, I);
|
||||
EH.NoUnwindC = maybeConsumeDash(EHVal, I);
|
||||
continue;
|
||||
case 's':
|
||||
EH.Synch = maybeConsumeDash(EHVal, I);
|
||||
|
@ -5814,6 +5813,12 @@ static EHFlags parseClangCLEHFlags(const Driver &D, const ArgList &Args) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
// The /GX, /GX- flags are only processed if there are not /EH flags.
|
||||
if (EHArgs.empty() &&
|
||||
Args.hasFlag(options::OPT__SLASH_GX, options::OPT__SLASH_GX_)) {
|
||||
EH.Synch = true;
|
||||
EH.NoUnwindC = true;
|
||||
}
|
||||
|
||||
return EH;
|
||||
}
|
||||
|
@ -9704,6 +9709,8 @@ std::unique_ptr<Command> visualstudio::Compiler::GetCommand(
|
|||
// Flags that can simply be passed through.
|
||||
Args.AddAllArgs(CmdArgs, options::OPT__SLASH_LD);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT__SLASH_LDd);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT__SLASH_GX);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT__SLASH_GX_);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT__SLASH_EH);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT__SLASH_Zl);
|
||||
|
||||
|
|
|
@ -211,6 +211,12 @@
|
|||
// RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s
|
||||
// FI_: "-include" "asdf.h"
|
||||
|
||||
// RUN: %clang_cl /c /GX -### -- %s 2>&1 | FileCheck -check-prefix=GX %s
|
||||
// GX: "-fcxx-exceptions" "-fexceptions"
|
||||
|
||||
// RUN: %clang_cl /c /GX /GX- -### -- %s 2>&1 | FileCheck -check-prefix=GX_ %s
|
||||
// GX_-NOT: "-fcxx-exceptions" "-fexceptions"
|
||||
|
||||
// We forward any unrecognized -W diagnostic options to cc1.
|
||||
// RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s
|
||||
// WJoined: "-cc1"
|
||||
|
|
Загрузка…
Ссылка в новой задаче