Commit 2b45f62
authored
[EH] Tidy up format_exception.cpp (NFC) (#16995)
This makes small cosmetic changes that do not affect the functionality.
- Use `using namespace __cxxabiv1`. This namespace is used many times
and I think it's OK to put this at the top. Other libc++abi cpp files
also do this.
- Use `static_cast` instead of the old cast. This is also in line with
the rest of libc++abi.
- Change some variable names. This tries to make variable names in line
with libc++abi's other files; personally I don't particularly like
their long names such as `exception_header`, but I think keeping them
in line with the rest of the code is generally good and possibly
helpful when we upstream the changes.
- Add `cxa_exception_from_thrown_object` and use it. The reason I copied
this function from cxa_exception.cpp is I'm planning to use all these
three when I add Wasm EH support for this function, and it will be
easier to read if we use these than just doing the arthmetic
ourselves.
https://github.com/emscripten-core/emscripten/blob/d5ef6937fe395488e23a82c1e582a7ea5c2dab83/system/lib/libcxxabi/src/cxa_exception.cpp#L39-L67
The reason I copied them is they are static functions in
cxa_exception.cpp. We possibly can move them to a header file and
include it both places, but that means further changes to libc++abi
codebase, which I think will make this harder to upstream.
- Use `__shim_type_info::can_catch` directly instead of `__cxa_catch`,
which is a wrapper created to be called from JS. This removes the need
to include the declaration of `__cxa_catch` in this file.1 parent 75f5315 commit 2b45f62
1 file changed
+25
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
9 | 14 | | |
10 | | - | |
11 | | - | |
12 | | - | |
| 15 | + | |
13 | 16 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | | - | |
| 25 | + | |
22 | 26 | | |
23 | | - | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | | - | |
30 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
34 | 41 | | |
35 | | - | |
36 | | - | |
| 42 | + | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
| |||
0 commit comments