This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG573255b47eb9: [clang][cli] Squash exception model in LangOptions into one member (authored by jansvoboda11).
Changed prior to commit: https://reviews.llvm.org/D93215?vs=311580&id=311831#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93215/new/ https://reviews.llvm.org/D93215 Files: clang/include/clang/Basic/LangOptions.def clang/include/clang/Basic/LangOptions.h clang/lib/Frontend/CompilerInvocation.cpp Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -2981,10 +2981,14 @@ Diags.Report(diag::err_fe_invalid_exception_model) << Opt.getName() << T.str(); - 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.WasmExceptions = Opt.matches(options::OPT_fwasm_exceptions); + if (Opt.matches(options::OPT_fsjlj_exceptions)) + Opts.setExceptionHandling(llvm::ExceptionHandling::SjLj); + else if (Opt.matches(options::OPT_fseh_exceptions)) + Opts.setExceptionHandling(llvm::ExceptionHandling::WinEH); + else if (Opt.matches(options::OPT_fdwarf_exceptions)) + Opts.setExceptionHandling(llvm::ExceptionHandling::DwarfCFI); + else if (Opt.matches(options::OPT_fwasm_exceptions)) + Opts.setExceptionHandling(llvm::ExceptionHandling::Wasm); } Opts.ExternCNoUnwind = Args.hasArg(OPT_fexternc_nounwind); Index: clang/include/clang/Basic/LangOptions.h =================================================================== --- clang/include/clang/Basic/LangOptions.h +++ clang/include/clang/Basic/LangOptions.h @@ -22,6 +22,7 @@ #include "llvm/ADT/FloatingPointMode.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" +#include "llvm/MC/MCTargetOptions.h" #include <string> #include <vector> @@ -209,6 +210,9 @@ FPE_Strict }; + /// Possible exception handling behavior. + using ExceptionHandlingKind = llvm::ExceptionHandling; + enum class LaxVectorConversionKind { /// Permit no implicit vector bitcasts. None, @@ -381,10 +385,21 @@ return getSignReturnAddressScope() == SignReturnAddressScopeKind::All; } - bool hasSjLjExceptions() const { return SjLjExceptions; } - bool hasSEHExceptions() const { return SEHExceptions; } - bool hasDWARFExceptions() const { return DWARFExceptions; } - bool hasWasmExceptions() const { return WasmExceptions; } + bool hasSjLjExceptions() const { + return getExceptionHandling() == llvm::ExceptionHandling::SjLj; + } + + bool hasSEHExceptions() const { + return getExceptionHandling() == llvm::ExceptionHandling::WinEH; + } + + bool hasDWARFExceptions() const { + return getExceptionHandling() == llvm::ExceptionHandling::DwarfCFI; + } + + bool hasWasmExceptions() const { + return getExceptionHandling() == llvm::ExceptionHandling::Wasm; + } }; /// Floating point control options Index: clang/include/clang/Basic/LangOptions.def =================================================================== --- clang/include/clang/Basic/LangOptions.def +++ clang/include/clang/Basic/LangOptions.def @@ -129,10 +129,8 @@ 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(WasmExceptions , 1, 0, "WebAssembly exception handling") +ENUM_LANGOPT(ExceptionHandling, ExceptionHandlingKind, 3, + ExceptionHandlingKind::None, "exception handling") LANGOPT(IgnoreExceptions , 1, 0, "ignore exceptions") LANGOPT(ExternCNoUnwind , 1, 0, "Assume extern C functions don't unwind") LANGOPT(TraditionalCPP , 1, 0, "traditional CPP emulation")
Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -2981,10 +2981,14 @@ Diags.Report(diag::err_fe_invalid_exception_model) << Opt.getName() << T.str(); - 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.WasmExceptions = Opt.matches(options::OPT_fwasm_exceptions); + if (Opt.matches(options::OPT_fsjlj_exceptions)) + Opts.setExceptionHandling(llvm::ExceptionHandling::SjLj); + else if (Opt.matches(options::OPT_fseh_exceptions)) + Opts.setExceptionHandling(llvm::ExceptionHandling::WinEH); + else if (Opt.matches(options::OPT_fdwarf_exceptions)) + Opts.setExceptionHandling(llvm::ExceptionHandling::DwarfCFI); + else if (Opt.matches(options::OPT_fwasm_exceptions)) + Opts.setExceptionHandling(llvm::ExceptionHandling::Wasm); } Opts.ExternCNoUnwind = Args.hasArg(OPT_fexternc_nounwind); Index: clang/include/clang/Basic/LangOptions.h =================================================================== --- clang/include/clang/Basic/LangOptions.h +++ clang/include/clang/Basic/LangOptions.h @@ -22,6 +22,7 @@ #include "llvm/ADT/FloatingPointMode.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" +#include "llvm/MC/MCTargetOptions.h" #include <string> #include <vector> @@ -209,6 +210,9 @@ FPE_Strict }; + /// Possible exception handling behavior. + using ExceptionHandlingKind = llvm::ExceptionHandling; + enum class LaxVectorConversionKind { /// Permit no implicit vector bitcasts. None, @@ -381,10 +385,21 @@ return getSignReturnAddressScope() == SignReturnAddressScopeKind::All; } - bool hasSjLjExceptions() const { return SjLjExceptions; } - bool hasSEHExceptions() const { return SEHExceptions; } - bool hasDWARFExceptions() const { return DWARFExceptions; } - bool hasWasmExceptions() const { return WasmExceptions; } + bool hasSjLjExceptions() const { + return getExceptionHandling() == llvm::ExceptionHandling::SjLj; + } + + bool hasSEHExceptions() const { + return getExceptionHandling() == llvm::ExceptionHandling::WinEH; + } + + bool hasDWARFExceptions() const { + return getExceptionHandling() == llvm::ExceptionHandling::DwarfCFI; + } + + bool hasWasmExceptions() const { + return getExceptionHandling() == llvm::ExceptionHandling::Wasm; + } }; /// Floating point control options Index: clang/include/clang/Basic/LangOptions.def =================================================================== --- clang/include/clang/Basic/LangOptions.def +++ clang/include/clang/Basic/LangOptions.def @@ -129,10 +129,8 @@ 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(WasmExceptions , 1, 0, "WebAssembly exception handling") +ENUM_LANGOPT(ExceptionHandling, ExceptionHandlingKind, 3, + ExceptionHandlingKind::None, "exception handling") LANGOPT(IgnoreExceptions , 1, 0, "ignore exceptions") LANGOPT(ExternCNoUnwind , 1, 0, "Assume extern C functions don't unwind") LANGOPT(TraditionalCPP , 1, 0, "traditional CPP emulation")
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits