[PATCH] D70568: [Support] Possibly use exception handler in the Crash Recovery Context in the same way as global exceptions

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 08:15:22 PST 2020


aganea marked an inline comment as done.
aganea added a comment.

Thanks for taking the time @hans!



================
Comment at: llvm/unittests/Support/CrashRecoveryTest.cpp:72
+  sys::RemoveFileOnSignal(Filename);
+  llvm::sys::AddSignalHandler(incrementGlobalWithCookie, nullptr);
+  GlobalInt = 0;
----------------
hans wrote:
> Is there a purpose to passing the pointer her, or could it just use incrementGlobal? If we can't, maybe call it WithPointer or something instead (or use an overload) - I was confused by the Cookie part until I realize you just mean it takes some argument.
The cookie thing is because:
```
  using SignalHandlerCallback = void (*)(void *);

  /// Add a function to be called when an abort/kill signal is delivered to the
  /// process. The handler can have a cookie passed to it to identify what
  /// instance of the handler it is.
  void AddSignalHandler(SignalHandlerCallback FnPtr, void *Cookie);
```
Sure, I'll change it to an overload.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70568/new/

https://reviews.llvm.org/D70568





More information about the cfe-commits mailing list