mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Change abseil hardening assertion in any_invocable from macro to function
This associates debug information with the assertion site, allowing clearer stack-traces for assertion failures and better accounting of the performance overhead of assertions. PiperOrigin-RevId: 912616493 Change-Id: I3bcaa8d24fc7d9adc04e67fe228bf418bb5eb842
This commit is contained in:
committed by
Copybara-Service
parent
659ba44acf
commit
723c2e7c8a
@@ -44,6 +44,7 @@ cc_library(
|
||||
deps = [
|
||||
"//absl/base:config",
|
||||
"//absl/base:core_headers",
|
||||
"//absl/base:hardening",
|
||||
"//absl/base:nullability",
|
||||
"//absl/meta:type_traits",
|
||||
"//absl/utility",
|
||||
@@ -62,6 +63,7 @@ cc_test(
|
||||
":any_invocable",
|
||||
"//absl/base:config",
|
||||
"//absl/base:core_headers",
|
||||
"//absl/base:hardening",
|
||||
"//absl/base:nullability",
|
||||
"//absl/meta:type_traits",
|
||||
"//absl/utility",
|
||||
|
||||
@@ -27,6 +27,7 @@ absl_cc_library(
|
||||
absl::base
|
||||
absl::config
|
||||
absl::core_headers
|
||||
absl::hardening
|
||||
absl::type_traits
|
||||
absl::utility
|
||||
PUBLIC
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/base/config.h"
|
||||
#include "absl/base/internal/hardening.h"
|
||||
#include "absl/base/macros.h"
|
||||
#include "absl/base/nullability.h"
|
||||
#include "absl/base/optimization.h"
|
||||
@@ -729,7 +730,7 @@ using CanAssignReferenceWrapper = TrueAlias<
|
||||
/*Raises a fatal error when the AnyInvocable is invoked after a move*/ \
|
||||
static ReturnType InvokedAfterMove( \
|
||||
TypeErasedState*, ForwardedParameterType<P>...) noexcept(noex) { \
|
||||
ABSL_HARDENING_ASSERT(false && "AnyInvocable use-after-move"); \
|
||||
absl::base_internal::HardeningAssert(false); \
|
||||
std::terminate(); \
|
||||
} \
|
||||
\
|
||||
|
||||
Reference in New Issue
Block a user