Skip to content

Commit 10bf768

Browse files
committed
merge main into amd-staging
Change-Id: Iccdd9149e13cfb979850525c01862f8c48403b43
2 parents a914b45 + 7cc4aa4 commit 10bf768

File tree

868 files changed

+37900
-12203
lines changed

Some content is hidden

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

868 files changed

+37900
-12203
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ autoconf/autom4te.cache
5151
/CMakeSettings.json
5252
# CLion project configuration
5353
/.idea
54+
/cmake-build*
5455

5556
#==============================================================================#
5657
# Directories to ignore (do not add trailing '/'s, they skip symlinks).

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,15 @@ Changes in existing checks
162162
<clang-tidy/checks/misc/definitions-in-headers>` check by rewording the
163163
diagnostic note that suggests adding ``inline``.
164164

165+
- Improved :doc:`misc-unconventional-assign-operator
166+
<clang-tidy/checks/misc/unconventional-assign-operator>` check to avoid
167+
false positive for C++23 deducing this.
168+
165169
- Improved :doc:`modernize-avoid-c-arrays
166170
<clang-tidy/checks/modernize/avoid-c-arrays>` check to suggest using ``std::span``
167171
as a replacement for parameters of incomplete C array type in C++20 and
168172
``std::array`` or ``std::vector`` before C++20.
169173

170-
- Improved :doc:`modernize-use-std-format
171-
<clang-tidy/checks/modernize/use-std-format>` check to support replacing
172-
member function calls too.
173-
174-
- Improved :doc:`misc-unconventional-assign-operator
175-
<clang-tidy/checks/misc/unconventional-assign-operator>` check to avoid
176-
false positive for C++23 deducing this.
177-
178174
- Improved :doc:`modernize-min-max-use-initializer-list
179175
<clang-tidy/checks/modernize/min-max-use-initializer-list>` check by fixing
180176
a false positive when only an implicit conversion happened inside an
@@ -184,15 +180,14 @@ Changes in existing checks
184180
<clang-tidy/checks/modernize/use-nullptr>` check to also recognize
185181
``NULL``/``__null`` (but not ``0``) when used with a templated type.
186182

183+
- Improved :doc:`modernize-use-std-format
184+
<clang-tidy/checks/modernize/use-std-format>` check to support replacing
185+
member function calls too.
186+
187187
- Improved :doc:`modernize-use-std-print
188188
<clang-tidy/checks/modernize/use-std-print>` check to support replacing
189189
member function calls too.
190190

