Skip to content

Commit a1627af

Browse files
Merge branch 'main' into get-huge-money
2 parents bee1af8 + b65e094 commit a1627af

File tree

38 files changed

+801
-375
lines changed

38 files changed

+801
-375
lines changed

clang/lib/Driver/ToolChains/WebAssembly.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ static bool TargetBuildsComponents(const llvm::Triple &TargetTriple) {
6969
TargetTriple.getOSName() != "wasi";
7070
}
7171

72+
static bool WantsPthread(const llvm::Triple &Triple, const ArgList &Args) {
73+
bool WantsPthread =
74+
Args.hasFlag(options::OPT_pthread, options::OPT_no_pthread, false);
75+
76+
// If the WASI environment is "threads" then enable pthreads support
77+
// without requiring -pthread, in order to prevent user error
78+
if (Triple.isOSWASI() && Triple.getEnvironmentName() == "threads")
79+
WantsPthread = true;
80+
81+
return WantsPthread;
82+
}
83+
7284
void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA,
7385
const InputInfo &Output,
7486
const InputInfoList &Inputs,
@@ -150,14 +162,14 @@ void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA,
150162

151163
AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
152164

153-
if (Args.hasArg(options::OPT_pthread))
165+
if (WantsPthread(ToolChain.getTriple(), Args))
154166
CmdArgs.push_back("--shared-memory");
155167

156168
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
157169
if (ToolChain.ShouldLinkCXXStdlib(Args))
158170
ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
159171

160-
if (Args.hasArg(options::OPT_pthread))
172+
if (WantsPthread(ToolChain.getTriple(), Args))
161173
CmdArgs.push_back("-lpthread");
162174

