Address Reid's review feedback.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241889 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2015-07-10 07:00:58 +00:00
parent 751c4be705
commit a5d05b7711
3 changed files with 27 additions and 22 deletions

View File

@ -5183,15 +5183,15 @@ none of the ``catchblock`` instructions are suitable for catching the
in-flight exception. in-flight exception.
If a ``nextaction`` label is not present, the instruction unwinds out of If a ``nextaction`` label is not present, the instruction unwinds out of
the function it is located in. The its parent function. The
:ref:`personality function <personalityfn>` will look for an appropriate :ref:`personality function <personalityfn>` will continue processing
catch block in the caller. exception handling actions in the caller.
Arguments: Arguments:
"""""""""" """"""""""
The instruction optionally takes a label, ``nextaction``, indicating The instruction optionally takes a label, ``nextaction``, indicating
where control should transfer to if none of the constituent where control should transfer to if none of the preceding
``catchblock`` instructions are suitable for the in-flight exception. ``catchblock`` instructions are suitable for the in-flight exception.
Semantics: Semantics:
@ -5212,6 +5212,7 @@ The ``catchendblock`` instruction has several restrictions:
catch block. catch block.
- A basic block that is not a catch-end block may not include a - A basic block that is not a catch-end block may not include a
'``catchendblock``' instruction. '``catchendblock``' instruction.
- Exactly one catch block may unwind to a ``catchendblock``.
Example: Example:
"""""""" """"""""
@ -5251,7 +5252,7 @@ Semantics:
The '``catchret``' instruction ends the existing (in-flight) exception The '``catchret``' instruction ends the existing (in-flight) exception
whose unwinding was interrupted with a whose unwinding was interrupted with a
:ref:`catchblock <i_catchblock>` instruction and transfer control to :ref:`catchblock <i_catchblock>` instruction and transfers control to
``normal``. ``normal``.
Example: Example:
@ -5301,6 +5302,7 @@ Example:
.. code-block:: llvm .. code-block:: llvm
cleanupret void unwind to caller
cleanupret { i8*, i32 } %exn unwind label %continue cleanupret { i8*, i32 } %exn unwind label %continue
.. _i_terminateblock: .. _i_terminateblock:
@ -5314,21 +5316,20 @@ Syntax:
:: ::
terminateblock [<args>*] unwind label <exception label> terminateblock [<args>*] unwind label <exception label>
terminateblock [<args>*] unwind to caller
Overview: Overview:
""""""""" """""""""
The '``terminateblock``' instruction is used by `LLVM's exception handling The '``terminateblock``' instruction is used by `LLVM's exception handling
system <ExceptionHandling.html#overview>`_ to specify that a basic block system <ExceptionHandling.html#overview>`_ to specify that a basic block
is a terminate block --- one where a personality routine attempts to transfer is a terminate block --- one where a personality routine may decide to
control to terminate the program. terminate the program.
The ``args`` correspond to whatever information the personality The ``args`` correspond to whatever information the personality
routine requires to know if this is an appropriate place to terminate the routine requires to know if this is an appropriate place to terminate the
program. Control is tranfered to the ``exception`` label if the program. Control is tranfered to the ``exception`` label if the
``terminateblock`` is an appropriate handler for the in-flight exception. personality routine decides not to terminate the program for the
If the ``terminateblock`` is not an appropriate handler, execution of in-flight exception.
the program is terminated via
:ref:`personality function <personalityfn>` specific means.
Arguments: Arguments:
"""""""""" """"""""""
@ -5336,7 +5337,7 @@ Arguments:
The instruction takes a list of arbitrary values which are interpreted The instruction takes a list of arbitrary values which are interpreted
by the :ref:`personality function <personalityfn>`. by the :ref:`personality function <personalityfn>`.
The ``terminateblock`` must be provided an ``exception`` label to The ``terminateblock`` may be given an ``exception`` label to
transfer control to if the in-flight exception matches the ``args``. transfer control to if the in-flight exception matches the ``args``.
Semantics: Semantics:

View File

@ -2408,8 +2408,8 @@ void Verifier::visitCallInst(CallInst &CI) {
void Verifier::visitInvokeInst(InvokeInst &II) { void Verifier::visitInvokeInst(InvokeInst &II) {
VerifyCallSite(&II); VerifyCallSite(&II);
// Verify that there is an exception block instruction is the first non-PHI // Verify that the first non-PHI instruction of the unwind destination is an
// instruction of the 'unwind' destination. // exception handling instruction.
Assert( Assert(
II.getUnwindDest()->isEHBlock(), II.getUnwindDest()->isEHBlock(),
"The unwind destination does not have an exception handling instruction!", "The unwind destination does not have an exception handling instruction!",

View File

@ -2654,23 +2654,27 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
} }
void visitCleanupBlockInst(CleanupBlockInst &I) { void visitCleanupBlockInst(CleanupBlockInst &I) {
if (!I.getType()->isVoidTy()) {
setShadow(&I, getCleanShadow(&I)); setShadow(&I, getCleanShadow(&I));
setOrigin(&I, getCleanOrigin()); setOrigin(&I, getCleanOrigin());
} }
}
void visitCatchBlock(CatchBlockInst &I) { void visitCatchBlock(CatchBlockInst &I) {
if (!I.getType()->isVoidTy()) {
setShadow(&I, getCleanShadow(&I)); setShadow(&I, getCleanShadow(&I));
setOrigin(&I, getCleanOrigin()); setOrigin(&I, getCleanOrigin());
} }
}
void visitTerminateBlock(TerminateBlockInst &I) { void visitTerminateBlock(TerminateBlockInst &I) {
setShadow(&I, getCleanShadow(&I)); DEBUG(dbgs() << "TerminateBlock: " << I << "\n");
setOrigin(&I, getCleanOrigin()); // Nothing to do here.
} }
void visitCatchEndBlockInst(CatchEndBlockInst &I) { void visitCatchEndBlockInst(CatchEndBlockInst &I) {
setShadow(&I, getCleanShadow(&I)); DEBUG(dbgs() << "CatchEndBlock: " << I << "\n");
setOrigin(&I, getCleanOrigin()); // Nothing to do here.
} }
void visitGetElementPtrInst(GetElementPtrInst &I) { void visitGetElementPtrInst(GetElementPtrInst &I) {