diff options
author | Heejin Ahn <aheejin@gmail.com> | 2018-06-01 01:01:37 +0000 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2018-06-01 01:01:37 +0000 |
commit | 1eb074d76e2fb2d6b2d686cbaaedc8e0f1a09f11 (patch) | |
tree | f63100f8eb6685cdf334ca75834c314a0bb01609 /clang/lib/CodeGen/CGException.cpp | |
parent | d781d97ed45259809bc19d97a77fde508e2a036d (diff) | |
download | bcm5719-llvm-1eb074d76e2fb2d6b2d686cbaaedc8e0f1a09f11.tar.gz bcm5719-llvm-1eb074d76e2fb2d6b2d686cbaaedc8e0f1a09f11.zip |
[WebAssembly] Hide new Wasm EH behind its feature flag
Summary:
clang's current wasm EH implementation is a non-MVP feature in progress.
We had a `-mexception-handling` wasm feature but were not using it. This
patch hides the non-MVP wasm EH behind a flag, so it does not affect
other code for now.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits
Differential Revision: https://reviews.llvm.org/D47614
llvm-svn: 333716
Diffstat (limited to 'clang/lib/CodeGen/CGException.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index d38de341340..769b615cd42 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -154,7 +154,8 @@ static const EHPersonality &getObjCPersonality(const llvm::Triple &T, } static const EHPersonality &getCXXPersonality(const llvm::Triple &T, - const LangOptions &L) { + const LangOptions &L, + const TargetInfo &Target) { if (L.SjLjExceptions) return EHPersonality::GNU_CPlusPlus_SJLJ; if (L.DWARFExceptions) @@ -163,8 +164,10 @@ static const EHPersonality &getCXXPersonality(const llvm::Triple &T, return EHPersonality::MSVC_CxxFrameHandler3; if (L.SEHExceptions) return EHPersonality::GNU_CPlusPlus_SEH; - if (T.getArch() == llvm::Triple::wasm32 || - T.getArch() == llvm::Triple::wasm64) + // Wasm EH is a non-MVP feature for now. + if (Target.hasFeature("exception-handling") && + (T.getArch() == llvm::Triple::wasm32 || + T.getArch() == llvm::Triple::wasm64)) return EHPersonality::GNU_Wasm_CPlusPlus; return EHPersonality::GNU_CPlusPlus; } @@ -172,12 +175,13 @@ static const EHPersonality &getCXXPersonality(const llvm::Triple &T, /// Determines the personality function to use when both C++ /// and Objective-C exceptions are being caught. static const EHPersonality &getObjCXXPersonality(const llvm::Triple &T, - const LangOptions &L) { + const LangOptions &L, + const TargetInfo &Target) { switch (L.ObjCRuntime.getKind()) { // In the fragile ABI, just use C++ exception handling and hope // they're not doing crazy exception mixing. case ObjCRuntime::FragileMacOSX: - return getCXXPersonality(T, L); + return getCXXPersonality(T, L, Target); // The ObjC personality defers to the C++ personality for non-ObjC // handlers. Unlike the C++ case, we use the same personality @@ -209,14 +213,16 @@ const EHPersonality &EHPersonality::get(CodeGenModule &CGM, const FunctionDecl *FD) { const llvm::Triple &T = CGM.getTarget().getTriple(); const LangOptions &L = CGM.getLangOpts(); + const TargetInfo &Target = CGM.getTarget(); // Functions using SEH get an SEH personality. if (FD && FD->usesSEHTry()) return getSEHPersonalityMSVC(T); if (L.ObjC1) - return L.CPlusPlus ? getObjCXXPersonality(T, L) : getObjCPersonality(T, L); - return L.CPlusPlus ? getCXXPersonality(T, L) : getCPersonality(T, L); + return L.CPlusPlus ? getObjCXXPersonality(T, L, Target) + : getObjCPersonality(T, L); + return L.CPlusPlus ? getCXXPersonality(T, L, Target) : getCPersonality(T, L); } const EHPersonality &EHPersonality::get(CodeGenFunction &CGF) { @@ -313,7 +319,7 @@ void CodeGenModule::SimplifyPersonality() { const EHPersonality &ObjCXX = EHPersonality::get(*this, /*FD=*/nullptr); const EHPersonality &CXX = - getCXXPersonality(getTarget().getTriple(), LangOpts); + getCXXPersonality(getTarget().getTriple(), LangOpts, getTarget()); if (&ObjCXX == &CXX) return; |