Skip to content

Commit 6467344

Browse files
committed
merge main into amd-staging
2 parents e5c7d7e + 1acac5c commit 6467344

File tree

146 files changed

+4111
-1545
lines changed

Some content is hidden

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

146 files changed

+4111
-1545
lines changed

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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,23 @@ Improvements to Clang's diagnostics
549549
- A new off-by-default warning ``-Wms-bitfield-padding`` has been added to alert to cases where bit-field
550550
packing may differ under the MS struct ABI (#GH117428).
551551

552+
- ``-Watomic-access`` no longer fires on unreachable code. e.g.,
553+
554+
.. code-block:: c
555+
556+
_Atomic struct S { int a; } s;
557+
void func(void) {
558+
if (0)
559+
s.a = 12; // Previously diagnosed with -Watomic-access, now silenced
560+
s.a = 12; // Still diagnosed with -Watomic-access
561+
return;
562+
s.a = 12; // Previously diagnosed, now silenced
563+
}
564+
565+
566+
- A new ``-Wcharacter-conversion`` warns where comparing or implicitly converting
567+
between different Unicode character types (``char8_t``, ``char16_t``, ``char32_t``).
568+
This warning only triggers in C++ as these types are aliases in C. (#GH138526)
552569

553570
Improvements to Clang's time-trace
554571
----------------------------------
@@ -613,6 +630,7 @@ Bug Fixes in This Version
613630
- Fixed a crash with an invalid member function parameter list with a default
614631
argument which contains a pragma. (#GH113722)
615632
- Fixed assertion failures when generating name lookup table in modules. (#GH61065, #GH134739)
633+
- Fixed an assertion failure in constant compound literal statements. (#GH139160)
616634

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

730749
Bug Fixes to AST Handling
731750
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -878,6 +897,11 @@ clang-format
878897
- Add ``OneLineFormatOffRegex`` option for turning formatting off for one line.
879898
- Add ``SpaceAfterOperatorKeyword`` option.
880899

900+
clang-refactor
901+
--------------
902+
- Reject `0` as column or line number in 1-based command-line source locations.
903+
Fixes crash caused by `0` input in `-selection=<file>:<line>:<column>[-<line>:<column>]`. (#GH139457)
904+
881905
libclang
882906
--------
883907
- Fixed a bug in ``clang_File_isEqual`` that sometimes led to different
@@ -896,6 +920,8 @@ libclang
896920

897921
Code Completion
898922
---------------
923+
- Reject `0` as column or line number in 1-based command-line source locations.
924+
Fixes crash caused by `0` input in `-code-completion-at=<file>:<line>:<column>`. (#GH139457)
899925

900926
Static Analyzer
901927
---------------

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/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/DiagnosticDriverKinds.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,10 @@ def note_drv_verify_prefix_spelling : Note<
683683
"-verify prefixes must start with a letter and contain only alphanumeric"
684684
" characters, hyphens, and underscores">;
685685

686+
def note_command_line_code_loc_requirement
687+
: Note<"-code-completion-at=<file>:<line>:<column> requires <line> and "
688+
"<column> to be integers greater than zero">;
689+
686690
def warn_drv_global_isel_incomplete : Warning<
687691
"-fglobal-isel support for the '%0' architecture is incomplete">,
688692
InGroup<GlobalISel>;

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def EnumConversion : DiagGroup<"enum-conversion",
111111
ImplicitEnumEnumCast,
112112
EnumFloatConversion,
113113
EnumCompareConditional]>;
114+
def CharacterConversion : DiagGroup<"character-conversion">;
114115
def DeprecatedOFast : DiagGroup<"deprecated-ofast">;
115116
def ObjCSignedCharBoolImplicitIntConversion :
116117
DiagGroup<"objc-signed-char-bool-implicit-int-conversion">;
@@ -1119,6 +1120,7 @@ def Parentheses : DiagGroup<"parentheses",
11191120
// - __null-to-integer conversion warnings are on by default
11201121
def Conversion : DiagGroup<"conversion",
11211122
[BoolConversion,
1123+
CharacterConversion,
11221124
ConstantConversion,
11231125
EnumConversion,
11241126
BitFieldEnumConversion,

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4369,6 +4369,29 @@ def warn_address_of_reference_bool_conversion : Warning<
43694369
"code; pointer may be assumed to always convert to true">,
43704370
InGroup<UndefinedBoolConversion>;
43714371

4372+
def warn_impcast_unicode_char_type
4373+
: Warning<"implicit conversion from %0 to %1 may change the meaning of the "
4374+
"represented code unit">,
4375+
InGroup<CharacterConversion>;
4376+
def warn_impcast_unicode_precision
4377+
: Warning<"implicit conversion from %0 to %1 may lose precision and change "
4378+
"the meaning of the represented code unit">,
4379+
InGroup<CharacterConversion>;
4380+
def warn_impcast_unicode_char_type_constant
4381+
: Warning<"implicit conversion from %0 to %1 changes the meaning of the "
4382+
"%select{code unit|code point}2 '%3'">,
4383+
InGroup<CharacterConversion>;
4384+
4385+
def warn_comparison_unicode_mixed_types
4386+
: Warning<"comparing values of different Unicode code unit types %0 and %1 "
4387+
"may compare different code points">,
4388+
InGroup<CharacterConversion>;
4389+
4390+
def warn_comparison_unicode_mixed_types_constant
4391+
: Warning<"comparing values of different Unicode code unit types %0 and %1 "
4392+
"compares unrelated code units '%2' and '%3'">,
4393+
InGroup<CharacterConversion>;
4394+
43724395
def warn_xor_used_as_pow : Warning<
43734396
"result of '%0' is %1; did you mean exponentiation?">,
43744397
InGroup<XorUsedAsPow>;
@@ -6834,7 +6857,7 @@ def err_counted_by_on_incomplete_type_on_use : Error <
68346857

68356858
def note_counted_by_consider_completing_pointee_ty : Note<
68366859
"consider providing a complete definition for %0">;
6837-
6860+
68386861
def note_counted_by_consider_using_sized_by : Note<
68396862
"consider using '__sized_by%select{|_or_null}0' instead of "
68406863
"'__counted_by%select{|_or_null}0'">;
@@ -7733,6 +7756,11 @@ def warn_comparison_of_mixed_enum_types_switch : Warning<
77337756
"%diff{ ($ and $)|}0,1">,
77347757
InGroup<EnumCompareSwitch>;
77357758

7759+
def warn_arith_conv_mixed_unicode_types
7760+
: Warning<"%sub{select_arith_conv_kind}0 "
7761+
"different Unicode character types %1 and %2">,
7762+
InGroup<CharacterConversion>;
7763+
77367764
def err_typecheck_assign_const : Error<
77377765
"%select{"
77387766
"cannot assign to return value because function %1 returns a const value|"

0 commit comments

Comments
 (0)