Skip to content

Commit a37bd92

Browse files
committed
Merge branch 'main' into branch-protection-pauthabi
2 parents f06bc88 + 8da3852 commit a37bd92

File tree

280 files changed

+6926
-3445
lines changed

Some content is hidden

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

280 files changed

+6926
-3445
lines changed

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,18 @@ if(FUCHSIA_SDK)
300300
set(LLVM_RUNTIME_MULTILIB_hwasan+noexcept_TARGETS "aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
301301
endif()
302302

303-
foreach(target armv6m-unknown-eabi;armv7m-unknown-eabi;armv8m-unknown-eabi)
303+
foreach(target armv6m-unknown-eabi;armv7m-unknown-eabi;armv8m.main-unknown-eabi)
304304
list(APPEND BUILTIN_TARGETS "${target}")
305305
set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
306306
set(BUILTINS_${target}_CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
307307
set(BUILTINS_${target}_CMAKE_SYSROOT "" CACHE STRING "")
308-
set(BUILTINS_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
308+
set(BUILTINS_${target}_CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
309309
foreach(lang C;CXX;ASM)
310-
set(BUILTINS_${target}_CMAKE_${lang}_FLAGS "--target=${target} -mthumb" CACHE STRING "")
310+
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "--target=${target} -mthumb")
311+
if(${target} STREQUAL "armv8m.main-unknown-eabi")
312+
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8m.main+fp+dsp -mcpu=cortex-m33" CACHE STRING "")
313+
endif()
314+
set(BUILTINS_${target}_CMAKE_${lang}_FLAGS "${BUILTINS_${target}_CMAKE_${lang}_local_flags}" CACHE STRING "")
311315
endforeach()
312316
foreach(type SHARED;MODULE;EXE)
313317
set(BUILTINS_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
@@ -318,7 +322,7 @@ foreach(target armv6m-unknown-eabi;armv7m-unknown-eabi;armv8m-unknown-eabi)
318322
set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
319323
set(RUNTIMES_${target}_CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
320324
set(RUNTIMES_${target}_CMAKE_SYSROOT "" CACHE STRING "")
321-
set(RUNTIMES_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
325+
set(RUNTIMES_${target}_CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
322326
set(RUNTIMES_${target}_CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY CACHE STRING "")
323327
foreach(lang C;CXX;ASM)
324328
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -mthumb -Wno-atomic-alignment" CACHE STRING "")
@@ -353,7 +357,7 @@ foreach(target riscv32-unknown-elf)
353357
set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
354358
set(BUILTINS_${target}_CMAKE_SYSTEM_PROCESSOR RISCV CACHE STRING "")
355359
set(BUILTINS_${target}_CMAKE_SYSROOT "" CACHE STRING "")
356-
set(BUILTINS_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
360+
set(BUILTINS_${target}_CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
357361
foreach(lang C;CXX;ASM)
358362
set(BUILTINS_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f" CACHE STRING "")
359363
endforeach()
@@ -366,7 +370,7 @@ foreach(target riscv32-unknown-elf)
366370
set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
367371
set(RUNTIMES_${target}_CMAKE_SYSTEM_PROCESSOR RISCV CACHE STRING "")
368372
set(RUNTIMES_${target}_CMAKE_SYSROOT "" CACHE STRING "")
369-
set(RUNTIMES_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
373+
set(RUNTIMES_${target}_CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
370374
set(RUNTIMES_${target}_CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY CACHE STRING "")
371375
foreach(lang C;CXX;ASM)
372376
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f" CACHE STRING "")

clang/docs/HLSL/ExpectedDifferences.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,16 @@ behavior between Clang and DXC. Some examples include:
6767
void takesDoubles(double, double, double);
6868

6969
cbuffer CB {
70+
bool B;
7071
uint U;
7172
int I;
7273
float X, Y, Z;
7374
double3 A, B;
7475
}
7576

77+
void twoParams(int, int);
78+
void twoParams(float, float);
79+
7680
export void call() {
7781
halfOrInt16(U); // DXC: Fails with call ambiguous between int16_t and uint16_t overloads
7882
// Clang: Resolves to halfOrInt16(uint16_t).
@@ -98,6 +102,13 @@ behavior between Clang and DXC. Some examples include:
98102
// FXC: Expands to compute double dot product with fmul/fadd
99103
// Clang: Resolves to dot(float3, float3), emits conversion warnings.
100104

105+
#ifndef IGNORE_ERRORS
106+
tan(B); // DXC: resolves to tan(float).
107+
// Clang: Fails to resolve, ambiguous between integer types.
108+
109+
twoParams(I, X); // DXC: resolves twoParams(int, int).
110+
// Clang: Fails to resolve ambiguous conversions.
111+
#endif
101112
}
102113

103114
.. note::

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,8 @@ Bug Fixes to C++ Support
10401040
- Clang now correctly handles unexpanded packs in the template parameter list of a generic lambda expression
10411041
(#GH48937)
10421042
- Fix a crash when parsing an invalid type-requirement in a requires expression. (#GH51868)
1043+
- Fix parsing of built-in type-traits such as ``__is_pointer`` in libstdc++ headers. (#GH95598)
1044+
- Fixed failed assertion when resolving context of defaulted comparison method outside of struct. (#GH96043).
10431045

10441046
Bug Fixes to AST Handling
10451047
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1150,6 +1152,10 @@ RISC-V Support
11501152
- ``__attribute__((rvv_vector_bits(N)))`` is now supported for RVV vbool*_t types.
11511153
- Profile names in ``-march`` option are now supported.
11521154
- Passing empty structs/unions as arguments in C++ is now handled correctly. The behavior is similar to GCC's.
1155+
- ``-m[no-]scalar-strict-align`` and ``-m[no-]vector-strict-align`` options have
1156+
been added to give separate control of whether scalar or vector misaligned
1157+
accesses may be created. ``-m[no-]strict-align`` applies to both scalar and
1158+
vector.
11531159

11541160
CUDA/HIP Language Changes
11551161
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/ASTConcept.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ class ConstraintSatisfaction : public llvm::FoldingSetNode {
5353
bool IsSatisfied = false;
5454
bool ContainsErrors = false;
5555

56-
/// \brief Pairs of unsatisfied atomic constraint expressions along with the
57-
/// substituted constraint expr, if the template arguments could be
56+
/// \brief The substituted constraint expr, if the template arguments could be
5857
/// substituted into them, or a diagnostic if substitution resulted in an
5958
/// invalid expression.
60-
llvm::SmallVector<std::pair<const Expr *, Detail>, 4> Details;
59+
llvm::SmallVector<Detail, 4> Details;
6160

6261
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C) {
6362
Profile(ID, C, ConstraintOwner, TemplateArgs);
@@ -69,7 +68,7 @@ class ConstraintSatisfaction : public llvm::FoldingSetNode {
6968

7069
bool HasSubstitutionFailure() {
7170
for (const auto &Detail : Details)
72-
if (Detail.second.dyn_cast<SubstitutionDiagnostic *>())
71+
if (Detail.dyn_cast<SubstitutionDiagnostic *>())
7372
return true;
7473
return false;
7574
}
@@ -80,9 +79,7 @@ class ConstraintSatisfaction : public llvm::FoldingSetNode {
8079
/// substituted into them, or a diagnostic if substitution resulted in
8180
/// an invalid expression.
8281
using UnsatisfiedConstraintRecord =
83-
std::pair<const Expr *,
84-
llvm::PointerUnion<Expr *,
85-
std::pair<SourceLocation, StringRef> *>>;
82+
llvm::PointerUnion<Expr *, std::pair<SourceLocation, StringRef> *>;
8683

8784
/// \brief The result of a constraint satisfaction check, containing the
8885
/// necessary information to diagnose an unsatisfied constraint.

clang/include/clang/Driver/Options.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4854,6 +4854,14 @@ def mstrict_align : Flag<["-"], "mstrict-align">, Group<m_Group>,
48544854
HelpText<"Force all memory accesses to be aligned (AArch64/LoongArch/RISC-V only)">;
48554855
def mno_strict_align : Flag<["-"], "mno-strict-align">, Group<m_Group>,
48564856
HelpText<"Allow memory accesses to be unaligned (AArch64/LoongArch/RISC-V only)">;
4857+
def mscalar_strict_align : Flag<["-"], "mscalar-strict-align">, Group<m_Group>,
4858+
HelpText<"Force all scalar memory accesses to be aligned (RISC-V only)">;
4859+
def mno_scalar_strict_align : Flag<["-"], "mno-scalar-strict-align">, Group<m_Group>,
4860+
HelpText<"Allow scalar memory accesses to be unaligned (RISC-V only)">;
4861+
def mvector_strict_align : Flag<["-"], "mvector-strict-align">, Group<m_Group>,
4862+
HelpText<"Force all vector memory accesses to be aligned (RISC-V only)">;
4863+
def mno_vector_strict_align : Flag<["-"], "mno-vector-strict-align">, Group<m_Group>,
4864+
HelpText<"Allow vector memory accesses to be unaligned (RISC-V only)">;
48574865
def mno_thumb : Flag<["-"], "mno-thumb">, Group<m_arm_Features_Group>;
48584866
def mrestrict_it: Flag<["-"], "mrestrict-it">, Group<m_arm_Features_Group>,
48594867
HelpText<"Disallow generation of complex IT blocks. It is off by default.">;

clang/include/clang/Parse/Parser.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,10 @@ class Parser : public CodeCompletionHandler {
18771877
UnaryExprOnly,
18781878
PrimaryExprOnly
18791879
};
1880+
1881+
bool isRevertibleTypeTrait(const IdentifierInfo *Id,
1882+
clang::tok::TokenKind *Kind = nullptr);
1883+
18801884
ExprResult ParseCastExpression(CastParseKind ParseKind,
18811885
bool isAddressOfOperand,
18821886
bool &NotCastExpr,

clang/include/clang/Sema/Overload.h

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ class Sema;
201201
/// HLSL non-decaying array rvalue cast.
202202
ICK_HLSL_Array_RValue,
203203

204+
// HLSL vector splat from scalar or boolean type.
205+
ICK_HLSL_Vector_Splat,
206+
204207
/// The number of conversion kinds
205208
ICK_Num_Conversion_Kinds,
206209
};
@@ -213,15 +216,27 @@ class Sema;
213216
/// Exact Match
214217
ICR_Exact_Match = 0,
215218

219+
/// HLSL Scalar Widening
220+
ICR_HLSL_Scalar_Widening,
221+
216222
/// Promotion
217223
ICR_Promotion,
218224

225+
/// HLSL Scalar Widening with promotion
226+
ICR_HLSL_Scalar_Widening_Promotion,
227+
228+
/// HLSL Matching Dimension Reduction
229+
ICR_HLSL_Dimension_Reduction,
230+
219231
/// Conversion
220232
ICR_Conversion,
221233

222234
/// OpenCL Scalar Widening
223235
ICR_OCL_Scalar_Widening,
224236

237+
/// HLSL Scalar Widening with conversion
238+
ICR_HLSL_Scalar_Widening_Conversion,
239+
225240
/// Complex <-> Real conversion
226241
ICR_Complex_Real_Conversion,
227242

@@ -233,11 +248,21 @@ class Sema;
233248

234249
/// Conversion not allowed by the C standard, but that we accept as an
235250
/// extension anyway.
236-
ICR_C_Conversion_Extension
251+
ICR_C_Conversion_Extension,
252+
253+
/// HLSL Dimension reduction with promotion
254+
ICR_HLSL_Dimension_Reduction_Promotion,
255+
256+
/// HLSL Dimension reduction with conversion
257+
ICR_HLSL_Dimension_Reduction_Conversion,
237258
};
238259

239260
ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind);
240261

262+
ImplicitConversionRank
263+
GetDimensionConversionRank(ImplicitConversionRank Base,
264+
ImplicitConversionKind Dimension);
265+
241266
/// NarrowingKind - The kind of narrowing conversion being performed by a
242267
/// standard conversion sequence according to C++11 [dcl.init.list]p7.
243268
enum NarrowingKind {
@@ -277,11 +302,10 @@ class Sema;
277302
/// pointer-to-member conversion, or boolean conversion.
278303
ImplicitConversionKind Second : 8;
279304

280-
/// Element - Between the second and third conversion a vector or matrix
281-
/// element conversion may occur. If this is not ICK_Identity this
282-
/// conversion is applied element-wise to each element in the vector or
283-
/// matrix.
284-
ImplicitConversionKind Element : 8;
305+
/// Dimension - Between the second and third conversion a vector or matrix
306+
/// dimension conversion may occur. If this is not ICK_Identity this
307+
/// conversion truncates the vector or matrix, or extends a scalar.
308+
ImplicitConversionKind Dimension : 8;
285309

286310
/// Third - The third conversion can be a qualification conversion
287311
/// or a function conversion.
@@ -379,7 +403,7 @@ class Sema;
379403
void setAsIdentityConversion();
380404

381405
bool isIdentityConversion() const {
382-
return Second == ICK_Identity && Element == ICK_Identity &&
406+
return Second == ICK_Identity && Dimension == ICK_Identity &&
383407
Third == ICK_Identity;
384408
}
385409

clang/lib/AST/ASTConcept.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,31 @@
1919

2020
using namespace clang;
2121

22-
namespace {
23-
void CreatUnsatisfiedConstraintRecord(
24-
const ASTContext &C, const UnsatisfiedConstraintRecord &Detail,
25-
UnsatisfiedConstraintRecord *TrailingObject) {
26-
if (Detail.second.is<Expr *>())
27-
new (TrailingObject) UnsatisfiedConstraintRecord{
28-
Detail.first,
29-
UnsatisfiedConstraintRecord::second_type(Detail.second.get<Expr *>())};
22+
static void
23+
CreateUnsatisfiedConstraintRecord(const ASTContext &C,
24+
const UnsatisfiedConstraintRecord &Detail,
25+
UnsatisfiedConstraintRecord *TrailingObject) {
26+
if (Detail.is<Expr *>())
27+
new (TrailingObject) UnsatisfiedConstraintRecord(Detail.get<Expr *>());
3028
else {
3129
auto &SubstitutionDiagnostic =
32-
*Detail.second.get<std::pair<SourceLocation, StringRef> *>();
30+
*Detail.get<std::pair<SourceLocation, StringRef> *>();
3331
unsigned MessageSize = SubstitutionDiagnostic.second.size();
3432
char *Mem = new (C) char[MessageSize];
3533
memcpy(Mem, SubstitutionDiagnostic.second.data(), MessageSize);
3634
auto *NewSubstDiag = new (C) std::pair<SourceLocation, StringRef>(
3735
SubstitutionDiagnostic.first, StringRef(Mem, MessageSize));
38-
new (TrailingObject) UnsatisfiedConstraintRecord{
39-
Detail.first, UnsatisfiedConstraintRecord::second_type(NewSubstDiag)};
36+
new (TrailingObject) UnsatisfiedConstraintRecord(NewSubstDiag);
4037
}
4138
}
42-
} // namespace
4339

4440
ASTConstraintSatisfaction::ASTConstraintSatisfaction(
4541
const ASTContext &C, const ConstraintSatisfaction &Satisfaction)
4642
: NumRecords{Satisfaction.Details.size()},
4743
IsSatisfied{Satisfaction.IsSatisfied}, ContainsErrors{
4844
Satisfaction.ContainsErrors} {
4945
for (unsigned I = 0; I < NumRecords; ++I)
50-
CreatUnsatisfiedConstraintRecord(
46+
CreateUnsatisfiedConstraintRecord(
5147
C, Satisfaction.Details[I],
5248
getTrailingObjects<UnsatisfiedConstraintRecord>() + I);
5349
}
@@ -58,7 +54,7 @@ ASTConstraintSatisfaction::ASTConstraintSatisfaction(
5854
IsSatisfied{Satisfaction.IsSatisfied},
5955
ContainsErrors{Satisfaction.ContainsErrors} {
6056
for (unsigned I = 0; I < NumRecords; ++I)
61-
CreatUnsatisfiedConstraintRecord(
57+
CreateUnsatisfiedConstraintRecord(
6258
C, *(Satisfaction.begin() + I),
6359
getTrailingObjects<UnsatisfiedConstraintRecord>() + I);
6460
}

0 commit comments

Comments
 (0)