Skip to content

Commit 19bec82

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-retain-exits
2 parents de0fc2d + 282af2d commit 19bec82

File tree

742 files changed

+15840
-22253
lines changed

Some content is hidden

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

742 files changed

+15840
-22253
lines changed

clang/docs/CommandGuide/clang.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ Language Selection and Mode Options
155155
156156
ISO C 2023 with GNU extensions
157157

158+
| ``c2y``
159+
160+
ISO C 202y
161+
162+
| ``gnu2y``
163+
164+
ISO C 202y with GNU extensions
165+
158166
The default C language standard is ``gnu17``, except on PS4, where it is
159167
``gnu99``.
160168

clang/docs/InternalsManual.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Description:
276276
diagnostic instead of having to do things textually. The selected string
277277
does undergo formatting.
278278

279-
**"enum_select format**
279+
**"enum_select" format**
280280

281281
Example:
282282
``unknown frobbling of a %enum_select<FrobbleKind>{%VarDecl{variable declaration}|%FuncDecl{function declaration}}0 when blarging``

clang/docs/LanguageExtensions.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1680,6 +1680,7 @@ Static assert with user-generated message __cpp_static_assert >= 202306L C
16801680
Pack Indexing __cpp_pack_indexing C++26 C++03
16811681
``= delete ("should have a reason");`` __cpp_deleted_function C++26 C++03
16821682
Variadic Friends __cpp_variadic_friend C++26 C++03
1683+
Trivial Relocatability __cpp_trivial_relocatability C++26 C++03
16831684
--------------------------------------------- -------------------------------- ------------- -------------
16841685
Designated initializers (N494) C99 C89
16851686
Array & element qualification (N2607) C23 C89
@@ -1861,8 +1862,15 @@ The following type trait primitives are supported by Clang. Those traits marked
18611862
* ``__is_trivially_relocatable`` (Clang): Returns true if moving an object
18621863
of the given type, and then destroying the source object, is known to be
18631864
functionally equivalent to copying the underlying bytes and then dropping the
1864-
source object on the floor. This is true of trivial types and types which
1865+
source object on the floor. This is true of trivial types,
1866+
C++26 relocatable types, and types which
18651867
were made trivially relocatable via the ``clang::trivial_abi`` attribute.
1868+
* ``__builtin_is_cpp_trivially_relocatable`` (C++): Returns true if an object
1869+
is trivially relocatable, as defined by the C++26 standard [meta.unary.prop].
1870+
Note that when relocating the caller code should ensure that if the object is polymorphic,
1871+
the dynamic type is of the most derived type. Padding bytes should not be copied.
1872+
* ``__builtin_is_replaceable`` (C++): Returns true if an object
1873+
is replaceable, as defined by the C++26 standard [meta.unary.prop].
18661874
* ``__is_trivially_equality_comparable`` (Clang): Returns true if comparing two
18671875
objects of the provided type is known to be equivalent to comparing their
18681876
object representations. Note that types containing padding bytes are never
@@ -3722,6 +3730,21 @@ Query for this feature with ``__has_builtin(__builtin_operator_new)`` or
37223730
replaceable global (de)allocation functions, but do support calling at least
37233731
``::operator new(size_t)`` and ``::operator delete(void*)``.
37243732
3733+
3734+
``__builtin_trivially_relocate``
3735+
-----------------------------------
3736+
3737+
**Syntax**:
3738+
3739+
.. code-block:: c
3740+
3741+
T* __builtin_trivially_relocate(T* dest, T* src, size_t count)
3742+
3743+
Trivially relocates ``count`` objects of relocatable, complete type ``T``
3744+
from ``src`` to ``dest`` and returns ``dest``.
3745+
This builtin is used to implement ``std::trivially_relocate``.
3746+
3747+
37253748
``__builtin_preserve_access_index``
37263749
-----------------------------------
37273750

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ C++2c Feature Support
106106
^^^^^^^^^^^^^^^^^^^^^
107107

108108
- Implemented `P1061R10 Structured Bindings can introduce a Pack <https://wg21.link/P1061R10>`_.
109+
- Implemented `P2786R13 Trivial Relocatability <https://wg21.link/P2786R13>`_.
110+
109111

110112
- Implemented `P0963R3 Structured binding declaration as a condition <https://wg21.link/P0963R3>`_.
111113