163175
CmdArgs.push_back("-lc");
@@ -292,8 +304,7 @@ void WebAssembly::addClangTargetOptions(const ArgList &DriverArgs,
292304
CC1Args.push_back("-fno-use-init-array");
293305

294306
// '-pthread' implies atomics, bulk-memory, mutable-globals, and sign-ext
295-
if (DriverArgs.hasFlag(options::OPT_pthread, options::OPT_no_pthread,
296-
false)) {
307+
if (WantsPthread(getTriple(), DriverArgs)) {
297308
if (DriverArgs.hasFlag(options::OPT_mno_atomics, options::OPT_matomics,
298309
false))
299310
getDriver().Diag(diag::err_drv_argument_not_allowed_with)

clang/test/Driver/wasm-toolchain.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@
110110
// RUN: | FileCheck -check-prefix=PTHREAD_NO_SIGN_EXT %s
111111
// PTHREAD_NO_SIGN_EXT: invalid argument '-pthread' not allowed with '-mno-sign-ext'
112112

113+
// 'wasm32-wasi-threads' does the same thing as '-pthread'
114+
// RUN: %clang -### --target=wasm32-wasi-threads --sysroot=/foo %s 2>&1 \
115+
// RUN: | FileCheck -check-prefix=WASI_THREADS %s
116+
// WASI_THREADS: "-cc1" {{.*}} "-target-feature" "+atomics" "-target-feature" "+bulk-memory" "-target-feature" "+mutable-globals" "-target-feature" "+sign-ext"
117+
// WASI_THREADS: wasm-ld{{.*}}" "--shared-memory" "-lpthread"
118+
113119
// '-mllvm -emscripten-cxx-exceptions-allowed=foo,bar' sets
114120
// '-mllvm --force-attribute=foo:noinline -mllvm --force-attribute=bar:noinline'
115121
// RUN: %clang -### --target=wasm32-unknown-unknown \

libcxx/docs/Status/Cxx17Issues.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"`LWG2404 <https://wg21.link/LWG2404>`__","``mismatch()``\ 's complexity needs to be updated","2014-11 (Urbana)","|Complete|","",""
1313
"`LWG2408 <https://wg21.link/LWG2408>`__","SFINAE-friendly ``common_type``\ / ``iterator_traits``\ is missing in C++14","2014-11 (Urbana)","|Complete|","",""
1414
"`LWG2106 <https://wg21.link/LWG2106>`__","``move_iterator``\ wrapping iterators returning prvalues","2014-11 (Urbana)","|Complete|","",""
15-
"`LWG2129 <https://wg21.link/LWG2129>`__","User specializations of ``std::initializer_list``\ ","2014-11 (Urbana)","|Complete|","",""
15+
"`LWG2129 <https://wg21.link/LWG2129>`__","User specializations of ``std::initializer_list``\ ","2014-11 (Urbana)","|Complete|","21",""
1616
"`LWG2212 <https://wg21.link/LWG2212>`__","``tuple_size``\ for ``const pair``\ request <tuple> header","2014-11 (Urbana)","|Complete|","",""
1717
"`LWG2217 <https://wg21.link/LWG2217>`__","``operator==(sub_match, string)``\ slices on embedded '\0's","2014-11 (Urbana)","|Complete|","",""
1818
"`LWG2230 <https://wg21.link/LWG2230>`__","""see below"" for ``initializer_list``\ constructors of unordered containers","2014-11 (Urbana)","|Complete|","",""

libcxx/docs/Status/Cxx23Issues.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
"`LWG3569 <https://wg21.link/LWG3569>`__","``join_view`` fails to support ranges of ranges with non-default_initializable iterators","2022-11 (Kona)","","",""
195195
"`LWG3594 <https://wg21.link/LWG3594>`__","``inout_ptr`` — inconsistent ``release()`` in destructor","2022-11 (Kona)","|Complete|","19",""
196196
"`LWG3597 <https://wg21.link/LWG3597>`__","Unsigned integer types don't model advanceable","2022-11 (Kona)","","",""
197-
"`LWG3600 <https://wg21.link/LWG3600>`__","Making ``istream_iterator`` copy constructor trivial is an ABI break","2022-11 (Kona)","","",""
197+
"`LWG3600 <https://wg21.link/LWG3600>`__","Making ``istream_iterator`` copy constructor trivial is an ABI break","2022-11 (Kona)","|Nothing To Do|","",""
198198
"`LWG3629 <https://wg21.link/LWG3629>`__","``make_error_code`` and ``make_error_condition`` are customization points","2022-11 (Kona)","|Complete|","16",""
199199
"`LWG3636 <https://wg21.link/LWG3636>`__","``formatter<T>::format`` should be ``const``-qualified","2022-11 (Kona)","|Complete|","16",""
200200
"`LWG3646 <https://wg21.link/LWG3646>`__","``std::ranges::view_interface::size`` returns a signed type","2022-11 (Kona)","|Complete|","16",""

libcxx/include/__iterator/istream_iterator.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ class _LIBCPP_TEMPLATE_VIS istream_iterator
5858
__in_stream_ = nullptr;
5959
}
6060

61+
// LWG3600 Changed the wording of the copy constructor. In libc++ this constructor
62+
// can still be trivial after this change.
63+
6164
_LIBCPP_HIDE_FROM_ABI const _Tp& operator*() const { return __value_; }
6265
_LIBCPP_HIDE_FROM_ABI const _Tp* operator->() const { return std::addressof((operator*())); }
6366
_LIBCPP_HIDE_FROM_ABI istream_iterator& operator++() {

libcxx/include/initializer_list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace std // purposefully not versioned
5959
# ifndef _LIBCPP_CXX03_LANG
6060

6161
template <class _Ep>
62-
class _LIBCPP_TEMPLATE_VIS initializer_list {
62+
class _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS initializer_list {
6363
const _Ep* __begin_;
6464
size_t __size_;
6565

libcxx/include/iterator

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ public:
530530
istream_iterator(); // constexpr since C++11
531531
constexpr istream_iterator(default_sentinel_t); // since C++20
532532
istream_iterator(istream_type& s);
533-
istream_iterator(const istream_iterator& x);
533+
constexpr istream_iterator(const istream_iterator& x) noexcept(see below);
534534
~istream_iterator();
535535
536536
const T& operator*() const;

libcxx/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,45 @@
1010

1111
// class istream_iterator
1212

13-
// istream_iterator(const istream_iterator& x);
14-
// C++17 says: If is_trivially_copy_constructible_v<T> is true, then
15-
// this constructor is a trivial copy constructor.
13+
// istream_iterator(const istream_iterator& x) noexcept(see below);
1614

1715
#include <iterator>
1816
#include <sstream>
1917
#include <cassert>
2018

2119
#include "test_macros.h"
2220

21+
// The copy constructor is constexpr in C++11, but that is not easy to test.
22+
// The comparison of the class is not constexpr so this is only a compile test.
23+
TEST_CONSTEXPR_CXX14 bool test_constexpr() {
24+
std::istream_iterator<int> io;
25+
[[maybe_unused]] std::istream_iterator<int> i = io;
26+
27+
return true;
28+
}
29+
30+
struct thowing_copy_constructor {
31+
thowing_copy_constructor() {}
32+
thowing_copy_constructor(const thowing_copy_constructor&) TEST_NOEXCEPT_FALSE {}
33+
};
34+
2335
int main(int, char**)
2436
{
2537
{
2638
std::istream_iterator<int> io;
2739
std::istream_iterator<int> i = io;
2840
assert(i == std::istream_iterator<int>());
41+
#if TEST_STD_VER >= 11
42+
static_assert(std::is_nothrow_copy_constructible<std::istream_iterator<int>>::value, "");
43+
#endif
44+
}
45+
{
46+
std::istream_iterator<thowing_copy_constructor> io;
47+
std::istream_iterator<thowing_copy_constructor> i = io;
48+
assert(i == std::istream_iterator<thowing_copy_constructor>());
49+
#if TEST_STD_VER >= 11
50+
static_assert(!std::is_nothrow_copy_constructible<std::istream_iterator<thowing_copy_constructor>>::value, "");
51+
#endif
2952
}
3053
{
3154
std::istringstream inf(" 1 23");
@@ -37,5 +60,9 @@ int main(int, char**)
3760
assert(j == 1);
3861
}
3962

40-
return 0;
63+
#if TEST_STD_VER >= 14
64+
static_assert(test_constexpr(), "");
65+
#endif
66+
67+
return 0;
4168
}
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+
// UNSUPPORTED: c++03
10+
11+
// template<class E> class initializer_list;
12+
//
13+
// If an explicit specialization or partial specialization of initializer_list
14+
// is declared, the program is ill-formed.
15+
16+
#include <initializer_list>
17+
18+
#if !__has_warning("-Winvalid-specializations")
19+
// expected-no-diagnostics
20+
#else
21+
22+
// expected-error@+2 {{'initializer_list' cannot be specialized: Users are not allowed to specialize this standard library entity}}
23+
template <>
24+
class std::initializer_list<int> {
25+
}; //expected-error 0-1 {{explicit specialization of 'std::initializer_list<int>' after instantiation}}
26+
27+
// expected-error@+2 {{'initializer_list' cannot be specialized: Users are not allowed to specialize this standard library entity}}
28+
template <typename T>
29+
class std::initializer_list<T*> {};
30+
31+
#endif

llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -646,14 +646,13 @@ void SampleProfileLoaderBaseImpl<BT>::findEquivalenceClasses(FunctionT &F) {
646646
BasicBlockT *BB1 = &BB;
647647

648648
// Compute BB1's equivalence class once.
649-
if (EquivalenceClass.count(BB1)) {
649+
// By default, blocks are in their own equivalence class.
650+
auto [It, Inserted] = EquivalenceClass.try_emplace(BB1, BB1);
651+
if (!Inserted) {
650652
LLVM_DEBUG(printBlockEquivalence(dbgs(), BB1));
651653
continue;
652654
}
653655

654-
// By default, blocks are in their own equivalence class.
655-
EquivalenceClass[BB1] = BB1;
656-
657656
// Traverse all the blocks dominated by BB1. We are looking for
658657
// every basic block BB2 such that:
659658
//

0 commit comments

Comments
 (0)