Skip to content

Commit 37f9632

Browse files
Merge branch 'llvm:main' into gh-101657
2 parents f412036 + 680b3b7 commit 37f9632

File tree

466 files changed

+15217
-4454
lines changed

Some content is hidden

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

466 files changed

+15217
-4454
lines changed

.github/new-prs-labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ mlgo:
702702
- llvm/unittests/CodeGen/ML*
703703
- llvm/test/CodeGen/MLRegAlloc/**
704704
- llvm/utils/mlgo-utils/**
705+
- llvm/docs/MLGO.rst
705706

706707
tools:llvm-exegesis:
707708
- llvm/tools/llvm-exegesis/**

bolt/test/X86/callcont-fallthru.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# RUN: %clangxx %cxxflags %s %t.so -o %t -Wl,-q -nostdlib
77
# RUN: link_fdata %s %t %t.pat PREAGGT1
88
# RUN: link_fdata %s %t %t.pat2 PREAGGT2
9-
# DONTRUN: link_fdata %s %t %t.patplt PREAGGPLT
9+
# RUN-DISABLED: link_fdata %s %t %t.patplt PREAGGPLT
1010

1111
# RUN: llvm-strip --strip-unneeded %t -o %t.strip
1212
# RUN: llvm-objcopy --remove-section=.eh_frame %t.strip %t.noeh
@@ -26,8 +26,8 @@
2626

2727
## Check pre-aggregated traces don't report zero-sized PLT fall-through as
2828
## invalid trace
29-
# DONTRUN: llvm-bolt %t.strip --pa -p %t.patplt -o %t.out | FileCheck %s \
30-
# DONTRUN: --check-prefix=CHECK-PLT
29+
# RUN-DISABLED: llvm-bolt %t.strip --pa -p %t.patplt -o %t.out | FileCheck %s \
30+
# RUN-DISABLED: --check-prefix=CHECK-PLT
3131
# CHECK-PLT: traces mismatching disassembled function contents: 0
3232

3333
.globl foo

clang/docs/ReleaseNotes.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,23 @@ Improvements to Clang's diagnostics
533533
- A new off-by-default warning ``-Wms-bitfield-padding`` has been added to alert to cases where bit-field
534534
packing may differ under the MS struct ABI (#GH117428).
535535

536+
- ``-Watomic-access`` no longer fires on unreachable code. e.g.,
537+
538+
.. code-block:: c
539+
540+
_Atomic struct S { int a; } s;
541+
void func(void) {
542+
if (0)
543+
s.a = 12; // Previously diagnosed with -Watomic-access, now silenced
544+
s.a = 12; // Still diagnosed with -Watomic-access
545+
return;
546+
s.a = 12; // Previously diagnosed, now silenced
547+
}
548+
549+
550+
- A new ``-Wcharacter-conversion`` warns where comparing or implicitly converting
551+
between different Unicode character types (``char8_t``, ``char16_t``, ``char32_t``).
552+
This warning only triggers in C++ as these types are aliases in C. (#GH138526)
536553

537554
Improvements to Clang's time-trace
538555
----------------------------------
@@ -597,6 +614,9 @@ Bug Fixes in This Version
597614
- Fixed a crash with an invalid member function parameter list with a default
598615
argument which contains a pragma. (#GH113722)
599616
- Fixed assertion failures when generating name lookup table in modules. (#GH61065, #GH134739)
617+
- Fixed an assertion failure in constant compound literal statements. (#GH139160)
618+
- Fix crash due to unknown references and pointer implementation and handling of
619+
base classes. (GH139452)
600620

601621
Bug Fixes to Compiler Builtins
602622
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -710,6 +730,7 @@ Bug Fixes to C++ Support
710730
- Clang now correctly parses arbitrary order of ``[[]]``, ``__attribute__`` and ``alignas`` attributes for declarations (#GH133107)
711731
- Fixed a crash when forming an invalid function type in a dependent context. (#GH138657) (#GH115725) (#GH68852)
712732
- Clang no longer segfaults when there is a configuration mismatch between modules and their users (http://crbug.com/400353616).
733+
- Fix an incorrect deduction when calling an explicit object member function template through an overload set address.
713734

714735
Bug Fixes to AST Handling
715736
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -858,6 +879,11 @@ clang-format
858879
- Add ``OneLineFormatOffRegex`` option for turning formatting off for one line.
859880
- Add ``SpaceAfterOperatorKeyword`` option.
860881

882+
clang-refactor
883+
--------------
884+
- Reject `0` as column or line number in 1-based command-line source locations.
885+
Fixes crash caused by `0` input in `-selection=<file>:<line>:<column>[-<line>:<column>]`. (#GH139457)
886+
861887
libclang
862888
--------
863889
- Fixed a bug in ``clang_File_isEqual`` that sometimes led to different
@@ -876,6 +902,8 @@ libclang
876902

877903
Code Completion
878904
---------------
905+
- Reject `0` as column or line number in 1-based command-line source locations.
906+
Fixes crash caused by `0` input in `-code-completion-at=<file>:<line>:<column>`. (#GH139457)
879907

880908
Static Analyzer
881909
---------------

clang/include/clang/AST/ASTConcept.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ struct ASTConstraintSatisfaction final :
9393
bool ContainsErrors : 1;
9494

9595
const UnsatisfiedConstraintRecord *begin() const {
96-
return getTrailingObjects<UnsatisfiedConstraintRecord>();
96+
return getTrailingObjects();
9797
}
9898

9999
const UnsatisfiedConstraintRecord *end() const {
100-
return getTrailingObjects<UnsatisfiedConstraintRecord>() + NumRecords;
100+
return getTrailingObjects() + NumRecords;
101101
}
102102

103103
ASTConstraintSatisfaction(const ASTContext &C,

clang/include/clang/AST/ASTDiagnostic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ namespace clang {
3838
/// is initialized before passing it in.
3939
QualType desugarForDiagnostic(ASTContext &Context, QualType QT,
4040
bool &ShouldAKA);
41+
42+
std::string FormatUTFCodeUnitAsCodepoint(unsigned Value, QualType T);
43+
4144
} // end namespace clang
4245

4346
#endif

clang/include/clang/AST/Decl.h

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class PragmaCommentDecl final
185185

186186
PragmaMSCommentKind getCommentKind() const { return CommentKind; }
187187

188-
StringRef getArg() const { return getTrailingObjects<char>(); }
188+
StringRef getArg() const { return getTrailingObjects(); }
189189

190190
// Implement isa/cast/dyncast/etc.
191191
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
@@ -217,8 +217,8 @@ class PragmaDetectMismatchDecl final
217217
static PragmaDetectMismatchDecl *
218218
CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NameValueSize);
219219

220-
StringRef getName() const { return getTrailingObjects<char>(); }
221-
StringRef getValue() const { return getTrailingObjects<char>() + ValueStart; }
220+
StringRef getName() const { return getTrailingObjects(); }
221+
StringRef getValue() const { return getTrailingObjects() + ValueStart; }
222222

223223
// Implement isa/cast/dyncast/etc.
224224
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
@@ -1991,7 +1991,7 @@ class FunctionDecl : public DeclaratorDecl,
19911991
/// Get the unqualified lookup results that should be used in this
19921992
/// defaulted function definition.
19931993
ArrayRef<DeclAccessPair> getUnqualifiedLookups() const {
1994-
return {getTrailingObjects<DeclAccessPair>(), NumLookups};
1994+
return getTrailingObjects<DeclAccessPair>(NumLookups);
19951995
}
19961996

19971997
StringLiteral *getDeletedMessage() const {
@@ -4780,13 +4780,9 @@ class OutlinedFunctionDecl final
47804780

47814781
explicit OutlinedFunctionDecl(DeclContext *DC, unsigned NumParams);
47824782

4783-
ImplicitParamDecl *const *getParams() const {
4784-
return getTrailingObjects<ImplicitParamDecl *>();
4785-
}
4783+
ImplicitParamDecl *const *getParams() const { return getTrailingObjects(); }
47864784

4787-
ImplicitParamDecl **getParams() {
4788-
return getTrailingObjects<ImplicitParamDecl *>();
4789-
}
4785+
ImplicitParamDecl **getParams() { return getTrailingObjects(); }
47904786

47914787
public:
47924788
friend class ASTDeclReader;
@@ -4857,13 +4853,9 @@ class CapturedDecl final
48574853

48584854
explicit CapturedDecl(DeclContext *DC, unsigned NumParams);
48594855

4860-
ImplicitParamDecl *const *getParams() const {
4861-
return getTrailingObjects<ImplicitParamDecl *>();
4862-
}
4856+
ImplicitParamDecl *const *getParams() const { return getTrailingObjects(); }
48634857

4864-
ImplicitParamDecl **getParams() {
4865-
return getTrailingObjects<ImplicitParamDecl *>();
4866-
}
4858+
ImplicitParamDecl **getParams() { return getTrailingObjects(); }
48674859

48684860
public:
48694861
friend class ASTDeclReader;
@@ -5187,12 +5179,10 @@ class HLSLRootSignatureDecl final
51875179

51885180
unsigned NumElems;
51895181

5190-
llvm::hlsl::rootsig::RootElement *getElems() {
5191-
return getTrailingObjects<llvm::hlsl::rootsig::RootElement>();
5192-
}
5182+
llvm::hlsl::rootsig::RootElement *getElems() { return getTrailingObjects(); }
51935183

51945184
const llvm::hlsl::rootsig::RootElement *getElems() const {
5195-
return getTrailingObjects<llvm::hlsl::rootsig::RootElement>();
5185+
return getTrailingObjects();
51965186
}
51975187

51985188
HLSLRootSignatureDecl(DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,

clang/include/clang/AST/DeclCXX.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,9 +2606,6 @@ class CXXConstructorDecl final
26062606
size_t numTrailingObjects(OverloadToken<InheritedConstructor>) const {
26072607
return CXXConstructorDeclBits.IsInheritingConstructor;
26082608
}
2609-
size_t numTrailingObjects(OverloadToken<ExplicitSpecifier>) const {
2610-
return CXXConstructorDeclBits.HasTrailingExplicitSpecifier;
2611-
}
26122609

26132610
ExplicitSpecifier getExplicitSpecifierInternal() const {
26142611
if (CXXConstructorDeclBits.HasTrailingExplicitSpecifier)
@@ -2625,8 +2622,12 @@ class CXXConstructorDecl final
26252622
};
26262623

26272624
uint64_t getTrailingAllocKind() const {
2628-
return numTrailingObjects(OverloadToken<InheritedConstructor>()) |
2629-
(numTrailingObjects(OverloadToken<ExplicitSpecifier>()) << 1);
2625+
uint64_t Kind = 0;
2626+
if (CXXConstructorDeclBits.IsInheritingConstructor)
2627+
Kind |= TAKInheritsConstructor;
2628+
if (CXXConstructorDeclBits.HasTrailingExplicitSpecifier)
2629+
Kind |= TAKHasTailExplicit;
2630+
return Kind;
26302631
}
26312632

26322633
public:
@@ -3864,7 +3865,7 @@ class UsingPackDecl final
38643865
InstantiatedFrom ? InstantiatedFrom->getDeclName()
38653866
: DeclarationName()),
38663867
InstantiatedFrom(InstantiatedFrom), NumExpansions(UsingDecls.size()) {
3867-
llvm::uninitialized_copy(UsingDecls, getTrailingObjects<NamedDecl *>());
3868+
llvm::uninitialized_copy(UsingDecls, getTrailingObjects());
38683869
}
38693870

38703871
void anchor() override;
@@ -3882,7 +3883,7 @@ class UsingPackDecl final
38823883
/// Get the set of using declarations that this pack expanded into. Note that
38833884
/// some of these may still be unresolved.
38843885
ArrayRef<NamedDecl *> expansions() const {
3885-
return getTrailingObjects<NamedDecl *>(NumExpansions);
3886+
return getTrailingObjects(NumExpansions);
38863887
}
38873888

38883889
static UsingPackDecl *Create(ASTContext &C, DeclContext *DC,
@@ -4235,7 +4236,7 @@ class DecompositionDecl final
42354236
: VarDecl(Decomposition, C, DC, StartLoc, LSquareLoc, nullptr, T, TInfo,
42364237
SC),
42374238
NumBindings(Bindings.size()) {
4238-
llvm::uninitialized_copy(Bindings, getTrailingObjects<BindingDecl *>());
4239+
llvm::uninitialized_copy(Bindings, getTrailingObjects());
42394240
for (auto *B : Bindings) {
42404241
B->setDecomposedDecl(this);
42414242
if (B->isParameterPack() && B->getBinding()) {
@@ -4262,8 +4263,8 @@ class DecompositionDecl final
42624263
unsigned NumBindings);
42634264

42644265
// Provide the range of bindings which may have a nested pack.
4265-
llvm::ArrayRef<BindingDecl *> bindings() const {
4266-
return {getTrailingObjects<BindingDecl *>(), NumBindings};
4266+
ArrayRef<BindingDecl *> bindings() const {
4267+
return getTrailingObjects(NumBindings);
42674268
}
42684269

42694270
// Provide a flattened range to visit each binding.

clang/include/clang/AST/DeclTemplate.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ class DependentFunctionTemplateSpecializationInfo final
712712

713713
/// Returns the candidates for the primary function template.
714714
ArrayRef<FunctionTemplateDecl *> getCandidates() const {
715-
return {getTrailingObjects<FunctionTemplateDecl *>(), NumCandidates};
715+
return getTrailingObjects(NumCandidates);
716716
}
717717
};
718718

@@ -1325,8 +1325,7 @@ class TemplateTypeParmDecl final : public TypeDecl,
13251325
/// Returns the type constraint associated with this template parameter (if
13261326
/// any).
13271327
const TypeConstraint *getTypeConstraint() const {
1328-
return TypeConstraintInitialized ? getTrailingObjects<TypeConstraint>() :
1329-
nullptr;
1328+
return TypeConstraintInitialized ? getTrailingObjects() : nullptr;
13301329
}
13311330

13321331
void setTypeConstraint(ConceptReference *CR,
@@ -1711,7 +1710,7 @@ class TemplateTemplateParmDecl final
17111710
/// pack.
17121711
TemplateParameterList *getExpansionTemplateParameters(unsigned I) const {
17131712
assert(I < NumExpandedParams && "Out-of-range expansion type index");
1714-
return getTrailingObjects<TemplateParameterList *>()[I];
1713+
return getTrailingObjects()[I];
17151714
}
17161715

17171716
const DefArgStorage &getDefaultArgStorage() const { return DefaultArgument; }
@@ -3254,8 +3253,7 @@ class ImplicitConceptSpecializationDecl final
32543253
unsigned NumTemplateArgs);
32553254

32563255
ArrayRef<TemplateArgument> getTemplateArguments() const {
3257-
return ArrayRef<TemplateArgument>(getTrailingObjects<TemplateArgument>(),
3258-
NumTemplateArgs);
3256+
return getTrailingObjects(NumTemplateArgs);
32593257
}
32603258
void setTemplateArguments(ArrayRef<TemplateArgument> Converted);
32613259

clang/include/clang/AST/Type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,6 +2521,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
25212521
bool isChar16Type() const;
25222522
bool isChar32Type() const;
25232523
bool isAnyCharacterType() const;
2524+
bool isUnicodeCharacterType() const;
25242525
bool isIntegralType(const ASTContext &Ctx) const;
25252526

25262527
/// Determine whether this type is an integral or enumeration type.

clang/include/clang/Basic/Attr.td

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4739,7 +4739,8 @@ def Error : InheritableAttr {
47394739
def RootSignature : Attr {
47404740
/// [RootSignature(Signature)]
47414741
let Spellings = [Microsoft<"RootSignature">];
4742-
let Args = [IdentifierArgument<"Signature">];
4742+
let Args = [IdentifierArgument<"SignatureIdent">,
4743+
DeclArgument<HLSLRootSignature, "SignatureDecl", 0, /*fake=*/1>];
47434744
let Subjects = SubjectList<[Function],
47444745
ErrorDiag, "'function'">;
47454746
let LangOpts = [HLSL];
@@ -4789,6 +4790,7 @@ def HLSLResourceBinding: InheritableAttr {
47894790
RegisterType RegType;
47904791
std::optional<unsigned> SlotNumber;
47914792
unsigned SpaceNumber;
4793+
std::optional<unsigned> ImplicitBindingOrderID;
47924794

47934795
public:
47944796
void setBinding(RegisterType RT, std::optional<unsigned> SlotNum, unsigned SpaceNum) {
@@ -4810,6 +4812,16 @@ def HLSLResourceBinding: InheritableAttr {
48104812
unsigned getSpaceNumber() const {
48114813
return SpaceNumber;
48124814
}
4815+
void setImplicitBindingOrderID(uint32_t Value) {
4816+
ImplicitBindingOrderID = Value;
4817+
}
4818+
bool hasImplicitBindingOrderID() const {
4819+
return ImplicitBindingOrderID.has_value();
4820+
}
4821+
uint32_t getImplicitBindingOrderID() const {
4822+
assert(hasImplicitBindingOrderID() && "attribute does not have implicit binding order id");
4823+
return ImplicitBindingOrderID.value();
4824+
}
48134825
}];
48144826
}
48154827

0 commit comments

Comments
 (0)