Skip to content

Commit 0505057

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merge llvm/main into amd-debug
2 parents 0bd16d5 + 85a11bc commit 0505057

File tree

627 files changed

+9898
-2617
lines changed

Some content is hidden

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

627 files changed

+9898
-2617
lines changed

clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ TaggedUnionMemberCountCheck::getNumberOfEnumValues(const EnumDecl *ED) {
144144

145145
if (EnableCountingEnumHeuristic && LastEnumConstant &&
146146
isCountingEnumLikeName(LastEnumConstant->getName()) &&
147-
(LastEnumConstant->getInitVal() == (EnumValues.size() - 1))) {
147+
llvm::APSInt::isSameValue(LastEnumConstant->getInitVal(),
148+
llvm::APSInt::get(EnumValues.size() - 1))) {
148149
return {EnumValues.size() - 1, LastEnumConstant};
149150
}
150151

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,11 @@ Bug Fixes in This Version
756756
- Fixed an infinite recursion when checking constexpr destructors. (#GH141789)
757757
- Fixed a crash when a malformed using declaration appears in a ``constexpr`` function. (#GH144264)
758758
- Fixed a bug when use unicode character name in macro concatenation. (#GH145240)
759+
- Clang doesn't erroneously inject a ``static_assert`` macro in ms-compatibility and
760+
-std=c99 mode. This resulted in deletion of ``-W/Wno-microsoft-static-assert``
761+
flag and diagnostic because the macro injection was used to emit this warning.
762+
Unfortunately there is no other good way to diagnose usage of ``static_assert``
763+
macro without inclusion of ``<assert.h>``.
759764

760765
Bug Fixes to Compiler Builtins
761766
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/AttributeCommonInfo.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H
1616

1717
#include "clang/Basic/AttributeScopeInfo.h"
18+
#include "clang/Basic/Diagnostic.h"
1819
#include "clang/Basic/SourceLocation.h"
1920
#include "clang/Basic/TokenKinds.h"
2021

@@ -175,6 +176,10 @@ class AttributeCommonInfo {
175176
: AttributeCommonInfo(nullptr, AttributeScopeInfo(), AttrRange, K,
176177
FormUsed) {}
177178

179+
AttributeCommonInfo(SourceRange AttrRange, AttributeScopeInfo AttrScope,
180+
Kind K, Form FormUsed)
181+
: AttributeCommonInfo(nullptr, AttrScope, AttrRange, K, FormUsed) {}
182+
178183
AttributeCommonInfo(AttributeCommonInfo &&) = default;
179184
AttributeCommonInfo(const AttributeCommonInfo &) = default;
180185

@@ -292,6 +297,18 @@ inline bool doesKeywordAttributeTakeArgs(tok::TokenKind Kind) {
292297
}
293298
}
294299

300+
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
301+
const AttributeCommonInfo *CI) {
302+
DB.AddTaggedVal(reinterpret_cast<uint64_t>(CI),
303+
DiagnosticsEngine::ak_attr_info);
304+
return DB;
305+
}
306+
307+
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
308+
const AttributeCommonInfo &CI) {
309+
return DB << &CI;
310+
}
311+
295312
} // namespace clang
296313

297314
#endif // LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H

clang/include/clang/Basic/Diagnostic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
289289

290290
/// Expr *
291291
ak_expr,
292+
293+
/// AttributeCommonInfo *
294+
ak_attr_info,
292295
};
293296

294297
/// Represents on argument value, which is a union discriminated

