[libcxx-commits] [PATCH] D93190: [libc++abi] Simplify scan_eh_tab

Fangrui Song via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Dec 13 20:50:54 PST 2020

MaskRay created this revision.
MaskRay added reviewers: libc++abi, rprichard.
MaskRay requested review of this revision.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++abi.


All `_URC_HANDLER_FOUND` return values need to set `landingPad` and
`adjustedPtr`, and their values do not matter for `_URC_CONTINUE_UNWIND`. So we
can always set the two values to unify code.


The so-called type 3 search (`actions & _UA_CLEANUP_PHASE && !(actions & _UA_HANDLER_FRAME)`)
is actually conceptually wrong.  For a catch handler or an unmatched dynamic
exception specification, `_UA_HANDLER_FOUND` should be returned immediately.  It
still appeared to work because the `ttypeIndex==0` case would return
`_UA_HANDLER_FOUND` at a later time.

This patch fixes the conceptual error and simplifies the code by handling type 3
the same way as type 2 (which is also what libsupc++ does).
The only difference between phase 1 and phase 2 is what to do with a cleanup
(`actionEntry==0`, or a `ttypeIndex==0` is found in the action record chain):
phase 1 returns `_URC_CONTINUE_UNWIND` while phase 2 returns `_URC_HANDLER_FOUND`.

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93190.311481.patch
Type: text/x-patch
Size: 10907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201214/94306241/attachment-0001.bin>

More information about the libcxx-commits mailing list