Skip to content

Commit b37c675

Browse files
authored
merge main into amd-staging (llvm#2061)
2 parents 1f37a9f + 0606f66 commit b37c675

File tree

194 files changed

+4810
-1782
lines changed

Some content is hidden

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

194 files changed

+4810
-1782
lines changed

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6127,6 +6127,16 @@ the configuration (without a prefix: ``Auto``).
61276127
true: false:
61286128
! someExpression(); vs. !someExpression();
61296129

6130+
.. _SpaceAfterOperatorKeyword:
6131+
6132+
**SpaceAfterOperatorKeyword** (``Boolean``) :versionbadge:`clang-format 21` :ref:`<SpaceAfterOperatorKeyword>`
6133+
If ``true``, a space will be inserted after the ``operator`` keyword.
6134+
6135+
.. code-block:: c++
6136+
6137+
true: false:
6138+
bool operator ==(int a); vs. bool operator==(int a);
6139+
61306140
.. _SpaceAfterTemplateKeyword:
61316141

61326142
**SpaceAfterTemplateKeyword** (``Boolean``) :versionbadge:`clang-format 4` :ref:`<SpaceAfterTemplateKeyword>`

clang/docs/LanguageExtensions.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,18 +1859,12 @@ The following type trait primitives are supported by Clang. Those traits marked
18591859
* ``__is_trivially_constructible`` (C++, GNU, Microsoft)
18601860
* ``__is_trivially_copyable`` (C++, GNU, Microsoft)
18611861
* ``__is_trivially_destructible`` (C++, MSVC 2013)
1862-
* ``__is_trivially_relocatable`` (Clang) (Deprecated,
1863-
use ``__builtin_is_cpp_trivially_relocatable`` instead).
1864-
Returns true if moving an object
1862+
* ``__is_trivially_relocatable`` (Clang): Returns true if moving an object
18651863
of the given type, and then destroying the source object, is known to be
18661864
functionally equivalent to copying the underlying bytes and then dropping the
18671865
source object on the floor. This is true of trivial types,
18681866
C++26 relocatable types, and types which
18691867
were made trivially relocatable via the ``clang::trivial_abi`` attribute.
1870-
This trait is deprecated and should be replaced by
1871-
``__builtin_is_cpp_trivially_relocatable``. Note however that it is generally
1872-
unsafe to relocate a C++-relocatable type with ``memcpy`` or ``memmove``;
1873-
use ``__builtin_trivially_relocate``.
18741868
* ``__builtin_is_cpp_trivially_relocatable`` (C++): Returns true if an object
18751869
is trivially relocatable, as defined by the C++26 standard [meta.unary.prop].
18761870
Note that when relocating the caller code should ensure that if the object is polymorphic,

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ Modified Compiler Flags
319319

320320
- The ``-mexecute-only`` and ``-mpure-code`` flags are now accepted for AArch64 targets. (#GH125688)
321321

322+
- The ``-fchar8_t`` flag is no longer considered in non-C++ languages modes. (#GH55373)
323+
322324
Removed Compiler Flags
323325
-------------------------
324326

@@ -580,6 +582,8 @@ Bug Fixes in This Version
580582
the invalid attribute location appropriately. (#GH137861)
581583
- Fixed a crash when a malformed ``_Pragma`` directive appears as part of an
582584
``#include`` directive. (#GH138094)
585+
- Fixed a crash during constant evaluation involving invalid lambda captures
586+
(#GH138832)
583587

584588
Bug Fixes to Compiler Builtins
585589
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -593,15 +597,6 @@ Bug Fixes to Compiler Builtins
593597
- ``__has_unique_object_representations(Incomplete[])`` is no longer accepted, per
594598
`LWG4113 <https://cplusplus.github.io/LWG/issue4113>`_.
595599

596-
- ``__builtin_is_cpp_trivially_relocatable``, ``__builtin_is_replaceable`` and
597-
``__builtin_trivially_relocate`` have been added to support standard C++26 relocation.
598-
599-
- ``__is_trivially_relocatable`` has been deprecated, and uses should be replaced by
600-
``__builtin_is_cpp_trivially_relocatable``.
601-
Note that, it is generally unsafe to ``memcpy`` non-trivially copyable types that
602-
are ``__builtin_is_cpp_trivially_relocatable``. It is recommended to use
603-
``__builtin_trivially_relocate`` instead.
604-
605600
Bug Fixes to Attribute Support
606601
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
607602
- Fixed crash when a parameter to the ``clang::annotate`` attribute evaluates to ``void``. See #GH119125
@@ -837,6 +832,7 @@ clang-format
837832
- Add ``EnumTrailingComma`` option for inserting/removing commas at the end of
838833
``enum`` enumerator lists.
839834
- Add ``OneLineFormatOffRegex`` option for turning formatting off for one line.
835+
- Add ``SpaceAfterOperatorKeyword`` option.
840836

841837
libclang
842838
--------

clang/include/clang/Basic/TokenKinds.def

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ TYPE_TRAIT_2(__is_pointer_interconvertible_base_of, IsPointerInterconvertibleBas
544544
#include "clang/Basic/TransformTypeTraits.def"
545545

546546
// Clang-only C++ Type Traits
547+
TYPE_TRAIT_1(__is_trivially_relocatable, IsTriviallyRelocatable, KEYCXX)
547548
TYPE_TRAIT_1(__is_trivially_equality_comparable, IsTriviallyEqualityComparable, KEYCXX)
548549
TYPE_TRAIT_1(__is_bounded_array, IsBoundedArray, KEYCXX)
549550
TYPE_TRAIT_1(__is_unbounded_array, IsUnboundedArray, KEYCXX)
@@ -555,11 +556,8 @@ TYPE_TRAIT_2(__reference_converts_from_temporary, ReferenceConvertsFromTemporary
555556
// IsDeducible is only used internally by clang for CTAD implementation and
556557
// is not exposed to users.
557558
TYPE_TRAIT_2(/*EmptySpellingName*/, IsDeducible, KEYCXX)
558-
559-
// __is_trivially_relocatable is deprecated
560-
TYPE_TRAIT_1(__builtin_is_cpp_trivially_relocatable, IsCppTriviallyRelocatable, KEYCXX)
561-
TYPE_TRAIT_1(__is_trivially_relocatable, IsTriviallyRelocatable, KEYCXX)
562559
TYPE_TRAIT_1(__is_bitwise_cloneable, IsBitwiseCloneable, KEYALL)
560+
TYPE_TRAIT_1(__builtin_is_cpp_trivially_relocatable, IsCppTriviallyRelocatable, KEYCXX)
563561
TYPE_TRAIT_1(__builtin_is_replaceable, IsReplaceable, KEYCXX)
564562
TYPE_TRAIT_1(__builtin_structured_binding_size, StructuredBindingSize, KEYCXX)
565563

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4031,7 +4031,8 @@ defm char8__t : BoolFOption<"char8_t",
40314031
LangOpts<"Char8">, Default<cpp20.KeyPath>,
40324032
PosFlag<SetTrue, [], [ClangOption], "Enable">,
40334033
NegFlag<SetFalse, [], [ClangOption], "Disable">,
4034-
BothFlags<[], [ClangOption, CC1Option], " C++ builtin type char8_t">>;
4034+
BothFlags<[], [ClangOption, CC1Option], " C++ builtin type char8_t">>,
4035+
ShouldParseIf<cplusplus.KeyPath>;
40354036
def fshort_wchar : Flag<["-"], "fshort-wchar">, Group<f_Group>,
40364037
HelpText<"Force wchar_t to be a short unsigned int">;
40374038
def fno_short_wchar : Flag<["-"], "fno-short-wchar">, Group<f_Group>,

clang/include/clang/Format/Format.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4484,6 +4484,14 @@ struct FormatStyle {
44844484
/// \version 9
44854485
bool SpaceAfterLogicalNot;
44864486

4487+
/// If ``true``, a space will be inserted after the ``operator`` keyword.
4488+
/// \code
4489+
/// true: false:
4490+
/// bool operator ==(int a); vs. bool operator==(int a);
4491+
/// \endcode
4492+
/// \version 21
4493+
bool SpaceAfterOperatorKeyword;
4494+
44874495
/// If \c true, a space will be inserted after the ``template`` keyword.
44884496
/// \code
44894497
/// true: false:
@@ -5454,6 +5462,7 @@ struct FormatStyle {
54545462
SortJavaStaticImport == R.SortJavaStaticImport &&
54555463
SpaceAfterCStyleCast == R.SpaceAfterCStyleCast &&
54565464
SpaceAfterLogicalNot == R.SpaceAfterLogicalNot &&
5465+
SpaceAfterOperatorKeyword == R.SpaceAfterOperatorKeyword &&
54575466
SpaceAfterTemplateKeyword == R.SpaceAfterTemplateKeyword &&
54585467
SpaceBeforeAssignmentOperators == R.SpaceBeforeAssignmentOperators &&
54595468
SpaceBeforeCaseColon == R.SpaceBeforeCaseColon &&

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,10 +2932,9 @@ bool Compiler<Emitter>::VisitLambdaExpr(const LambdaExpr *E) {
29322932
// record with their initializers.
29332933
for (const Record::Field &F : R->fields()) {
29342934
const Expr *Init = *CaptureInitIt;
2935-
++CaptureInitIt;
2936-
2937-
if (!Init)
2935+
if (!Init || Init->containsErrors())
29382936
continue;
2937+
++CaptureInitIt;
29392938

29402939
if (std::optional<PrimType> T = classify(Init)) {
29412940
if (!this->visit(Init))

clang/lib/AST/ExprConstant.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11038,7 +11038,7 @@ bool RecordExprEvaluator::VisitLambdaExpr(const LambdaExpr *E) {
1103811038

1103911039
// If there is no initializer, either this is a VLA or an error has
1104011040
// occurred.
11041-
if (!CurFieldInit)
11041+
if (!CurFieldInit || CurFieldInit->containsErrors())
1104211042
return Error(E);
1104311043

1104411044
LValue Subobject = This;

clang/lib/Basic/Targets/X86.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo
866866
switch (CC) {
867867
case CC_C:
868868
case CC_Win64:
869+
case CC_X86_64SysV:
869870
return CCCR_OK;
870871
default:
871872
return CCCR_Warning;

clang/lib/CodeGen/CGCall.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ CodeGenTypes::arrangeFreeFunctionType(CanQual<FunctionProtoType> FTP) {
254254
}
255255

256256
static CallingConv getCallingConventionForDecl(const ObjCMethodDecl *D,
257-
bool IsWindows) {
257+
bool IsTargetDefaultMSABI) {
258258
// Set the appropriate calling convention for the Function.
259259
if (D->hasAttr<StdCallAttr>())
260260
return CC_X86StdCall;
@@ -290,10 +290,10 @@ static CallingConv getCallingConventionForDecl(const ObjCMethodDecl *D,
290290
return CC_IntelOclBicc;
291291

292292
if (D->hasAttr<MSABIAttr>())
293-
return IsWindows ? CC_C : CC_Win64;
293+
return IsTargetDefaultMSABI ? CC_C : CC_Win64;
294294

295295
if (D->hasAttr<SysVABIAttr>())
296-
return IsWindows ? CC_X86_64SysV : CC_C;
296+
return IsTargetDefaultMSABI ? CC_X86_64SysV : CC_C;
297297

298298
if (D->hasAttr<PreserveMostAttr>())
299299
return CC_PreserveMost;
@@ -581,8 +581,11 @@ CodeGenTypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD,
581581
}
582582

583583
FunctionType::ExtInfo einfo;
584-
bool IsWindows = getContext().getTargetInfo().getTriple().isOSWindows();
585-
einfo = einfo.withCallingConv(getCallingConventionForDecl(MD, IsWindows));
584+
bool IsTargetDefaultMSABI =
585+
getContext().getTargetInfo().getTriple().isOSWindows() ||
586+
getContext().getTargetInfo().getTriple().isUEFI();
587+
einfo = einfo.withCallingConv(
588+
getCallingConventionForDecl(MD, IsTargetDefaultMSABI));
586589

587590
if (getContext().getLangOpts().ObjCAutoRefCount &&
588591
MD->hasAttr<NSReturnsRetainedAttr>())

0 commit comments

Comments
 (0)