Skip to content

Commit 01e99c2

Browse files
Merge branch 'llvm:main' into gh-101657
2 parents 3c09908 + 9a7e307 commit 01e99c2

File tree

635 files changed

+12140
-5069
lines changed

Some content is hidden

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

635 files changed

+12140
-5069
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
stage1:
3838
if: github.repository_owner == 'llvm'
3939
runs-on: libcxx-self-hosted-linux
40-
container: ghcr.io/llvm/libcxx-linux-builder:b6bb9dc5abd7c6452c13a53fa8949cb259db459b
40+
container: ghcr.io/llvm/libcxx-linux-builder:2b57ebb50b6d418e70382e655feaa619b558e254
4141
continue-on-error: false
4242
strategy:
4343
fail-fast: false
@@ -75,7 +75,7 @@ jobs:
7575
stage2:
7676
if: github.repository_owner == 'llvm'
7777
runs-on: libcxx-self-hosted-linux
78-
container: ghcr.io/llvm/libcxx-linux-builder:b6bb9dc5abd7c6452c13a53fa8949cb259db459b
78+
container: ghcr.io/llvm/libcxx-linux-builder:2b57ebb50b6d418e70382e655feaa619b558e254
7979
needs: [ stage1 ]
8080
continue-on-error: false
8181
strategy:
@@ -163,7 +163,7 @@ jobs:
163163
- config: 'generic-msan'
164164
machine: libcxx-self-hosted-linux
165165
runs-on: ${{ matrix.machine }}
166-
container: ghcr.io/llvm/libcxx-linux-builder:b6bb9dc5abd7c6452c13a53fa8949cb259db459b
166+
container: ghcr.io/llvm/libcxx-linux-builder:2b57ebb50b6d418e70382e655feaa619b558e254
167167
steps:
168168
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
169169
- name: ${{ matrix.config }}

clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Calls to the following std library algorithms are checked:
6464
``std::mismatch``,
6565
``std::next_permutation``,
6666
``std::none_of``,
67-
``std::parital_sum``,
67+
``std::partial_sum``,
6868
``std::partial_sort_copy``,
6969
``std::partition_copy``,
7070
``std::partition_point``,

clang-tools-extra/docs/clang-tidy/checks/bugprone/casting-through-void.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Note: it is expected that, after applying the suggested fix and using
2626
<../cppcoreguidelines/pro-type-reinterpret-cast>` will emit a warning.
2727
This is intentional: ``reinterpret_cast`` is a dangerous operation that can
2828
easily break the strict aliasing rules when dereferencing the casted pointer,
29-
invoking Undefined Behavior. The warning is there to prompt users to carefuly
29+
invoking Undefined Behavior. The warning is there to prompt users to carefully
3030
analyze whether the usage of ``reinterpret_cast`` is safe, in which case the
3131
warning may be suppressed.
3232

clang/docs/ReleaseNotes.rst

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ Resolutions to C++ Defect Reports
134134
- Bumped the ``__cpp_constexpr`` feature-test macro to ``202002L`` in C++20 mode as indicated in
135135
`P2493R0 <https://wg21.link/P2493R0>`_.
136136

137+
- Implemented `CWG3005 Function parameters should never be name-independent <https://wg21.link/CWG3005>`_.
138+
137139
C Language Changes
138140
------------------
139141

