Skip to content

Commit 16519eb

Browse files
alanzhao1copybara-github
authored andcommitted
[libc++] Add the <__assertion_handler> header
Because of llvm/llvm-project#77883, libc++ headers now #include an __assertion_handler header file that is either generated by CMake or provided by the vendor. Since we don't use CMake for libc++, this CL vendors <__assertion_handler> by copying the file default_assertion_handler.in [0], which is the file that CMake uses to generate the default version of <__assertion_handler>. This CL is needed to unblock the libc++ autoroller (since otherwise libc++ won't compile due to the missing header). [0]: https://github.com/llvm/llvm-project/blob/main/libcxx/vendor/llvm/default_assertion_handler.in Bug: 1517992 Change-Id: Ia551bdb706f7e68db914ddf46bf2128cdb1a6284 Fixed: 1517992 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5208502 Reviewed-by: Hans Wennborg <[email protected]> Commit-Queue: Alan Zhao <[email protected]> Cr-Commit-Position: refs/heads/main@{#1248897} NOKEYCHECK=True GitOrigin-RevId: 0f6a1d2429de239f87ba3f199c14631d754acd1e
1 parent 455972c commit 16519eb

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

third_party/libc++/BUILD.gn

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ target(_libcxx_target_type, "libc++") {
6969
libs = [ "atomic" ]
7070
}
7171

72-
inputs = [ "__config_site" ]
72+
inputs = [
73+
"__assertion_handler",
74+
"__config_site",
75+
]
7376

7477
# TODO(crbug.com/1458042): Move this build file to third_party/libc++/BUILD.gn once submodule migration is done
7578
sources = [
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// -*- C++ -*-
2+
//===----------------------------------------------------------------------===//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#ifndef _LIBCPP___ASSERTION_HANDLER
11+
#define _LIBCPP___ASSERTION_HANDLER
12+
13+
#include <__config>
14+
#include <__verbose_abort>
15+
16+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17+
# pragma GCC system_header
18+
#endif
19+
20+
// TODO(hardening): in production, trap rather than abort.
21+
#define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
22+
23+
#endif // _LIBCPP___ASSERTION_HANDLER

0 commit comments

Comments
 (0)