[PATCH] Fix _Unwind_Backtrace for libc++abi built with libgcc.

Dan Albert danalbert at google.com
Tue Jan 20 09:59:57 PST 2015


================
Comment at: src/cxa_personality.cpp:1106
@@ +1105,3 @@
+    const unsigned _US_FORCE_UNWIND = 8u;
+    bool is_force_unwinding = static_cast<unsigned>(state) & _US_FORCE_UNWIND;
+    state = static_cast<_Unwind_State>(static_cast<unsigned>(state) & ~_US_FORCE_UNWIND);
----------------
It's already a `uint32_t`, what do you need the cast for? If you really do need a cast, use something explicitly sized.

================
Comment at: src/cxa_personality.cpp:1107
@@ +1106,3 @@
+    bool is_force_unwinding = static_cast<unsigned>(state) & _US_FORCE_UNWIND;
+    state = static_cast<_Unwind_State>(static_cast<unsigned>(state) & ~_US_FORCE_UNWIND);
+
----------------
jroelofs wrote:
> rengolin wrote:
> > Why do you need to clear the forced flag?
> The _US_* things are a bitmask. Not clearing it means that the switch below won't match it.
Would be more intention revealing to clear the flag for the switch condition itself.

http://reviews.llvm.org/D7031

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list