@@ -154,6 +156,8 @@ C Language Changes
154156
- Added ``-Wimplicit-void-ptr-cast``, grouped under ``-Wc++-compat``, which
155157
diagnoses implicit conversion from ``void *`` to another pointer type as
156158
being incompatible with C++. (#GH17792)
159+
- Added ``-Wc++-keyword``, grouped under ``-Wc++-compat``, which diagnoses when
160+
a C++ keyword is used as an identifier in C. (#GH21898)
157161
- Added ``-Wc++-hidden-decl``, grouped under ``-Wc++-compat``, which diagnoses
158162
use of tag types which are visible in C but not visible in C++ due to scoping
159163
rules. e.g.,
@@ -201,6 +205,10 @@ C Language Changes
201205
``-Wunterminated-string-initialization``. However, this diagnostic is not
202206
silenced by the ``nonstring`` attribute as these initializations are always
203207
incompatible with C++.
208+
- Added ``-Wjump-bypasses-init``, which is off by default and grouped under
209+
``-Wc++-compat``. It diagnoses when a jump (``goto`` to its label, ``switch``
210+
to its ``case``) will bypass the initialization of a local variable, which is
211+
invalid in C++.
204212
- Added the existing ``-Wduplicate-decl-specifier`` diagnostic, which is on by
205213
default, to ``-Wc++-compat`` because duplicated declaration specifiers are
206214
not valid in C++.
@@ -243,6 +251,10 @@ C23 Feature Support
243251
scope.
244252
- Fixed a bug where you could not cast a null pointer constant to type
245253
``nullptr_t``. Fixes #GH133644.
254+
- Implemented `WG14 N3037 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3037.pdf>`_
255+
which allows tag types to be redefined within the same translation unit so
256+
long as both definitions are structurally equivalent (same tag types, same
257+
tag names, same tag members, etc).
246258
- Fixed a failed assertion with an invalid parameter to the ``#embed``
247259
directive. Fixes #GH126940.
248260

@@ -482,6 +494,8 @@ Improvements to Clang's diagnostics
482494
- ``-Winitializer-overrides`` and ``-Wreorder-init-list`` are now grouped under
483495
the ``-Wc99-designator`` diagnostic group, as they also are about the
484496
behavior of the C99 feature as it was introduced into C++20. Fixes #GH47037
497+
- ``-Wreserved-identifier`` now fires on reserved parameter names in a function
498+
declaration which is not a definition.
485499

486500
Improvements to Clang's time-trace
487501
----------------------------------
@@ -547,6 +561,9 @@ Bug Fixes to Compiler Builtins
547561
``void(char *, char *)`` to ``void(void *, void *)`` to match GCC's signature
548562
for the same builtin. (#GH47833)
549563

564+
- ``__has_unique_object_representations(Incomplete[])`` is no longer accepted, per
565+
`LWG4113 <https://cplusplus.github.io/LWG/issue4113>`_.
566+
550567
Bug Fixes to Attribute Support
551568
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
552569
- Fixed crash when a parameter to the ``clang::annotate`` attribute evaluates to ``void``. See #GH119125
@@ -620,9 +637,12 @@ Bug Fixes to C++ Support
620637
- Clang no longer crashes when establishing subsumption between some constraint expressions. (#GH122581)
621638
- Clang now issues an error when placement new is used to modify a const-qualified variable
622639
in a ``constexpr`` function. (#GH131432)
640+
- Fixed an incorrect TreeTransform for calls to ``consteval`` functions if a conversion template is present. (#GH137885)
623641
- Clang now emits a warning when class template argument deduction for alias templates is used in C++17. (#GH133806)
624642
- Fix a crash when checking the template template parameters of a dependent lambda appearing in an alias declaration.
625643
(#GH136432), (#GH137014), (#GH138018)
644+
- Fixed an assertion when trying to constant-fold various builtins when the argument
645+
referred to a reference to an incomplete type. (#GH129397)
626646

627647
Bug Fixes to AST Handling
628648
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -769,7 +789,7 @@ clang-format
769789

770790
libclang
771791
--------
772-
- Fixed a bug in ``clang_File_isEqual`` that sometimes led to different
792+
- Fixed a bug in ``clang_File_isEqual`` that sometimes led to different
773793
in-memory files to be considered as equal.
774794
- Added ``clang_visitCXXMethods``, which allows visiting the methods
775795
of a class.

clang/include/clang/AST/ASTContext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3147,6 +3147,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
31473147
QualType mergeTransparentUnionType(QualType, QualType,
31483148
bool OfBlockPointer=false,
31493149
bool Unqualified = false);
3150+
QualType mergeTagDefinitions(QualType, QualType);
31503151

31513152
QualType mergeObjCGCQualifiers(QualType, QualType);
31523153

clang/include/clang/AST/ASTStructuralEquivalence.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ struct StructuralEquivalenceContext {
4343
/// key: (from, to, IgnoreTemplateParmDepth)
4444
using NonEquivalentDeclSet = llvm::DenseSet<std::tuple<Decl *, Decl *, int>>;
4545

46+
/// The language options to use for making a structural equivalence check.
47+
const LangOptions &LangOpts;
48+
4649
/// AST contexts for which we are checking structural equivalence.
4750
ASTContext &FromCtx, &ToCtx;
4851

@@ -76,15 +79,17 @@ struct StructuralEquivalenceContext {
7679
/// Whether to ignore comparing the depth of template param(TemplateTypeParm)
7780
bool IgnoreTemplateParmDepth;
7881

79-
StructuralEquivalenceContext(ASTContext &FromCtx, ASTContext &ToCtx,
82+
StructuralEquivalenceContext(const LangOptions &LangOpts, ASTContext &FromCtx,
83+
ASTContext &ToCtx,
8084
NonEquivalentDeclSet &NonEquivalentDecls,
8185
StructuralEquivalenceKind EqKind,
8286
bool StrictTypeSpelling = false,
8387
bool Complain = true,
8488
bool ErrorOnTagTypeMismatch = false,
8589
bool IgnoreTemplateParmDepth = false)
86-
: FromCtx(FromCtx), ToCtx(ToCtx), NonEquivalentDecls(NonEquivalentDecls),
87-
EqKind(EqKind), StrictTypeSpelling(StrictTypeSpelling),
90+
: LangOpts(LangOpts), FromCtx(FromCtx), ToCtx(ToCtx),
91+
NonEquivalentDecls(NonEquivalentDecls), EqKind(EqKind),
92+
StrictTypeSpelling(StrictTypeSpelling),
8893
ErrorOnTagTypeMismatch(ErrorOnTagTypeMismatch), Complain(Complain),
8994
IgnoreTemplateParmDepth(IgnoreTemplateParmDepth) {}
9095

clang/include/clang/Basic/DiagnosticASTKinds.td

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,16 +478,23 @@ def warn_odr_function_type_inconsistent : Warning<
478478
"external function %0 declared with incompatible types in different "
479479
"translation units (%1 vs. %2)">,
480480
InGroup<ODR>;
481+
def warn_odr_tag_type_with_attributes : Warning<
482+
"type %0 has %select{an attribute|a member with an attribute}1 which "
483+
"currently causes the types to be treated as though they are incompatible">,
484+
InGroup<ODR>, DefaultError;
485+
def note_odr_attr_here : Note<"attribute %0 here">;
481486
def err_odr_tag_type_inconsistent
482-
: Error<"type %0 has incompatible definitions in different translation "
483-
"units">;
487+
: Error<"type %0 has incompatible definitions%select{| in different "
488+
"translation units}1">;
484489
def warn_odr_tag_type_inconsistent
485-
: Warning<"type %0 has incompatible definitions in different translation "
486-
"units">,
490+
: Warning<"type %0 has incompatible definitions%select{| in different "
491+
"translation units}1">,
487492
InGroup<ODR>;
488493
def note_odr_tag_kind_here: Note<
489494
"%0 is a %select{struct|interface|union|class|enum}1 here">;
490495
def note_odr_field : Note<"field %0 has type %1 here">;
496+
def note_odr_field_bit_width : Note<"bit-field %0 has bit-width %1 here">;
497+
def note_odr_field_not_bit_field : Note<"field %0 is not a bit-field">;
491498
def note_odr_field_name : Note<"field has name %0 here">;
492499
def note_odr_missing_field : Note<"no corresponding field here">;
493500
def note_odr_base : Note<"class has base type %0">;

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def C99Compat : DiagGroup<"c99-compat">;
157157
def C23Compat : DiagGroup<"c23-compat">;
158158
def : DiagGroup<"c2x-compat", [C23Compat]>;
159159

160+
def CppKeywordInC : DiagGroup<"c++-keyword">;
160161
def DuplicateDeclSpecifier : DiagGroup<"duplicate-decl-specifier">;
161162
def InitStringTooLongMissingNonString :
162163
DiagGroup<"unterminated-string-initialization">;
@@ -176,11 +177,12 @@ def DefaultConstInit : DiagGroup<"default-const-init",
176177
def ImplicitVoidPtrCast : DiagGroup<"implicit-void-ptr-cast">;
177178
def ImplicitIntToEnumCast : DiagGroup<"implicit-int-enum-cast",
178179
[ImplicitEnumEnumCast]>;
180+
def JumpBypassesInit : DiagGroup<"jump-bypasses-init">;
179181
def TentativeDefnCompat : DiagGroup<"tentative-definition-compat">;
180182
def CXXCompat: DiagGroup<"c++-compat", [ImplicitVoidPtrCast, DefaultConstInit,
181183
ImplicitIntToEnumCast, HiddenCppDecl,
182-
InitStringTooLongForCpp,
183-
TentativeDefnCompat,
184+
InitStringTooLongForCpp, CppKeywordInC,
185+
TentativeDefnCompat, JumpBypassesInit,
184186
DuplicateDeclSpecifier]>;
185187

186188
def ExternCCompat : DiagGroup<"extern-c-compat">;

clang/include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ def warn_pp_macro_is_reserved_attribute_id : Warning<
421421
def warn_pp_objc_macro_redef_ignored : Warning<
422422
"ignoring redefinition of Objective-C qualifier macro">,
423423
InGroup<DiagGroup<"objc-macro-redefinition">>;
424+
def warn_pp_identifier_is_cpp_keyword : Warning<
425+
"identifier %0 conflicts with a C++ keyword">,
426+
InGroup<CppKeywordInC>, DefaultIgnore;
424427

425428
def pp_invalid_string_literal : Warning<
426429
"invalid string literal, ignoring final '\\'">;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6541,6 +6541,16 @@ def warn_missing_braces : Warning<
65416541
"suggest braces around initialization of subobject">,
65426542
InGroup<MissingBraces>, DefaultIgnore;
65436543

6544+
// This diagnostic exists only to determine whether -Wc++-compat was explicitly
6545+
// enabled. This allows us to tell the difference between when a diagnostic was
6546+
// enabled by default, was enabled because its subgroup was enabled, or enabled
6547+
// because the -Wc++-compat superset was enabled, generally for purposes of
6548+
// deciding whether to emit "and is incompatible with C++" on diagnostics which
6549+
// are useful in C alone as well as for compatibility checks.
6550+
def warn_cxx_compat_hack_fake_diagnostic_do_not_emit : Warning<
6551+
"if you see this diagnostic, a Clang developer has made a mistake">,
6552+
InGroup<CXXCompat>, DefaultIgnore;
6553+
65446554
def err_redefinition_of_label : Error<"redefinition of label %0">;
65456555
def err_undeclared_label_use : Error<"use of undeclared label %0">;
65466556
def err_goto_ms_asm_label : Error<
@@ -6561,18 +6571,28 @@ def ext_goto_into_protected_scope : ExtWarn<
65616571
def warn_cxx98_compat_goto_into_protected_scope : Warning<
65626572
"jump from this goto statement to its label is incompatible with C++98">,
65636573
InGroup<CXX98Compat>, DefaultIgnore;
6574+
def warn_cpp_compat_goto_into_protected_scope : Warning<
6575+
"jump from this goto statement to its label is incompatible with C++">,
6576+
InGroup<JumpBypassesInit>, DefaultIgnore;
65646577
def err_switch_into_protected_scope : Error<
65656578
"cannot jump from switch statement to this case label">;
65666579
def warn_cxx98_compat_switch_into_protected_scope : Warning<
65676580
"jump from switch statement to this case label is incompatible with C++98">,
65686581
InGroup<CXX98Compat>, DefaultIgnore;
6582+
def warn_cpp_compat_switch_into_protected_scope : Warning<
6583+
"jump from switch statement to this case label is incompatible with C++">,
6584+
InGroup<JumpBypassesInit>, DefaultIgnore;
65696585
def err_indirect_goto_without_addrlabel : Error<
65706586
"indirect goto in function with no address-of-label expressions">;
65716587
def err_indirect_goto_in_protected_scope : Error<
65726588
"cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
65736589
def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
65746590
"jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
65756591
"is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6592+
def warn_cpp_compat_indirect_goto_in_protected_scope : Warning<
6593+
"jump from this %select{indirect|asm}0 goto statement to one of its possible "
6594+
"targets is incompatible with C++">,
6595+
InGroup<JumpBypassesInit>, DefaultIgnore;
65766596
def note_indirect_goto_target : Note<
65776597
"possible target of %select{indirect|asm}0 goto statement">;
65786598
def note_protected_by_variable_init : Note<
@@ -8234,11 +8254,11 @@ def warn_default_init_const : Warning<
82348254
InGroup<DefaultConstInitVar>, DefaultIgnore;
82358255
def warn_default_init_const_field_unsafe : Warning<
82368256
"default initialization of an object of type %0 with const member leaves the "
8237-
"object uninitialized and is incompatible with C++">,
8257+
"object uninitialized%select{| and is incompatible with C++}1">,
82388258
InGroup<DefaultConstInitFieldUnsafe>;
82398259
def warn_default_init_const_unsafe : Warning<
82408260
"default initialization of an object of type %0 leaves the object "
8241-
"uninitialized and is incompatible with C++">,
8261+
"uninitialized%select{| and is incompatible with C++}1">,
82428262
InGroup<DefaultConstInitVarUnsafe>;
82438263
def err_default_init_const : Error<
82448264
"default initialization of an object of const type %0"
@@ -12989,7 +13009,10 @@ def err_acc_clause_appertainment
1298913009
def err_acc_duplicate_clause_disallowed
1299013010
: Error<"OpenACC '%1' clause cannot appear more than once on a '%0' "
1299113011
"directive">;
12992-
def note_acc_previous_clause_here : Note<"previous clause is here">;
13012+
def note_acc_previous_clause_here : Note<"previous '%0' clause is here">;
13013+
def note_acc_active_applies_clause_here
13014+
: Note<"%enum_select<ACCDeviceTypeApp>{%Active{active}|%Applies{which "
13015+
"applies to}}0 '%1' clause here">;
1299313016
def note_acc_previous_expr_here : Note<"previous expression is here">;
1299413017
def note_acc_previous_reference : Note<"previous reference is here">;
1299513018
def err_acc_branch_in_out_compute_construct
@@ -13075,6 +13098,9 @@ def err_acc_clause_routine_one_of_in_region
1307513098
def err_acc_clause_since_last_device_type
1307613099
: Error<"OpenACC '%0' clause cannot appear more than once%select{| in a "
1307713100
"'device_type' region}2 on a '%1' directive">;
13101+
def err_acc_clause_conflicts_prev_dev_type
13102+
: Error<"OpenACC '%0' clause applies to 'device_type' '%1', which "
13103+
"conflicts with previous '%0' clause">;
1307813104

1307913105
def err_acc_reduction_num_gangs_conflict
1308013106
: Error<"OpenACC '%1' clause %select{|with more than 1 argument }0may not "
@@ -13237,7 +13263,7 @@ def err_acc_duplicate_bind
1323713263
"permitted to refer to the same function">;
1323813264
def err_acc_duplicate_unnamed_bind
1323913265
: Error<"OpenACC 'bind' clause on a declaration must bind to the same name "
13240-
"as previous bind clauses">;
13266+
"as previous 'bind' clauses">;
1324113267
def warn_acc_confusing_routine_name
1324213268
: Warning<"OpenACC 'routine' directive with a name refers to a function "
1324313269
"with the same name as the function on the following line; this "

0 commit comments

Comments
 (0)