clang/include/clang/Basic/DiagnosticASTKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ def note_constexpr_access_static_temporary : Note<
240240
"outside the expression that created the temporary">;
241241
def note_constexpr_access_unreadable_object : Note<
242242
"%sub{access_kind}0 object '%1' whose value is not known">;
243+
def note_constexpr_access_unknown_variable : Note<
244+
"%sub{access_kind}0 variable %1 whose value is not known">;
243245
def note_constexpr_access_deleted_object : Note<
244246
"%sub{access_kind}0 heap allocated object that has been deleted">;
245247
def note_constexpr_modify_global : Note<

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,6 @@ def MicrosoftAnonTag : DiagGroup<"microsoft-anon-tag">;
14501450
def MicrosoftCommentPaste : DiagGroup<"microsoft-comment-paste">;
14511451
def MicrosoftEndOfFile : DiagGroup<"microsoft-end-of-file">;
14521452
def MicrosoftInaccessibleBase : DiagGroup<"microsoft-inaccessible-base">;
1453-
def MicrosoftStaticAssert : DiagGroup<"microsoft-static-assert">;
14541453
def MicrosoftInitFromPredefined : DiagGroup<"microsoft-init-from-predefined">;
14551454
def MicrosoftStringLiteralFromPredefined : DiagGroup<
14561455
"microsoft-string-literal-from-predefined">;
@@ -1472,7 +1471,7 @@ def Microsoft : DiagGroup<"microsoft",
14721471
MicrosoftRedeclareStatic, MicrosoftEnumForwardReference, MicrosoftGoto,
14731472
MicrosoftFlexibleArray, MicrosoftExtraQualification, MicrosoftCast,
14741473
MicrosoftConstInit, MicrosoftVoidPseudoDtor, MicrosoftAnonTag,
1475-
MicrosoftCommentPaste, MicrosoftEndOfFile, MicrosoftStaticAssert,
1474+
MicrosoftCommentPaste, MicrosoftEndOfFile,
14761475
MicrosoftInitFromPredefined, MicrosoftStringLiteralFromPredefined,
14771476
MicrosoftInconsistentDllImport, MicrosoftInlineOnNonFunction]>;
14781477

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,6 @@ def err_bool_redeclaration : Error<
474474
def warn_cxx98_compat_static_assert : Warning<
475475
"'static_assert' declarations are incompatible with C++98">,
476476
InGroup<CXX98Compat>, DefaultIgnore;
477-
def ext_ms_static_assert : ExtWarn<
478-
"use of 'static_assert' without inclusion of <assert.h> is a Microsoft "
479-
"extension">, InGroup<MicrosoftStaticAssert>;
480477
def ext_cxx_static_assert_no_message : ExtWarn<
481478
"'static_assert' with no message is a C++17 extension">, InGroup<CXX17>;
482479
def ext_c_static_assert_no_message : ExtWarn<

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3290,10 +3290,11 @@ def err_attribute_wrong_number_arguments : Error<
32903290
def err_attribute_wrong_number_arguments_for : Error <
32913291
"%0 attribute references function %1, which %plural{0:takes no arguments|1:takes one argument|"
32923292
":takes exactly %2 arguments}2">;
3293-
def err_callback_attribute_wrong_arg_count : Error<
3294-
"'callback' attribute references function of type %0 which expects %1 "
3295-
"%plural{1:argument|:arguments}1 but attribute specifies %2 parameter index "
3296-
"%plural{1:argument|:arguments}2">;
3293+
def err_attribute_wrong_arg_count_for_func
3294+
: Error<"%0 attribute references function of type %1 which expects %2 "
3295+
"%plural{1:argument|:arguments}2 but attribute specifies %3 "
3296+
"parameter index "
3297+
"%plural{1:argument|:arguments}3">;
32973298
def err_attribute_bounds_for_function : Error<
32983299
"%0 attribute references parameter %1, but the function %2 has only %3 parameters">;
32993300
def err_attribute_no_member_function : Error<
@@ -4712,9 +4713,9 @@ def note_protocol_decl : Note<
47124713
"protocol is declared here">;
47134714
def note_protocol_decl_undefined : Note<
47144715
"protocol %0 has no definition">;
4715-
def err_attribute_preferred_name_arg_invalid : Error<
4716-
"argument %0 to 'preferred_name' attribute is not a typedef for "
4717-
"a specialization of %1">;
4716+
def err_attribute_not_typedef_for_specialization
4717+
: Error<"argument %0 to %1 attribute is not a typedef for "
4718+
"a specialization of %2">;
47184719
def err_attribute_builtin_alias : Error<
47194720
"%0 attribute can only be applied to a ARM, HLSL, SPIR-V or RISC-V builtin">;
47204721

clang/include/clang/Basic/riscv_vector.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2313,7 +2313,7 @@ defm vrgather : RVVOutBuiltinSet<"vrgather_vv", "csilxfdy",
23132313
[["vv", "v", "vvUv"]]>;
23142314
defm vrgather : RVVOutBuiltinSet<"vrgather_vx", "csilxfdy",
23152315
[["vx", "v", "vvz"]]>;
2316-
defm vrgatherei16 : RVVOutBuiltinSet<"vrgatherei16_vv", "csilxfd",
2316+
defm vrgatherei16 : RVVOutBuiltinSet<"vrgatherei16_vv", "csilxfdy",
23172317
[["vv", "v", "vv(Log2EEW:4)Uv"]]>;
23182318
// unsigned type
23192319
defm vrgather : RVVOutBuiltinSet<"vrgather_vv", "csil",

clang/include/clang/Basic/riscv_vector_common.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ class RVVMaskOp0Builtin<string prototype> : RVVOp0Builtin<"m", prototype, "c"> {
591591
let UnMaskedPolicyScheme = HasPolicyOperand,
592592
HasMaskedOffOperand = false in {
593593
multiclass RVVSlideUpBuiltinSet {
594-
defm "" : RVVOutBuiltinSet<NAME, "csilxfd",
594+
defm "" : RVVOutBuiltinSet<NAME, "csilxfdy",
595595
[["vx","v", "vvvz"]]>;
596596
defm "" : RVVOutBuiltinSet<NAME, "csil",
597597
[["vx","Uv", "UvUvUvz"]]>;
@@ -613,7 +613,7 @@ let UnMaskedPolicyScheme = HasPassthruOperand,
613613
IntrinsicTypes = {ResultType, Ops.back()->getType()};
614614
}] in {
615615
multiclass RVVSlideDownBuiltinSet {
616-
defm "" : RVVOutBuiltinSet<NAME, "csilxfd",
616+
defm "" : RVVOutBuiltinSet<NAME, "csilxfdy",
617617
[["vx","v", "vvz"]]>;
618618
defm "" : RVVOutBuiltinSet<NAME, "csil",
619619
[["vx","Uv", "UvUvz"]]>;

0 commit comments

Comments
 (0)