diff options
Diffstat (limited to 'clang/lib/CodeGen/CGException.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 6a421e81dff..d6a9538bc1f 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -112,17 +112,11 @@ 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; - else if (useLibGCCSEHPersonality(T)) + if (L.SEHExceptions) return EHPersonality::GNU_C_SEH; return EHPersonality::GNU_C; } @@ -144,7 +138,7 @@ static const EHPersonality &getObjCPersonality(const llvm::Triple &T, case ObjCRuntime::ObjFW: if (L.SjLjExceptions) return EHPersonality::GNU_ObjC_SJLJ; - else if (useLibGCCSEHPersonality(T)) + if (L.SEHExceptions) return EHPersonality::GNU_ObjC_SEH; return EHPersonality::GNU_ObjC; } @@ -155,7 +149,7 @@ static const EHPersonality &getCXXPersonality(const llvm::Triple &T, const LangOptions &L) { if (L.SjLjExceptions) return EHPersonality::GNU_CPlusPlus_SJLJ; - else if (useLibGCCSEHPersonality(T)) + if (L.SEHExceptions) return EHPersonality::GNU_CPlusPlus_SEH; return EHPersonality::GNU_CPlusPlus; } @@ -211,6 +205,10 @@ 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; } |