Skip to content

Commit 927b4e7

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: I7d02f649a5f7c28e3f8fab3bede9ad948d13d970
2 parents fec4819 + 089c4bb commit 927b4e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2273
-376
lines changed

bolt/lib/Profile/BoltAddressTranslation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ std::error_code BoltAddressTranslation::parse(raw_ostream &OS, StringRef Buf) {
304304

305305
StringRef Name = Buf.slice(Offset, Offset + NameSz);
306306
Offset = alignTo(Offset + NameSz, 4);
307-
if (Name.substr(0, 4) != "BOLT")
307+
if (!Name.starts_with("BOLT"))
308308
return make_error_code(llvm::errc::io_error);
309309

310310
Error Err(Error::success());

clang-tools-extra/clang-query/QueryParser.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,11 @@ QueryRef QueryParser::endQuery(QueryRef Q) {
144144
StringRef Extra = Line;
145145
StringRef ExtraTrimmed = Extra.ltrim(" \t\v\f\r");
146146

147-
if ((!ExtraTrimmed.empty() && ExtraTrimmed[0] == '\n') ||
148-
(ExtraTrimmed.size() >= 2 && ExtraTrimmed[0] == '\r' &&
149-
ExtraTrimmed[1] == '\n'))
147+
if (ExtraTrimmed.starts_with('\n') || ExtraTrimmed.starts_with("\r\n"))
150148
Q->RemainingContent = Extra;
151149
else {
152150
StringRef TrailingWord = lexWord();
153-
if (!TrailingWord.empty() && TrailingWord.front() == '#') {
151+
if (TrailingWord.starts_with('#')) {
154152
Line = Line.drop_until([](char c) { return c == '\n'; });
155153
Line = Line.drop_while([](char c) { return c == '\n'; });
156154
return endQuery(Q);

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,6 +1834,9 @@ bool ByteCodeExprGen<Emitter>::VisitCompoundAssignOperator(
18341834
std::optional<PrimType> RT = classify(RHS->getType());
18351835
std::optional<PrimType> ResultT = classify(E->getType());
18361836

1837+
if (!Ctx.getLangOpts().CPlusPlus14)
1838+
return this->visit(RHS) && this->visit(LHS) && this->emitError(E);
1839+
18371840
if (!LT || !RT || !ResultT || !LHSComputationT)
18381841
return false;
18391842

@@ -3827,6 +3830,21 @@ bool ByteCodeExprGen<Emitter>::VisitComplexUnaryOperator(
38273830
// we sometimes have to do the lvalue-to-rvalue conversion here manually.
38283831
return this->emitArrayElemPop(classifyPrim(E->getType()), 1, E);
38293832

3833+
case UO_Not: // ~x
3834+
if (!this->visit(SubExpr))
3835+
return false;
3836+
// Negate the imaginary component.
3837+
if (!this->emitArrayElem(ElemT, 1, E))
3838+
return false;
3839+
if (!this->emitNeg(ElemT, E))
3840+
return false;
3841+
if (!this->emitInitElem(ElemT, 1, E))
3842+
return false;
3843+
return DiscardResult ? this->emitPopPtr(E) : true;
3844+
3845+
case UO_Extension:
3846+
return this->delegate(SubExpr);
3847+
38303848
default:
38313849
return this->emitInvalid(E);
38323850
}

clang/test/AST/Interp/complex.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ static_assert(__imag(Doubles[2]) == 0.0, "");
115115
static_assert(__real(Doubles[3]) == 0.0, "");
116116
static_assert(__imag(Doubles[3]) == 0.0, "");
117117

118+
static_assert(~(0.5 + 1.5j) == (0.5 + -1.5j), "");
119+
120+
static_assert(__extension__ __imag(A) == 0, "");
121+
static_assert(__imag(__extension__ A) == 0, "");
122+
118123
void func(void) {
119124
__complex__ int arr;
120125
_Complex int result;

clang/test/SemaCXX/for-range-examples.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
2+
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -fexperimental-new-constant-interpreter
23

34
namespace value_range_detail {
45
template<typename T>

clang/test/SemaCXX/integer-overflow.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// RUN: %clang_cc1 %s -verify -fsyntax-only -std=gnu++98 -triple x86_64-pc-linux-gnu
22
// RUN: %clang_cc1 %s -verify -fsyntax-only -std=gnu++2a -triple x86_64-pc-linux-gnu
33

4+
// RUN: %clang_cc1 %s -verify -fsyntax-only -std=gnu++98 -triple x86_64-pc-linux-gnu -fexperimental-new-constant-interpreter
5+
// RUN: %clang_cc1 %s -verify -fsyntax-only -std=gnu++2a -triple x86_64-pc-linux-gnu -fexperimental-new-constant-interpreter
6+
7+
48
typedef unsigned long long uint64_t;
59
typedef unsigned int uint32_t;
610

clang/test/SemaTemplate/cwg2398.cpp

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,120 @@ namespace consistency {
200200
template struct A<B<int>, B<int>, B<int>>;
201201
// new-error@-1 {{ambiguous partial specializations}}
202202
} // namespace t2
203+
namespace t3 {
204+
template<class T1, class T2, class T3> struct A;
205+
206+
template<template<class, class> class TT1,
207+
class T1, class T2, class T3, class T4>
208+
struct A<TT1<T1, T2>, TT1<T3, T4>, typename nondeduced<TT1<T1, T2>>::type> {};
209+
// new-note@-1 {{partial specialization matches}}
210+
211+
template<template<class> class UU1,
212+
class U1, class U2>
213+
struct A<UU1<U1>, UU1<U2>, typename nondeduced<UU1<U1>>::type>;
214+
// new-note@-1 {{partial specialization matches}}
215+
216+
template struct A<B<int>, B<int>, B<int>>;
217+
// new-error@-1 {{ambiguous partial specializations}}
218+
} // namespace t3
219+
namespace t4 {
220+
template<class T1, class T2, class T3> struct A;
221+
222+
template<template<class, class> class TT1,
223+
class T1, class T2, class T3, class T4>
224+
struct A<TT1<T1, T2>, TT1<T3, T4>, typename nondeduced<TT1<T1, T4>>::type> {};
225+
// new-note@-1 {{partial specialization matches}}
226+
227+
template<template<class> class UU1,
228+
class U1, class U2>
229+
struct A<UU1<U1>, UU1<U2>, typename nondeduced<UU1<U1>>::type>;
230+
// new-note@-1 {{partial specialization matches}}
231+
232+
template struct A<B<int>, B<int>, B<int>>;
233+
// new-error@-1 {{ambiguous partial specializations}}
234+
} // namespace t4
235+
namespace t5 {
236+
template<class T1, class T2> struct A;
237+
238+
template<template<class, class> class TT1,
239+
class T1, class T2, class T3, class T4>
240+
struct A<TT1<T1, T2>, TT1<T3, T4>> {};
241+
// new-note@-1 {{partial specialization matches}}
242+
243+
template<template<class> class UU1,
244+
class U1, class U2>
245+
struct A<UU1<U1>, UU1<U2>>;
246+
// new-note@-1 {{partial specialization matches}}
247+
248+
template struct A<B<int>, B<int>>;
249+
// new-error@-1 {{ambiguous partial specializations}}
250+
} // namespace t5
251+
namespace t6 {
252+
template<class T1, class T2> struct A;
253+
254+
template<template<class, class> class TT1,
255+
class T1, class T2, class T3>
256+
struct A<TT1<T1, T2>, TT1<T1, T3>> {};
257+
// new-note@-1 {{partial specialization matches}}
258+
259+
template<template<class> class UU1,
260+
class U1, class U2>
261+
struct A<UU1<U1>, UU1<U2>>;
262+
// new-note@-1 {{partial specialization matches}}
263+
264+
template struct A<B<int>, B<int>>;
265+
// new-error@-1 {{ambiguous partial specializations}}
266+
} // namespace t6
203267
} // namespace consistency
204268

269+
namespace classes {
270+
namespace canon {
271+
template<class T, class U> struct A {};
272+
273+
template<template<class> class TT> auto f(TT<int> a) { return a; }
274+
// old-note@-1 2{{template template argument has different template parameters}}
275+
// new-note@-2 2{{substitution failure: too few template arguments}}
276+
277+
A<int, float> v1;
278+
A<int, double> v2;
279+
280+
using X = decltype(f(v1));
281+
// expected-error@-1 {{no matching function for call}}
282+
283+
using X = decltype(f(v2));
284+
// expected-error@-1 {{no matching function for call}}
285+
} // namespace canon
286+
namespace expr {
287+
template <class T1, int E1> struct A {
288+
static constexpr auto val = E1;
289+
};
290+
template <template <class T3> class TT> void f(TT<int> v) {
291+
// old-note@-1 {{template template argument has different template parameters}}
292+
// new-note@-2 {{substitution failure: too few template arguments}}
293+
static_assert(v.val == 3);
294+
};
295+
void test() {
296+
f(A<int, 3>());
297+
// expected-error@-1 {{no matching function for call}}
298+
}
299+
} // namespace expr
300+
namespace packs {
301+
template <class T1, class ...T2s> struct A {
302+
static constexpr auto val = sizeof...(T2s);
303+
};
304+
305+
template <template <class T3> class TT> void f(TT<int> v) {
306+
// old-note@-1 {{template template argument has different template parameters}}
307+
// new-note@-2 {{deduced type 'A<[...], (no argument), (no argument), (no argument)>' of 1st parameter does not match adjusted type 'A<[...], void, void, void>' of argument [with TT = A]}}
308+
static_assert(v.val == 3);
309+
};
310+
void test() {
311+
f(A<int, void, void, void>());
312+
// expected-error@-1 {{no matching function for call}}
313+
}
314+
} // namespace packs
315+
} // namespace classes
316+
205317
namespace regression1 {
206318
template <typename T, typename Y> struct map {};
207319
template <typename T> class foo {};

libcxx/include/__chrono/time_zone.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
// Enable the contents of the header only when libc++ was built with experimental features enabled.
1717
#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
1818

19+
# include <__chrono/calendar.h>
1920
# include <__chrono/duration.h>
21+
# include <__chrono/local_info.h>
2022
# include <__chrono/sys_info.h>
2123
# include <__chrono/system_clock.h>
2224
# include <__compare/strong_order.h>
@@ -63,12 +65,18 @@ class _LIBCPP_AVAILABILITY_TZDB time_zone {
6365
return __get_info(chrono::time_point_cast<seconds>(__time));
6466
}
6567

68+
template <class _Duration>
69+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI local_info get_info(const local_time<_Duration>& __time) const {
70+
return __get_info(chrono::time_point_cast<seconds>(__time));
71+
}
72+
6673
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI const __impl& __implementation() const noexcept { return *__impl_; }
6774

6875
private:
6976
[[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI string_view __name() const noexcept;
7077

7178
[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI sys_info __get_info(sys_seconds __time) const;
79+
[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI local_info __get_info(local_seconds __time) const;
7280

7381
unique_ptr<__impl> __impl_;
7482
};

libcxx/include/chrono

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,9 @@ class time_zone {
763763
764764
template<class Duration>
765765
sys_info get_info(const sys_time<Duration>& st) const;
766+
767+
template<class Duration>
768+
local_info get_info(const local_time<Duration>& tp) const;
766769
};
767770
bool operator==(const time_zone& x, const time_zone& y) noexcept; // C++20
768771
strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept; // C++20

0 commit comments

Comments
 (0)