Commit 0887fa5e authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

Some machine code check functions for terminate_with

Summary:
[Folly] Some machine code check functions for `terminate` and `terminate_with`.

Demonstrates the impact of adding the extra argument.

Reviewed By: magedm

Differential Revision: D23523207

fbshipit-source-id: c37ae61e59ca060e7e370db425cb937341bd6e09
parent 322fdec2
......@@ -21,9 +21,32 @@
#include <string>
#include <folly/Portability.h>
#include <folly/lang/Keep.h>
#include <folly/lang/Pretty.h>
#include <folly/portability/GTest.h>
namespace folly {
namespace exception_test {
template <typename... T>
FOLLY_ATTR_WEAK FOLLY_NOINLINE void sink(T&&...) {}
} // namespace exception_test
} // namespace folly
extern "C" FOLLY_KEEP void check_cond_std_terminate(bool c) {
if (c) {
std::terminate();
}
folly::exception_test::sink();
}
extern "C" FOLLY_KEEP void check_cond_folly_terminate_with(bool c) {
if (c) {
folly::terminate_with<std::runtime_error>("bad error");
}
folly::exception_test::sink();
}
template <typename Ex>
static std::string message_for_terminate_with(std::string const& what) {
auto const name = folly::pretty_name<Ex>();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment