aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGException.cpp
diff options
context:
space:
mode:
authorjasonliu <jasonliu.development@gmail.com>2020-02-11 09:52:56 +0000
committerjasonliu <jasonliu.development@gmail.com>2020-02-12 09:56:18 +0000
commit55e2678fcd4d7eca3f9a602a919da499c1103041 (patch)
treeb0123eaff54b9b56849327e2382d391fe1dd821e /clang/lib/CodeGen/CGException.cpp
parentfa74b31a3e9cd844c7ce2087978568e3f5ec8519 (diff)
downloadllvm-55e2678fcd4d7eca3f9a602a919da499c1103041.zip
llvm-55e2678fcd4d7eca3f9a602a919da499c1103041.tar.gz
llvm-55e2678fcd4d7eca3f9a602a919da499c1103041.tar.bz2
[clang] Add -fignore-exceptions
Summary: This is trying to implement the functionality proposed in: http://lists.llvm.org/pipermail/cfe-dev/2017-April/053417.html An exception can throw, but no cleanup is going to happen. A module compiled with exceptions on, can catch the exception throws from module compiled with -fignore-exceptions. The use cases for enabling this option are: 1. Performance analysis of EH instrumentation overhead 2. The ability to QA non EH functionality when EH functionality is not available. 3. User of EH enabled headers knows the calls won't throw in their program and wants the performance gain from ignoring EH construct. The implementation tried to accomplish that by removing any landing pad code that might get generated. Reviewed by: aaron.ballman Differential Revision: https://reviews.llvm.org/D72644
Diffstat (limited to 'clang/lib/CodeGen/CGException.cpp')
-rw-r--r--clang/lib/CodeGen/CGException.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp
index fffd989..a542c3d 100644
--- a/clang/lib/CodeGen/CGException.cpp
+++ b/clang/lib/CodeGen/CGException.cpp
@@ -703,12 +703,12 @@ llvm::BasicBlock *CodeGenFunction::getInvokeDestImpl() {
assert(EHStack.requiresLandingPad());
assert(!EHStack.empty());
- // If exceptions are disabled and SEH is not in use, then there is no invoke
- // destination. SEH "works" even if exceptions are off. In practice, this
- // means that C++ destructors and other EH cleanups don't run, which is
+ // If exceptions are disabled/ignored and SEH is not in use, then there is no
+ // invoke destination. SEH "works" even if exceptions are off. In practice,
+ // this means that C++ destructors and other EH cleanups don't run, which is
// consistent with MSVC's behavior.
const LangOptions &LO = CGM.getLangOpts();
- if (!LO.Exceptions) {
+ if (!LO.Exceptions || LO.IgnoreExceptions) {
if (!LO.Borland && !LO.MicrosoftExt)
return nullptr;
if (!currentFunctionUsesSEHTry())
@@ -751,7 +751,9 @@ llvm::BasicBlock *CodeGenFunction::getInvokeDestImpl() {
llvm::BasicBlock *CodeGenFunction::EmitLandingPad() {
assert(EHStack.requiresLandingPad());
-
+ assert(!CGM.getLangOpts().IgnoreExceptions &&
+ "LandingPad should not be emitted when -fignore-exceptions are in "
+ "effect.");
EHScope &innermostEHScope = *EHStack.find(EHStack.getInnermostEHScope());
switch (innermostEHScope.getKind()) {
case EHScope::Terminate: