Skip to content

Commit 97b9c24

Browse files
authored
Add missing annotations for Apple platforms (llvm#198864)
These seemed to be missed in llvm#193045.
1 parent dd2ce3d commit 97b9c24

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

libcxx/include/__functional/function.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,13 @@ class __policy_func<_Rp(_ArgTypes...)> {
529529

530530
# if _LIBCPP_HAS_BLOCKS_RUNTIME
531531

532+
_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
533+
532534
extern "C" void* _Block_copy(const void*);
533535
extern "C" void _Block_release(const void*);
534536

537+
_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
538+
535539
template <class _Rp1, class... _ArgTypes1, class _Rp, class... _ArgTypes>
536540
class __func<_Rp1 (^)(_ArgTypes1...), _Rp(_ArgTypes...)> : public __base<_Rp(_ArgTypes...)> {
537541
typedef _Rp1 (^__block_type)(_ArgTypes1...);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// std::function support for the "blocks" extension
10+
11+
// UNSUPPORTED: c++03
12+
13+
// This test requires the Blocks runtime, which is (only?) available
14+
// on Darwin out-of-the-box.
15+
// REQUIRES: has-fblocks && darwin
16+
17+
// ADDITIONAL_COMPILE_FLAGS: -fblocks
18+
19+
// Test that including <Block.h> before <functional> compiles and runs.
20+
// This is a regression test for an issue where redeclaring the Block runtime
21+
// functions (_Block_copy, _Block_release) inside libc++'s explicit ABI
22+
// annotations incorrectly added an 'abi_tag' attribute to them.
23+
24+
#include <Block.h>
25+
#include <functional>
26+
27+
int main(int, char**) {
28+
std::function<void()> f = []() {};
29+
(void)f;
30+
return 0;
31+
}

0 commit comments

Comments
 (0)