From 2fa25706ed4bfd4184e15f38657636ff94e35745 Mon Sep 17 00:00:00 2001 From: Martell Malone Date: Wed, 29 Nov 2017 06:51:27 +0000 Subject: [PATCH] Revert "Toolchain: Normalize dwarf, sjlj and seh eh" This reverts rL319294. The windows sanitizer does not like seh on x86. Will re apply with None type for x86 llvm-svn: 319295 --- clang/docs/ClangCommandLineReference.rst | 8 ------ clang/include/clang/Basic/LangOptions.def | 2 -- clang/include/clang/Driver/Options.td | 4 --- clang/include/clang/Driver/ToolChain.h | 7 ++--- clang/lib/Basic/Targets/ARM.cpp | 1 + clang/lib/Basic/Targets/OSTargets.cpp | 4 +++ clang/lib/Basic/Targets/OSTargets.h | 11 ++++++++ clang/lib/Basic/Targets/X86.h | 13 ++++++++++ clang/lib/CodeGen/BackendUtil.cpp | 4 --- clang/lib/CodeGen/CGException.cpp | 16 +++++++----- clang/lib/Driver/ToolChain.cpp | 9 ------- clang/lib/Driver/ToolChains/Clang.cpp | 30 +++------------------- clang/lib/Driver/ToolChains/Darwin.cpp | 11 +++----- clang/lib/Driver/ToolChains/Darwin.h | 8 +++--- clang/lib/Driver/ToolChains/FreeBSD.cpp | 12 ++++----- clang/lib/Driver/ToolChains/FreeBSD.h | 3 +-- clang/lib/Driver/ToolChains/MinGW.cpp | 7 ++--- clang/lib/Driver/ToolChains/MinGW.h | 4 +-- clang/lib/Driver/ToolChains/NetBSD.cpp | 8 ------ clang/lib/Driver/ToolChains/NetBSD.h | 3 --- clang/lib/Frontend/CompilerInvocation.cpp | 13 +--------- clang/lib/Frontend/InitPreprocessor.cpp | 6 ----- clang/test/CodeGenCXX/mingw-w64-exceptions.c | 22 ---------------- clang/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp | 3 +-- clang/test/Preprocessor/arm-target-features.c | 2 -- clang/test/Preprocessor/init.c | 1 - 26 files changed, 64 insertions(+), 148 deletions(-) delete mode 100644 clang/test/CodeGenCXX/mingw-w64-exceptions.c diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst index 434297b..7596afa 100644 --- a/clang/docs/ClangCommandLineReference.rst +++ b/clang/docs/ClangCommandLineReference.rst @@ -1706,18 +1706,10 @@ Which overload candidates to show when overload resolution fails: best\|all; def Enable C++14 sized global deallocation functions -.. option:: -fdwarf-exceptions - -Use DWARF style exceptions - .. option:: -fsjlj-exceptions Use SjLj style exceptions -.. option:: -fseh-exceptions - -Use SEH style exceptions - .. option:: -fslp-vectorize, -fno-slp-vectorize, -ftree-slp-vectorize Enable the superword-level parallelism vectorization passes diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def index 5388c69..78a7437 100644 --- a/clang/include/clang/Basic/LangOptions.def +++ b/clang/include/clang/Basic/LangOptions.def @@ -124,9 +124,7 @@ LANGOPT(ZVector , 1, 0, "System z vector extensions") LANGOPT(Exceptions , 1, 0, "exception handling") LANGOPT(ObjCExceptions , 1, 0, "Objective-C exceptions") LANGOPT(CXXExceptions , 1, 0, "C++ exceptions") -LANGOPT(DWARFExceptions , 1, 0, "dwarf exception handling") LANGOPT(SjLjExceptions , 1, 0, "setjmp-longjump exception handling") -LANGOPT(SEHExceptions , 1, 0, "SEH .xdata exception handling") LANGOPT(ExternCNoUnwind , 1, 0, "Assume extern C functions don't unwind") LANGOPT(TraditionalCPP , 1, 0, "traditional CPP emulation") LANGOPT(RTTI , 1, 1, "run-time type information") diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 7082fd2..9f8684d 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -800,12 +800,8 @@ def fencoding_EQ : Joined<["-"], "fencoding=">, Group; def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group, Flags<[CoreOption]>; def fexceptions : Flag<["-"], "fexceptions">, Group, Flags<[CC1Option]>, HelpText<"Enable support for exception handling">; -def fdwarf_exceptions : Flag<["-"], "fdwarf-exceptions">, Group, - Flags<[CC1Option]>, HelpText<"Use DWARF style exceptions">; def fsjlj_exceptions : Flag<["-"], "fsjlj-exceptions">, Group, Flags<[CC1Option]>, HelpText<"Use SjLj style exceptions">; -def fseh_exceptions : Flag<["-"], "fseh-exceptions">, Group, - Flags<[CC1Option]>, HelpText<"Use SEH style exceptions">; def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">, Group; def : Flag<["-"], "fexpensive-optimizations">, Group; diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h index 95f1461..bd71038 100644 --- a/clang/include/clang/Driver/ToolChain.h +++ b/clang/include/clang/Driver/ToolChain.h @@ -397,9 +397,10 @@ public: return llvm::DebuggerKind::GDB; } - /// GetExceptionModel - Return the tool chain exception model. - virtual llvm::ExceptionHandling - GetExceptionModel(const llvm::opt::ArgList &Args) const; + /// UseSjLjExceptions - Does this tool chain use SjLj exceptions. + virtual bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const { + return false; + } /// SupportsEmbeddedBitcode - Does this tool chain support embedded bitcode. virtual bool SupportsEmbeddedBitcode() const { diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp index fe261b7..77b3f9a 100644 --- a/clang/lib/Basic/Targets/ARM.cpp +++ b/clang/lib/Basic/Targets/ARM.cpp @@ -1000,6 +1000,7 @@ void MinGWARMTargetInfo::getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { WindowsARMTargetInfo::getTargetDefines(Opts, Builder); Builder.defineMacro("_ARM_"); + Builder.defineMacro("__ARM_DWARF_EH__"); } CygwinARMTargetInfo::CygwinARMTargetInfo(const llvm::Triple &Triple, diff --git a/clang/lib/Basic/Targets/OSTargets.cpp b/clang/lib/Basic/Targets/OSTargets.cpp index 50abd4c..b01e682 100644 --- a/clang/lib/Basic/Targets/OSTargets.cpp +++ b/clang/lib/Basic/Targets/OSTargets.cpp @@ -133,6 +133,10 @@ void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts, if (Triple.isOSDarwin()) Builder.defineMacro("__MACH__"); + // The Watch ABI uses Dwarf EH. + if (Triple.isWatchABI()) + Builder.defineMacro("__ARM_DWARF_EH__"); + PlatformMinVersion = VersionTuple(Maj, Min, Rev); } } // namespace targets diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index d6c64b9..cf2905f 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -358,6 +358,17 @@ protected: Builder.defineMacro("__ELF__"); if (Opts.POSIXThreads) Builder.defineMacro("_REENTRANT"); + + switch (Triple.getArch()) { + default: + break; + case llvm::Triple::arm: + case llvm::Triple::armeb: + case llvm::Triple::thumb: + case llvm::Triple::thumbeb: + Builder.defineMacro("__ARM_DWARF_EH__"); + break; + } } public: diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index 5a4b6b5..8f4f5da 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -710,6 +710,15 @@ public: LongDoubleFormat = &llvm::APFloat::x87DoubleExtended(); HasFloat128 = true; } + + void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const override { + WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder); + + // GCC defines this macro when it is using __gxx_personality_seh0. + if (!Opts.SjLjExceptions) + Builder.defineMacro("__SEH__"); + } }; // x86-64 Cygwin target @@ -731,6 +740,10 @@ public: DefineStd(Builder, "unix", Opts); if (Opts.CPlusPlus) Builder.defineMacro("_GNU_SOURCE"); + + // GCC defines this macro when it is using __gxx_personality_seh0. + if (!Opts.SjLjExceptions) + Builder.defineMacro("__SEH__"); } }; diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 235ab2d..5a13f51 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -424,10 +424,6 @@ static void initTargetOptions(llvm::TargetOptions &Options, if (LangOpts.SjLjExceptions) Options.ExceptionModel = llvm::ExceptionHandling::SjLj; - if (LangOpts.SEHExceptions) - Options.ExceptionModel = llvm::ExceptionHandling::WinEH; - if (LangOpts.DWARFExceptions) - Options.ExceptionModel = llvm::ExceptionHandling::DwarfCFI; Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath; Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath; diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index d6a9538..6a421e8 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -112,11 +112,17 @@ EHPersonality::MSVC_C_specific_handler = { "__C_specific_handler", nullptr }; const EHPersonality EHPersonality::MSVC_CxxFrameHandler3 = { "__CxxFrameHandler3", nullptr }; +/// On Win64, use libgcc's SEH personality function. We fall back to dwarf on +/// other platforms, unless the user asked for SjLj exceptions. +static bool useLibGCCSEHPersonality(const llvm::Triple &T) { + return T.isOSWindows() && T.getArch() == llvm::Triple::x86_64; +} + static const EHPersonality &getCPersonality(const llvm::Triple &T, const LangOptions &L) { if (L.SjLjExceptions) return EHPersonality::GNU_C_SJLJ; - if (L.SEHExceptions) + else if (useLibGCCSEHPersonality(T)) return EHPersonality::GNU_C_SEH; return EHPersonality::GNU_C; } @@ -138,7 +144,7 @@ static const EHPersonality &getObjCPersonality(const llvm::Triple &T, case ObjCRuntime::ObjFW: if (L.SjLjExceptions) return EHPersonality::GNU_ObjC_SJLJ; - if (L.SEHExceptions) + else if (useLibGCCSEHPersonality(T)) return EHPersonality::GNU_ObjC_SEH; return EHPersonality::GNU_ObjC; } @@ -149,7 +155,7 @@ static const EHPersonality &getCXXPersonality(const llvm::Triple &T, const LangOptions &L) { if (L.SjLjExceptions) return EHPersonality::GNU_CPlusPlus_SJLJ; - if (L.SEHExceptions) + else if (useLibGCCSEHPersonality(T)) return EHPersonality::GNU_CPlusPlus_SEH; return EHPersonality::GNU_CPlusPlus; } @@ -205,10 +211,6 @@ const EHPersonality &EHPersonality::get(CodeGenModule &CGM, if (T.isWindowsMSVCEnvironment() && !L.ObjC1) { if (L.SjLjExceptions) return EHPersonality::GNU_CPlusPlus_SJLJ; - if (L.SEHExceptions) - return EHPersonality::GNU_CPlusPlus_SEH; - if (L.DWARFExceptions) - return EHPersonality::GNU_CPlusPlus; else return EHPersonality::MSVC_CxxFrameHandler3; } diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 256fbf5..741f428 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -27,8 +27,6 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" -#include "llvm/MC/MCAsmInfo.h" -#include "llvm/MC/MCRegisterInfo.h" #include "llvm/Support/TargetParser.h" #include "llvm/Support/TargetRegistry.h" @@ -451,13 +449,6 @@ ObjCRuntime ToolChain::getDefaultObjCRuntime(bool isNonFragile) const { VersionTuple()); } -llvm::ExceptionHandling -ToolChain::GetExceptionModel(const llvm::opt::ArgList &Args) const { - if (Triple.isOSWindows()) - return llvm::ExceptionHandling::WinEH; - return llvm::ExceptionHandling::None; -} - bool ToolChain::isThreadModelSupported(const StringRef Model) const { if (Model == "single") { // FIXME: 'single' is only supported on ARM and WebAssembly so far. diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 1c90c6e..d96664c 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4166,33 +4166,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, addExceptionArgs(Args, InputType, getToolChain(), KernelOrKext, Runtime, CmdArgs); - // Handle exception personalities - Arg *A = Args.getLastArg(options::OPT_fsjlj_exceptions, - options::OPT_fseh_exceptions, - options::OPT_fdwarf_exceptions); - if (A) { - const Option &Opt = A->getOption(); - if (Opt.matches(options::OPT_fsjlj_exceptions)) - CmdArgs.push_back("-fsjlj-exceptions"); - if (Opt.matches(options::OPT_fseh_exceptions)) - CmdArgs.push_back("-fseh-exceptions"); - if (Opt.matches(options::OPT_fdwarf_exceptions)) - CmdArgs.push_back("-fdwarf-exceptions"); - } else { - switch(getToolChain().GetExceptionModel(Args)) { - default: - break; - case llvm::ExceptionHandling::DwarfCFI: - CmdArgs.push_back("-fdwarf-exceptions"); - break; - case llvm::ExceptionHandling::SjLj: - CmdArgs.push_back("-fsjlj-exceptions"); - break; - case llvm::ExceptionHandling::WinEH: - CmdArgs.push_back("-fseh-exceptions"); - break; - } - } + if (Args.hasArg(options::OPT_fsjlj_exceptions) || + getToolChain().UseSjLjExceptions(Args)) + CmdArgs.push_back("-fsjlj-exceptions"); // C++ "sane" operator new. if (!Args.hasFlag(options::OPT_fassume_sane_operator_new, diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index 7c401aa..5dc8a91 100644 --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -1881,7 +1881,7 @@ bool MachO::IsUnwindTablesDefault(const ArgList &Args) const { // Unwind tables are not emitted if -fno-exceptions is supplied (except when // targeting x86_64). return getArch() == llvm::Triple::x86_64 || - (GetExceptionModel(Args) != llvm::ExceptionHandling::SjLj && + (!UseSjLjExceptions(Args) && Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions, true)); } @@ -1892,18 +1892,15 @@ bool MachO::UseDwarfDebugFlags() const { return false; } -llvm::ExceptionHandling Darwin::GetExceptionModel(const ArgList &Args) const { +bool Darwin::UseSjLjExceptions(const ArgList &Args) const { // Darwin uses SjLj exceptions on ARM. if (getTriple().getArch() != llvm::Triple::arm && getTriple().getArch() != llvm::Triple::thumb) - return llvm::ExceptionHandling::None; + return false; // Only watchOS uses the new DWARF/Compact unwinding method. llvm::Triple Triple(ComputeLLVMTriple(Args)); - if(Triple.isWatchABI()) - return llvm::ExceptionHandling::DwarfCFI; - - return llvm::ExceptionHandling::SjLj; + return !Triple.isWatchABI(); } bool Darwin::SupportsEmbeddedBitcode() const { diff --git a/clang/lib/Driver/ToolChains/Darwin.h b/clang/lib/Driver/ToolChains/Darwin.h index c861f17..2b8477a 100644 --- a/clang/lib/Driver/ToolChains/Darwin.h +++ b/clang/lib/Driver/ToolChains/Darwin.h @@ -247,9 +247,8 @@ public: bool UseDwarfDebugFlags() const override; - llvm::ExceptionHandling - GetExceptionModel(const llvm::opt::ArgList &Args) const override { - return llvm::ExceptionHandling::None; + bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override { + return false; } /// } @@ -456,8 +455,7 @@ public: void CheckObjCARC() const override; - llvm::ExceptionHandling GetExceptionModel( - const llvm::opt::ArgList &Args) const override; + bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override; bool SupportsEmbeddedBitcode() const override; diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp index 025acf1..2f066cf 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -359,17 +359,17 @@ Tool *FreeBSD::buildAssembler() const { Tool *FreeBSD::buildLinker() const { return new tools::freebsd::Linker(*this); } -llvm::ExceptionHandling FreeBSD::GetExceptionModel(const ArgList &Args) const { +bool FreeBSD::UseSjLjExceptions(const ArgList &Args) const { // FreeBSD uses SjLj exceptions on ARM oabi. switch (getTriple().getEnvironment()) { - default: - if (getTriple().getArch() == llvm::Triple::arm || - getTriple().getArch() == llvm::Triple::thumb) - return llvm::ExceptionHandling::SjLj; case llvm::Triple::GNUEABIHF: case llvm::Triple::GNUEABI: case llvm::Triple::EABI: - return llvm::ExceptionHandling::None; + return false; + + default: + return (getTriple().getArch() == llvm::Triple::arm || + getTriple().getArch() == llvm::Triple::thumb); } } diff --git a/clang/lib/Driver/ToolChains/FreeBSD.h b/clang/lib/Driver/ToolChains/FreeBSD.h index 2943e1c..25e9df7 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.h +++ b/clang/lib/Driver/ToolChains/FreeBSD.h @@ -66,8 +66,7 @@ public: void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const override; - llvm::ExceptionHandling GetExceptionModel( - const llvm::opt::ArgList &Args) const override; + bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override; bool isPIEDefault() const override; SanitizerMask getSupportedSanitizers() const override; unsigned GetDefaultDwarfVersion() const override { return 2; } diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp index 572ea80..79864ea 100644 --- a/clang/lib/Driver/ToolChains/MinGW.cpp +++ b/clang/lib/Driver/ToolChains/MinGW.cpp @@ -367,11 +367,8 @@ bool toolchains::MinGW::isPICDefaultForced() const { return getArch() == llvm::Triple::x86_64; } -llvm::ExceptionHandling -toolchains::MinGW::GetExceptionModel(const ArgList &Args) const { - if (getArch() == llvm::Triple::x86_64) - return llvm::ExceptionHandling::WinEH; - return llvm::ExceptionHandling::DwarfCFI; +bool toolchains::MinGW::UseSEHExceptions() const { + return getArch() == llvm::Triple::x86_64; } void toolchains::MinGW::AddCudaIncludeArgs(const ArgList &DriverArgs, diff --git a/clang/lib/Driver/ToolChains/MinGW.h b/clang/lib/Driver/ToolChains/MinGW.h index f8dbcae..9b3d7c5 100644 --- a/clang/lib/Driver/ToolChains/MinGW.h +++ b/clang/lib/Driver/ToolChains/MinGW.h @@ -64,9 +64,7 @@ public: bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; - - llvm::ExceptionHandling GetExceptionModel( - const llvm::opt::ArgList &Args) const override; + bool UseSEHExceptions() const; void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp b/clang/lib/Driver/ToolChains/NetBSD.cpp index c0a0808..85bb69c 100644 --- a/clang/lib/Driver/ToolChains/NetBSD.cpp +++ b/clang/lib/Driver/ToolChains/NetBSD.cpp @@ -416,14 +416,6 @@ void NetBSD::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, "", DriverArgs, CC1Args); } -llvm::ExceptionHandling NetBSD::GetExceptionModel(const ArgList &Args) const { - // NetBSD uses Dwarf exceptions on ARM. - if (getTriple().getArch() == llvm::Triple::arm || - getTriple().getArch() == llvm::Triple::thumb) - return llvm::ExceptionHandling::DwarfCFI; - return llvm::ExceptionHandling::None; -} - SanitizerMask NetBSD::getSupportedSanitizers() const { const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64; diff --git a/clang/lib/Driver/ToolChains/NetBSD.h b/clang/lib/Driver/ToolChains/NetBSD.h index e98df72..5163ff7 100644 --- a/clang/lib/Driver/ToolChains/NetBSD.h +++ b/clang/lib/Driver/ToolChains/NetBSD.h @@ -69,9 +69,6 @@ public: return true; } - llvm::ExceptionHandling GetExceptionModel( - const llvm::opt::ArgList &Args) const override; - SanitizerMask getSupportedSanitizers() const override; protected: diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index cdd5360..3d48417 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -2141,18 +2141,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.Exceptions = Args.hasArg(OPT_fexceptions); Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions); Opts.CXXExceptions = Args.hasArg(OPT_fcxx_exceptions); - - // Handle exception personalities - Arg *A = Args.getLastArg(options::OPT_fsjlj_exceptions, - options::OPT_fseh_exceptions, - options::OPT_fdwarf_exceptions); - if (A) { - const Option &Opt = A->getOption(); - Opts.SjLjExceptions = Opt.matches(options::OPT_fsjlj_exceptions); - Opts.SEHExceptions = Opt.matches(options::OPT_fseh_exceptions); - Opts.DWARFExceptions = Opt.matches(options::OPT_fdwarf_exceptions); - } - + Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions); Opts.ExternCNoUnwind = Args.hasArg(OPT_fexternc_nounwind); Opts.TraditionalCPP = Args.hasArg(OPT_traditional_cpp); diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 67c1fad..1dfbf18 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -677,14 +677,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__EXCEPTIONS"); if (!LangOpts.MSVCCompat && LangOpts.RTTI) Builder.defineMacro("__GXX_RTTI"); - if (LangOpts.SjLjExceptions) Builder.defineMacro("__USING_SJLJ_EXCEPTIONS__"); - else if (LangOpts.SEHExceptions) - Builder.defineMacro("__SEH__"); - else if (LangOpts.DWARFExceptions && - (TI.getTriple().isThumb() || TI.getTriple().isARM())) - Builder.defineMacro("__ARM_DWARF_EH__"); if (LangOpts.Deprecated) Builder.defineMacro("__DEPRECATED"); diff --git a/clang/test/CodeGenCXX/mingw-w64-exceptions.c b/clang/test/CodeGenCXX/mingw-w64-exceptions.c deleted file mode 100644 index e980ebd..0000000 --- a/clang/test/CodeGenCXX/mingw-w64-exceptions.c +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: %clang -target x86_64-windows-gnu -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SEH -// RUN: %clang -target i686-windows-gnu -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DWARF - -// RUN: %clang -target x86_64-windows-gnu -fsjlj-exceptions -c %s -### 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-SJLJ - -// RUN: %clang -target x86_64-windows-gnu -fdwarf-exceptions -c %s -### 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-DWARF - -// RUN: %clang -target x86_64-windows-gnu -fsjlj-exceptions -fseh-exceptions -c %s -### 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-SEH - -// RUN: %clang -target x86_64-windows-gnu -fseh-exceptions -fsjlj-exceptions -c %s -### 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-SJLJ - -// RUN: %clang -target x86_64-windows-gnu -fseh-exceptions -fdwarf-exceptions -c %s -### 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-DWARF - -// CHECK-SEH: "-fseh-exceptions" -// CHECK-SJLJ: "-fsjlj-exceptions" -// CHECK-DWARF-NOT: "-fsjlj-exceptions" -// CHECK-DWARF-NOT: "-fseh-exceptions" diff --git a/clang/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp b/clang/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp index 046c4a8..9025f87 100644 --- a/clang/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp +++ b/clang/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 %s -fexceptions -fseh-exceptions -emit-llvm -triple x86_64-w64-windows-gnu -o - | FileCheck %s --check-prefix=X64 -// RUN: %clang_cc1 %s -fexceptions -fdwarf-exceptions -emit-llvm -triple i686-w64-windows-gnu -o - | FileCheck %s --check-prefix=X86 +// RUN: %clang_cc1 %s -fexceptions -emit-llvm -triple x86_64-w64-windows-gnu -o - | FileCheck %s --check-prefix=X64 // RUN: %clang_cc1 %s -fexceptions -emit-llvm -triple i686-w64-windows-gnu -o - | FileCheck %s --check-prefix=X86 extern "C" void foo(); diff --git a/clang/test/Preprocessor/arm-target-features.c b/clang/test/Preprocessor/arm-target-features.c index 0067e10..b206e1c 100644 --- a/clang/test/Preprocessor/arm-target-features.c +++ b/clang/test/Preprocessor/arm-target-features.c @@ -214,7 +214,6 @@ // A5:#define __ARM_ARCH_7A__ 1 // A5-NOT:#define __ARM_ARCH_EXT_IDIV__ // A5:#define __ARM_ARCH_PROFILE 'A' -// A5-NOT:#define __ARM_DWARF_EH__ 1 // A5-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING // A5:#define __ARM_FEATURE_DSP 1 // A5-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN @@ -226,7 +225,6 @@ // A7:#define __ARM_ARCH 7 // A7:#define __ARM_ARCH_EXT_IDIV__ 1 // A7:#define __ARM_ARCH_PROFILE 'A' -// A7-NOT:#define __ARM_DWARF_EH__ 1 // A7:#define __ARM_FEATURE_DSP 1 // A7:#define __ARM_FP 0xE diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c index f767c7a..5fc568e 100644 --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -1442,7 +1442,6 @@ // // ARM-MSVC: #define _M_ARM_NT 1 // ARM-MSVC: #define _WIN32 1 -// ARM-MSVC-NOT:#define __ARM_DWARF_EH__ 1 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-windows-msvc < /dev/null | FileCheck -match-full-lines -check-prefix AARCH64-MSVC %s // -- 2.7.4