@@ -287,6 +289,8 @@ Non-comprehensive list of changes in this release
287289
stack space when running on Apple AArch64 based platforms. This means that
288290
stack traces of Clang from debuggers, crashes, and profilers may look
289291
different than before.
292+
- Fixed a crash when a VLA with an invalid size expression was used within a
293+
``sizeof`` or ``typeof`` expression. (#GH138444)
290294

291295
New Compiler Flags
292296
------------------
@@ -592,6 +596,9 @@ Bug Fixes to Attribute Support
592596
``__attribute__((unused))`` are still ignored after the definition, though
593597
this behavior may be relaxed in the future). (#GH135481)
594598

599+
- Clang will warn if a complete type specializes a deprecated partial specialization.
600+
(#GH44496)
601+
595602
Bug Fixes to C++ Support
596603
^^^^^^^^^^^^^^^^^^^^^^^^
597604

clang/include/clang/AST/ASTContext.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,20 @@ class ASTContext : public RefCountedBase<ASTContext> {
617617
using ParameterIndexTable = llvm::DenseMap<const VarDecl *, unsigned>;
618618
ParameterIndexTable ParamIndices;
619619

620+
public:
621+
struct CXXRecordDeclRelocationInfo {
622+
unsigned IsRelocatable;
623+
unsigned IsReplaceable;
624+
};
625+
std::optional<CXXRecordDeclRelocationInfo>
626+
getRelocationInfoForCXXRecord(const CXXRecordDecl *) const;
627+
void setRelocationInfoForCXXRecord(const CXXRecordDecl *,
628+
CXXRecordDeclRelocationInfo);
629+
630+
private:
631+
llvm::DenseMap<const CXXRecordDecl *, CXXRecordDeclRelocationInfo>
632+
RelocatableClasses;
633+
620634
ImportDecl *FirstLocalImport = nullptr;
621635
ImportDecl *LastLocalImport = nullptr;
622636

clang/include/clang/AST/DeclCXX.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,9 @@ class CXXRecordDecl : public RecordDecl {
15501550
/// Returns the destructor decl for this class.
15511551
CXXDestructorDecl *getDestructor() const;
15521552

1553+
/// Returns the destructor decl for this class.
1554+
bool hasDeletedDestructor() const;
1555+
15531556
/// Returns true if the class destructor, or any implicitly invoked
15541557
/// destructors are marked noreturn.
15551558
bool isAnyDestructorNoReturn() const { return data().IsAnyDestructorNoReturn; }

clang/include/clang/AST/Type.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,9 +1133,6 @@ class QualType {
11331133
/// Return true if this is a trivially copyable type
11341134
bool isTriviallyCopyConstructibleType(const ASTContext &Context) const;
11351135

1136-
/// Return true if this is a trivially relocatable type.
1137-
bool isTriviallyRelocatableType(const ASTContext &Context) const;
1138-
11391136
/// Returns true if it is a class and it might be dynamic.
11401137
bool mayBeDynamicClass() const;
11411138

clang/include/clang/Basic/Attr.td

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,6 +1819,22 @@ def Final : InheritableAttr {
18191819
let Documentation = [InternalOnly];
18201820
}
18211821

1822+
def TriviallyRelocatable : InheritableAttr {
1823+
let Spellings = [CustomKeyword<"trivially_relocatable_if_eligible">];
1824+
let SemaHandler = 0;
1825+
// Omitted from docs, since this is language syntax, not an attribute, as far
1826+
// as users are concerned.
1827+
let Documentation = [InternalOnly];
1828+
}
1829+
1830+
def Replaceable : InheritableAttr {
1831+
let Spellings = [CustomKeyword<"replaceable_if_eligible">];
1832+
let SemaHandler = 0;
1833+
// Omitted from docs, since this is language syntax, not an attribute, as far
1834+
// as users are concerned.
1835+
let Documentation = [InternalOnly];
1836+
}
1837+
18221838
def MinSize : InheritableAttr {
18231839
let Spellings = [Clang<"minsize">];
18241840
let Subjects = SubjectList<[Function, ObjCMethod], ErrorDiag>;

clang/include/clang/Basic/Builtins.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2853,6 +2853,12 @@ def MemMove : LibBuiltin<"string.h"> {
28532853
let AddBuiltinPrefixedAlias = 1;
28542854
}
28552855

2856+
def BuiltinTriviallyRelocate : Builtin {
2857+
let Spellings = ["__builtin_trivially_relocate"];
2858+
let Attributes = [FunctionWithBuiltinPrefix, CustomTypeChecking, NoThrow];
2859+
let Prototype = "void*(void*, void*, size_t)";
2860+
}
2861+
28562862
def StrCpy : LibBuiltin<"string.h"> {
28572863
let Spellings = ["strcpy"];
28582864
let Attributes = [NoThrow];

clang/include/clang/Basic/BuiltinsRISCVXCV.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ let Attributes = [NoThrow, Const] in {
2121
//===----------------------------------------------------------------------===//
2222
// XCValu extension.
2323
//===----------------------------------------------------------------------===//
24-
def alu_slet : RISCVXCVBuiltin<"int(int, int)", "xcvalu">;
25-
def alu_sletu : RISCVXCVBuiltin<"int(unsigned int, unsigned int)", "xcvalu">;
24+
def alu_sle : RISCVXCVBuiltin<"int(int, int)", "xcvalu">;
25+
def alu_sleu : RISCVXCVBuiltin<"int(unsigned int, unsigned int)", "xcvalu">;
2626
def alu_exths : RISCVXCVBuiltin<"int(int)", "xcvalu">;
2727
def alu_exthz : RISCVXCVBuiltin<"unsigned int(unsigned int)", "xcvalu">;
2828
def alu_extbs : RISCVXCVBuiltin<"int(int)", "xcvalu">;

0 commit comments

Comments
 (0)