summaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorLogan Chien <tzuhsiang.chien@gmail.com>2014-05-14 16:38:30 +0000
committerLogan Chien <tzuhsiang.chien@gmail.com>2014-05-14 16:38:30 +0000
commitf5864fffc37321ddee81301740c9faaf94d5e6a3 (patch)
treec355b0d3d972d16ffbe54a24fb632159c38195b3 /lib/CodeGen/AsmPrinter
parentbb5d9acac77f97e7c93de20ffe0a2eaf6eafd4e2 (diff)
downloadllvm-f5864fffc37321ddee81301740c9faaf94d5e6a3.tar.gz
llvm-f5864fffc37321ddee81301740c9faaf94d5e6a3.tar.bz2
llvm-f5864fffc37321ddee81301740c9faaf94d5e6a3.tar.xz
Fix ARM EHABI when function has landingpad and nounwind.
If the function has the landingpad instruction, then the handlerdata should be emitted even if the function has nouwnind attribute. Otherwise, following code will not work: void test1() noexcept { try { throw_exception(); } catch (...) { log_unexpected_exception(); } } Since the cantunwind was incorrectly emitted and the LSDA is not available. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208791 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter')
-rw-r--r--lib/CodeGen/AsmPrinter/ARMException.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/CodeGen/AsmPrinter/ARMException.cpp b/lib/CodeGen/AsmPrinter/ARMException.cpp
index 97b288f194..1cb0159d10 100644
--- a/lib/CodeGen/AsmPrinter/ARMException.cpp
+++ b/lib/CodeGen/AsmPrinter/ARMException.cpp
@@ -59,9 +59,8 @@ void ARMException::endModule() {
void ARMException::beginFunction(const MachineFunction *MF) {
if (Asm->MAI->getExceptionHandlingType() == ExceptionHandling::ARM)
getTargetStreamer().emitFnStart();
- if (Asm->MF->getFunction()->needsUnwindTableEntry())
- Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
- Asm->getFunctionNumber()));
+ Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
+ Asm->getFunctionNumber()));
// See if we need call frame info.
AsmPrinter::CFIMoveType MoveType = Asm->needsCFIMoves();
assert(MoveType != AsmPrinter::CFI_M_EH &&
@@ -78,16 +77,16 @@ void ARMException::endFunction(const MachineFunction *) {
if (shouldEmitCFI)
Asm->OutStreamer.EmitCFIEndProc();
+ // Map all labels and get rid of any dead landing pads.
+ MMI->TidyLandingPads();
+
ARMTargetStreamer &ATS = getTargetStreamer();
- if (!Asm->MF->getFunction()->needsUnwindTableEntry())
+ if (!Asm->MF->getFunction()->needsUnwindTableEntry() &&
+ MMI->getLandingPads().empty())
ATS.emitCantUnwind();
else {
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end",
Asm->getFunctionNumber()));
-
- // Map all labels and get rid of any dead landing pads.
- MMI->TidyLandingPads();
-
if (!MMI->getLandingPads().empty()) {
// Emit references to personality.
if (const Function * Personality =