191-
- Improved :doc:`readability-enum-initial-value
192-
<clang-tidy/checks/readability/enum-initial-value>` check by only issuing
193-
diagnostics for the definition of an ``enum``, and by fixing a typo in the
194-
diagnostic.
195-
196191
- Improved :doc:`performance-avoid-endl
197192
<clang-tidy/checks/performance/avoid-endl>` check to use ``std::endl`` as
198193
placeholder when lexer cannot get source text.
@@ -201,6 +196,11 @@ Changes in existing checks
201196
<clang-tidy/checks/readability/container-contains>` check to let it work on
202197
any class that has a ``contains`` method.
203198

199+
- Improved :doc:`readability-enum-initial-value
200+
<clang-tidy/checks/readability/enum-initial-value>` check by only issuing
201+
diagnostics for the definition of an ``enum``, and by fixing a typo in the
202+
diagnostic.
203+
204204
- Improved :doc:`readability-implicit-bool-conversion
205205
<clang-tidy/checks/readability/implicit-bool-conversion>` check
206206
by adding the option `UseUpperCaseLiteralSuffix` to select the

clang/cmake/caches/Release.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,6 @@ set_final_stage_var(LLVM_ENABLE_PROJECTS "${LLVM_RELEASE_ENABLE_PROJECTS}" STRIN
109109
set_final_stage_var(CPACK_GENERATOR "TXZ" STRING)
110110
set_final_stage_var(CPACK_ARCHIVE_THREADS "0" STRING)
111111

112+
if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
113+
set_final_stage_var(LLVM_USE_STATIC_ZSTD "ON" BOOL)
114+
endif()

clang/docs/LanguageExtensions.rst

Lines changed: 90 additions & 73 deletions
Large diffs are not rendered by default.

clang/docs/ReleaseNotes.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ C++ Language Changes
144144

145145
- Add ``__builtin_elementwise_fmod`` builtin for floating point types only.
146146

147+
- Add ``__builtin_elementwise_minimum`` and ``__builtin_elementwise_maximum``
148+
builtin for floating point types only.
149+
147150
- The builtin type alias ``__builtin_common_type`` has been added to improve the
148151
performance of ``std::common_type``.
149152

@@ -175,6 +178,10 @@ C++23 Feature Support
175178
C++20 Feature Support
176179
^^^^^^^^^^^^^^^^^^^^^
177180

181+
C++17 Feature Support
182+
^^^^^^^^^^^^^^^^^^^^^
183+
- The implementation of the relaxed template template argument matching rules is
184+
more complete and reliable, and should provide more accurate diagnostics.
178185

179186
Resolutions to C++ Defect Reports
180187
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -352,6 +359,10 @@ Improvements to Clang's diagnostics
352359

353360
- Clang now diagnoses when the result of a [[nodiscard]] function is discarded after being cast in C. Fixes #GH104391.
354361

362+
- Clang now properly explains the reason a template template argument failed to
363+
match a template template parameter, in terms of the C++17 relaxed matching rules
364+
instead of the old ones.
365+
355366
- Don't emit duplicated dangling diagnostics. (#GH93386).
356367

357368
- Improved diagnostic when trying to befriend a concept. (#GH45182).
@@ -449,6 +460,8 @@ Bug Fixes to C++ Support
449460
- Correctly check constraints of explicit instantiations of member functions. (#GH46029)
450461
- When performing partial ordering of function templates, clang now checks that
451462
the deduction was consistent. Fixes (#GH18291).
463+
- Fixes to several issues in partial ordering of template template parameters, which
464+
were documented in the test suite.
452465
- Fixed an assertion failure about a constraint of a friend function template references to a value with greater
453466
template depth than the friend function template. (#GH98258)
454467
- Clang now rebuilds the template parameters of out-of-line declarations and specializations in the context
@@ -477,6 +490,7 @@ Bug Fixes to C++ Support
477490
- Fixed an assertion failure in debug mode, and potential crashes in release mode, when
478491
diagnosing a failed cast caused indirectly by a failed implicit conversion to the type of the constructor parameter.
479492
- Fixed an assertion failure by adjusting integral to boolean vector conversions (#GH108326)
493+
- Fixed an issue deducing non-type template arguments of reference type. (#GH73460)
480494
- Mangle friend function templates with a constraint that depends on a template parameter from an enclosing template as members of the enclosing class. (#GH110247)
481495
- Fixed an issue in constraint evaluation, where type constraints on the lambda expression
482496
containing outer unexpanded parameters were not correctly expanded. (#GH101754)
@@ -549,7 +563,7 @@ X86 Support
549563

550564
- All intrinsics in bmiintrin.h can now be used in constant expressions.
551565

552-
- All bzhi/pdep/pext intrinsics in bmi2intrin.h can now be used in constant expressions.
566+
- All intrinsics in bmi2intrin.h can now be used in constant expressions.
553567

554568
- All intrinsics in tbmintrin.h can now be used in constant expressions.
555569

@@ -600,6 +614,8 @@ DWARF Support in Clang
600614
Floating Point Support in Clang
601615
-------------------------------
602616

617+
- Add ``__builtin_elementwise_atan2`` builtin for floating point types only.
618+
603619
Fixed Point Support in Clang
604620
----------------------------
605621

clang/include/clang/AST/CanonicalType.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ class CanProxyBase {
299299
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isDependentType)
300300
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isOverloadableType)
301301
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isArrayType)
302+
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isConstantArrayType)
302303
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasPointerRepresentation)
303304
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasObjCPointerRepresentation)
304305
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasIntegerRepresentation)

clang/include/clang/Basic/Builtins.td

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,12 @@ def ElementwiseATan : Builtin {
12501250
let Prototype = "void(...)";
12511251
}
12521252

1253+
def ElementwiseATan2 : Builtin {
1254+
let Spellings = ["__builtin_elementwise_atan2"];
1255+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1256+
let Prototype = "void(...)";
1257+
}
1258+
12531259
def ElementwiseBitreverse : Builtin {
12541260
let Spellings = ["__builtin_elementwise_bitreverse"];
12551261
let Attributes = [NoThrow, Const, CustomTypeChecking];
@@ -1268,6 +1274,18 @@ def ElementwiseMin : Builtin {
12681274
let Prototype = "void(...)";
12691275
}
12701276

1277+
def ElementwiseMaximum : Builtin {
1278+
let Spellings = ["__builtin_elementwise_maximum"];
1279+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1280+
let Prototype = "void(...)";
1281+
}
1282+
1283+
def ElementwiseMinimum : Builtin {
1284+
let Spellings = ["__builtin_elementwise_minimum"];
1285+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1286+
let Prototype = "void(...)";
1287+
}
1288+
12711289
def ElementwiseCeil : Builtin {
12721290
let Spellings = ["__builtin_elementwise_ceil"];
12731291
let Attributes = [NoThrow, Const, CustomTypeChecking];
@@ -1442,6 +1460,18 @@ def ReduceMin : Builtin {
14421460
let Prototype = "void(...)";
14431461
}
14441462

1463+
def ReduceMaximum : Builtin {
1464+
let Spellings = ["__builtin_reduce_maximum"];
1465+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1466+
let Prototype = "void(...)";
1467+
}
1468+
1469+
def ReduceMinimum : Builtin {
1470+
let Spellings = ["__builtin_reduce_minimum"];
1471+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1472+
let Prototype = "void(...)";
1473+
}
1474+
14451475
def ReduceXor : Builtin {
14461476
let Spellings = ["__builtin_reduce_xor"];
14471477
let Attributes = [NoThrow, Const, CustomTypeChecking];

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5262,6 +5262,13 @@ def note_template_arg_refers_here_func : Note<
52625262
def err_template_arg_template_params_mismatch : Error<
52635263
"template template argument has different template parameters than its "
52645264
"corresponding template template parameter">;
5265+
def note_template_arg_template_params_mismatch : Note<
5266+
"template template argument has different template parameters than its "
5267+
"corresponding template template parameter">;
5268+
def err_non_deduced_mismatch : Error<
5269+
"could not match %diff{$ against $|types}0,1">;
5270+
def err_inconsistent_deduction : Error<
5271+
"conflicting deduction %diff{$ against $|types}0,1 for parameter">;
52655272
def err_template_arg_not_integral_or_enumeral : Error<
52665273
"non-type template argument of type %0 must have an integral or enumeration"
52675274
" type">;
@@ -12212,7 +12219,8 @@ def err_builtin_invalid_arg_type: Error <
1221212219
"a floating point type|"
1221312220
"a vector of integers|"
1221412221
"an unsigned integer|"
12215-
"an 'int'}1 (was %2)">;
12222+
"an 'int'|"
12223+
"a vector of floating points}1 (was %2)">;
1221612224

1221712225
def err_builtin_matrix_disabled: Error<
1221812226
"matrix types extension is disabled. Pass -fenable-matrix to enable it">;

clang/include/clang/Basic/DiagnosticSerializationKinds.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def note_pch_vfsoverlay_files : Note<"%select{PCH|current translation unit}0 has
5151
def note_pch_vfsoverlay_empty : Note<"%select{PCH|current translation unit}0 has no VFS overlays">;
5252

5353
def err_ast_file_version_too_old : Error<
54-
"%select{PCH|module|AST}0 file '%1' uses an older PCH format that is no longer supported">;
54+
"%select{PCH|module|AST}0 file '%1' uses an older format that is no longer supported">;
5555
def err_ast_file_version_too_new : Error<
56-
"%select{PCH|module|AST}0 file '%1' uses a newer PCH format that cannot be read">;
56+
"%select{PCH|module|AST}0 file '%1' uses a newer format that cannot be read">;
5757
def err_ast_file_different_branch : Error<
5858
"%select{PCH|module|AST}0 file '%1' built from a different branch (%2) than the compiler (%3)">;
5959
def err_ast_file_with_compiler_errors : Error<

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ def _DASH_DASH : Option<["--"], "", KIND_REMAINING_ARGS>,
816816
def A : JoinedOrSeparate<["-"], "A">, Flags<[RenderJoined]>,
817817
Group<gfortran_Group>;
818818
def B : JoinedOrSeparate<["-"], "B">, MetaVarName<"<prefix>">,
819+
Visibility<[ClangOption, FlangOption]>,
819820
HelpText<"Search $prefix$file for executables, libraries, and data files. "
820821
"If $prefix is a directory, search $prefix/$file">;
821822
def gcc_install_dir_EQ : Joined<["--"], "gcc-install-dir=">,

clang/include/clang/Sema/Sema.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,7 +2381,8 @@ class Sema final : public SemaBase {
23812381
bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
23822382
const FunctionProtoType *Proto);
23832383

2384-
bool BuiltinVectorMath(CallExpr *TheCall, QualType &Res);
2384+
/// \param FPOnly restricts the arguments to floating-point types.
2385+
bool BuiltinVectorMath(CallExpr *TheCall, QualType &Res, bool FPOnly = false);
23852386
bool BuiltinVectorToScalarMath(CallExpr *TheCall);
23862387

23872388
/// Handles the checks for format strings, non-POD arguments to vararg
@@ -2573,7 +2574,8 @@ class Sema final : public SemaBase {
25732574
ExprResult AtomicOpsOverloaded(ExprResult TheCallResult,
25742575
AtomicExpr::AtomicOp Op);
25752576

2576-
bool BuiltinElementwiseMath(CallExpr *TheCall);
2577+
/// \param FPOnly restricts the arguments to floating-point types.
2578+
bool BuiltinElementwiseMath(CallExpr *TheCall, bool FPOnly = false);
25772579
bool PrepareBuiltinReduceMathOneArgCall(CallExpr *TheCall);
25782580

25792581
bool BuiltinNonDeterministicValue(CallExpr *TheCall);
@@ -12482,8 +12484,9 @@ class Sema final : public SemaBase {
1248212484
sema::TemplateDeductionInfo &Info);
1248312485

1248412486
bool isTemplateTemplateParameterAtLeastAsSpecializedAs(
12485-
TemplateParameterList *PParam, TemplateDecl *AArg,
12486-
const DefaultArguments &DefaultArgs, SourceLocation Loc, bool IsDeduced);
12487+
TemplateParameterList *PParam, TemplateDecl *PArg, TemplateDecl *AArg,
12488+
const DefaultArguments &DefaultArgs, SourceLocation ArgLoc,
12489+
bool IsDeduced);
1248712490

1248812491
/// Mark which template parameters are used in a given expression.
1248912492
///
@@ -12792,6 +12795,9 @@ class Sema final : public SemaBase {
1279212795

1279312796
/// We are instantiating a type alias template declaration.
1279412797
TypeAliasTemplateInstantiation,
12798+
12799+
/// We are performing partial ordering for template template parameters.
12800+
PartialOrderingTTP,
1279512801
} Kind;
1279612802

1279712803
/// Was the enclosing context a non-instantiation SFINAE context?
@@ -13013,6 +13019,12 @@ class Sema final : public SemaBase {
1301313019
TemplateDecl *Entity, BuildingDeductionGuidesTag,
1301413020
SourceRange InstantiationRange = SourceRange());
1301513021

13022+
struct PartialOrderingTTP {};
13023+
/// \brief Note that we are partial ordering template template parameters.
13024+
InstantiatingTemplate(Sema &SemaRef, SourceLocation ArgLoc,
13025+
PartialOrderingTTP, TemplateDecl *PArg,
13026+
SourceRange InstantiationRange = SourceRange());
13027+
1301613028
/// Note that we have finished instantiating this template.
1301713029
void Clear();
1301813030

clang/include/module.modulemap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ module Clang_Basic {
6565
textual header "clang/Basic/BuiltinsX86.def"
6666
textual header "clang/Basic/BuiltinsX86_64.def"
6767
textual header "clang/Basic/BuiltinsXCore.def"
68+
textual header "clang/Basic/CFProtectionOptions.def"
6869
textual header "clang/Basic/CodeGenOptions.def"
6970
textual header "clang/Basic/DebugOptions.def"
7071
textual header "clang/Basic/DiagnosticOptions.def"

clang/lib/AST/ByteCode/Interp.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,14 +1641,14 @@ inline bool GetPtrDerivedPop(InterpState &S, CodePtr OpPC, uint32_t Off) {
16411641

16421642
inline bool GetPtrBase(InterpState &S, CodePtr OpPC, uint32_t Off) {
16431643
const Pointer &Ptr = S.Stk.peek<Pointer>();
1644+
if (!CheckNull(S, OpPC, Ptr, CSK_Base))
1645+
return false;
16441646

16451647
if (!Ptr.isBlockPointer()) {
16461648
S.Stk.push<Pointer>(Ptr.asIntPointer().baseCast(S.getASTContext(), Off));
16471649
return true;
16481650
}
16491651

1650-
if (!CheckNull(S, OpPC, Ptr, CSK_Base))
1651-
return false;
16521652
if (!CheckSubobject(S, OpPC, Ptr, CSK_Base))
16531653
return false;
16541654
const Pointer &Result = Ptr.atField(Off);
@@ -1661,13 +1661,14 @@ inline bool GetPtrBase(InterpState &S, CodePtr OpPC, uint32_t Off) {
16611661
inline bool GetPtrBasePop(InterpState &S, CodePtr OpPC, uint32_t Off) {
16621662
const Pointer &Ptr = S.Stk.pop<Pointer>();
16631663

1664+
if (!CheckNull(S, OpPC, Ptr, CSK_Base))
1665+
return false;
1666+
16641667
if (!Ptr.isBlockPointer()) {
16651668
S.Stk.push<Pointer>(Ptr.asIntPointer().baseCast(S.getASTContext(), Off));
16661669
return true;
16671670
}
16681671

1669-
if (!CheckNull(S, OpPC, Ptr, CSK_Base))
1670-
return false;
16711672
if (!CheckSubobject(S, OpPC, Ptr, CSK_Base))
16721673
return false;
16731674
const Pointer &Result = Ptr.atField(Off);

0 commit comments

Comments
 (0)