Skip to content

Commit 568efcc

Browse files
authored
Merge branch 'main' into one-use-mov
2 parents 2cda0f0 + 58a5121 commit 568efcc

File tree

789 files changed

+26239
-9708
lines changed

Some content is hidden

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

789 files changed

+26239
-9708
lines changed

clang-tools-extra/clangd/AST.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ std::string getQualification(ASTContext &Context,
147147
if (auto *TD = llvm::dyn_cast<TagDecl>(CurD)) {
148148
QualType T;
149149
if (const auto *RD = dyn_cast<CXXRecordDecl>(TD);
150-
ClassTemplateDecl *CTD = RD->getDescribedClassTemplate()) {
150+
ClassTemplateDecl *CTD =
151+
RD ? RD->getDescribedClassTemplate() : nullptr) {
151152
ArrayRef<TemplateArgument> Args;
152153
if (const auto *SD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
153154
Args = SD->getTemplateArgs().asArray();

clang-tools-extra/clangd/tool/ClangdMain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,8 +775,8 @@ It should be used via an editor plugin rather than invoked directly. For more in
775775
clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment variable.
776776
)";
777777
llvm::cl::HideUnrelatedOptions(ClangdCategories);
778-
llvm::cl::ParseCommandLineOptions(argc, argv, Overview,
779-
/*Errs=*/nullptr, FlagsEnvVar);
778+
llvm::cl::ParseCommandLineOptions(argc, argv, Overview, /*Errs=*/nullptr,
779+
/*VFS=*/nullptr, FlagsEnvVar);
780780
if (Test) {
781781
if (!Sync.getNumOccurrences())
782782
Sync = true;

clang-tools-extra/docs/clang-tidy/checks/modernize/use-scoped-lock.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ Multiple ``std::lock_guard`` declarations only emit warnings:
5151

5252
std::mutex M1, M2;
5353
std::lock(M1, M2);
54-
std::lock_guard Lock1(M, std::adopt_lock); // warning: use single 'std::scoped_lock' instead of multiple 'std::lock_guard'
55-
std::lock_guard Lock2(M, std::adopt_lock); // note: additional 'std::lock_guard' declared here
54+
std::lock_guard Lock1(M1, std::adopt_lock); // warning: use single 'std::scoped_lock' instead of multiple 'std::lock_guard'
55+
std::lock_guard Lock2(M2, std::adopt_lock); // note: additional 'std::lock_guard' declared here
5656

5757

5858
Limitations

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ Improvements to Clang's diagnostics
265265
- Fixed fix-it hint for fold expressions. Clang now correctly places the suggested right
266266
parenthesis when diagnosing malformed fold expressions. (#GH151787)
267267
- Added fix-it hint for when scoped enumerations require explicit conversions for binary operations. (#GH24265)
268-
268+
- Constant template parameters are now type checked in template definitions,
269+
including template template parameters.
269270
- Fixed an issue where emitted format-signedness diagnostics were not associated with an appropriate
270271
diagnostic id. Besides being incorrect from an API standpoint, this was user visible, e.g.:
271272
"format specifies type 'unsigned int' but the argument has type 'int' [-Wformat]"

clang/docs/analyzer/checkers.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,26 +3633,28 @@ See `WebKit Guidelines for Safer C++ Programming <https://github.com/WebKit/WebK
36333633
36343634
alpha.webkit.NoUnretainedMemberChecker
36353635
""""""""""""""""""""""""""""""""""""""""
3636-
Raw pointers and references to a NS or CF object can't be used as class members or ivars. Only RetainPtr is allowed for CF types regardless of whether ARC is enabled or disabled. Only RetainPtr is allowed for NS types when ARC is disabled.
3636+
Raw pointers and references to a NS or CF object can't be used as class members or ivars. Only RetainPtr is allowed for CF types regardless of whether ARC is enabled or disabled. Only RetainPtr or OSObjectPtr is allowed for NS types when ARC is disabled.
36373637
36383638
.. code-block:: cpp
36393639
36403640
struct Foo {
36413641
NSObject *ptr; // warn
3642+
dispatch_queue_t queue; // warn
36423643
// ...
36433644
};
36443645
36453646
See `WebKit Guidelines for Safer C++ Programming <https://github.com/WebKit/WebKit/wiki/Safer-CPP-Guidelines>`_ for details.
36463647
36473648
alpha.webkit.UnretainedLambdaCapturesChecker
36483649
""""""""""""""""""""""""""""""""""""""""""""
3649-
Raw pointers and references to NS or CF types can't be captured in lambdas. Only RetainPtr is allowed for CF types regardless of whether ARC is enabled or disabled, and only RetainPtr is allowed for NS types when ARC is disabled.
3650+
Raw pointers and references to NS or CF types can't be captured in lambdas. Only RetainPtr is allowed for CF types regardless of whether ARC is enabled or disabled, and only RetainPtr or OSObjectPtr is allowed for NS types when ARC is disabled.
36503651
36513652
.. code-block:: cpp
36523653
3653-
void foo(NSObject *a, NSObject *b) {
3654+
void foo(NSObject *a, NSObject *b, dispatch_queue_t c) {
36543655
[&, a](){ // warn about 'a'
36553656
do_something(b); // warn about 'b'
3657+
dispatch_queue_get_specific(c, "some"); // warn about 'c'
36563658
};
36573659
};
36583660
@@ -3755,7 +3757,7 @@ alpha.webkit.UnretainedCallArgsChecker
37553757
""""""""""""""""""""""""""""""""""""""
37563758
The goal of this rule is to make sure that lifetime of any dynamically allocated NS or CF objects passed as a call argument keeps its memory region past the end of the call. This applies to call to any function, method, lambda, function pointer or functor. NS or CF objects aren't supposed to be allocated on stack so we check arguments for parameters of raw pointers and references to unretained types.
37573759
3758-
The rules of when to use and not to use RetainPtr are same as alpha.webkit.UncountedCallArgsChecker for ref-counted objects.
3760+
The rules of when to use and not to use RetainPtr or OSObjectPtr are same as alpha.webkit.UncountedCallArgsChecker for ref-counted objects.
37593761
37603762
alpha.webkit.UncountedLocalVarsChecker
37613763
""""""""""""""""""""""""""""""""""""""
@@ -3845,9 +3847,9 @@ Here are some examples of situations that we warn about as they *might* be poten
38453847
38463848
alpha.webkit.UnretainedLocalVarsChecker
38473849
"""""""""""""""""""""""""""""""""""""""
3848-
The goal of this rule is to make sure that any NS or CF local variable is backed by a RetainPtr with lifetime that is strictly larger than the scope of the unretained local variable. To be on the safe side we require the scope of an unretained variable to be embedded in the scope of Retainptr object that backs it.
3850+
The goal of this rule is to make sure that any NS or CF local variable is backed by a RetainPtr or OSObjectPtr with lifetime that is strictly larger than the scope of the unretained local variable. To be on the safe side we require the scope of an unretained variable to be embedded in the scope of RetainPtr or OSObjectPtr object that backs it.
38493851
3850-
The rules of when to use and not to use RetainPtr are same as alpha.webkit.UncountedCallArgsChecker for ref-counted objects.
3852+
The rules of when to use and not to use RetainPtr or OSObjectPtr are same as alpha.webkit.UncountedCallArgsChecker for ref-counted objects.
38513853
38523854
These are examples of cases that we consider safe:
38533855
@@ -3890,8 +3892,8 @@ Here are some examples of situations that we warn about as they *might* be poten
38903892
38913893
webkit.RetainPtrCtorAdoptChecker
38923894
""""""""""""""""""""""""""""""""
3893-
The goal of this rule is to make sure the constructor of RetainPtr as well as adoptNS and adoptCF are used correctly.
3894-
When creating a RetainPtr with +1 semantics, adoptNS or adoptCF should be used, and in +0 semantics, RetainPtr constructor should be used.
3895+
The goal of this rule is to make sure the constructors of RetainPtr and OSObjectPtr as well as adoptNS, adoptCF, and adoptOSObject are used correctly.
3896+
When creating a RetainPtr or OSObjectPtr with +1 semantics, adoptNS, adoptCF, or adoptOSObject should be used, and in +0 semantics, RetainPtr or OSObjectPtr constructor should be used.
38953897
Warn otherwise.
38963898
38973899
These are examples of cases that we consider correct:
@@ -3900,13 +3902,15 @@ These are examples of cases that we consider correct:
39003902
39013903
RetainPtr ptr = adoptNS([[NSObject alloc] init]); // ok
39023904
RetainPtr ptr = CGImageGetColorSpace(image); // ok
3905+
OSObjectPtr ptr = adoptOSObject(dispatch_queue_create("some queue", nullptr)); // ok
39033906
39043907
Here are some examples of cases that we consider incorrect use of RetainPtr constructor and adoptCF
39053908
39063909
.. code-block:: cpp
39073910
39083911
RetainPtr ptr = [[NSObject alloc] init]; // warn
39093912
auto ptr = adoptCF(CGImageGetColorSpace(image)); // warn
3913+
OSObjectPtr ptr = dispatch_queue_create("some queue", nullptr); // warn
39103914
39113915
Debug Checkers
39123916
---------------

clang/include/clang/AST/ASTContext.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3843,4 +3843,25 @@ typename clang::LazyGenerationalUpdatePtr<Owner, T, Update>::ValueType
38433843
return Value;
38443844
}
38453845

3846+
template <> struct llvm::DenseMapInfo<llvm::FoldingSetNodeID> {
3847+
static FoldingSetNodeID getEmptyKey() { return FoldingSetNodeID{}; }
3848+
3849+
static FoldingSetNodeID getTombstoneKey() {
3850+
FoldingSetNodeID ID;
3851+
for (size_t I = 0; I < sizeof(ID) / sizeof(unsigned); ++I) {
3852+
ID.AddInteger(std::numeric_limits<unsigned>::max());
3853+
}
3854+
return ID;
3855+
}
3856+
3857+
static unsigned getHashValue(const FoldingSetNodeID &Val) {
3858+
return Val.ComputeHash();
3859+
}
3860+
3861+
static bool isEqual(const FoldingSetNodeID &LHS,
3862+
const FoldingSetNodeID &RHS) {
3863+
return LHS == RHS;
3864+
}
3865+
};
3866+
38463867
#endif // LLVM_CLANG_AST_ASTCONTEXT_H

clang/include/clang/AST/Decl.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4521,6 +4521,23 @@ class RecordDecl : public TagDecl {
45214521
return field_begin() == field_end();
45224522
}
45234523

4524+
/// noload_fields - Iterate over the fields stored in this record
4525+
/// that are currently loaded; don't attempt to retrieve anything
4526+
/// from an external source.
4527+
field_range noload_fields() const {
4528+
return field_range(noload_field_begin(), noload_field_end());
4529+
}
4530+
4531+
field_iterator noload_field_begin() const;
4532+
field_iterator noload_field_end() const {
4533+
return field_iterator(decl_iterator());
4534+
}
4535+
4536+
// Whether there are any fields (non-static data members) in this record.
4537+
bool noload_field_empty() const {
4538+
return noload_field_begin() == noload_field_end();
4539+
}
4540+
45244541
/// Note that the definition of this type is now complete.
45254542
virtual void completeDefinition();
45264543

clang/include/clang/Basic/BuiltinsRISCV.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,8 @@ include "clang/Basic/BuiltinsRISCVXCV.td"
162162
// XAndes extensions.
163163
//===----------------------------------------------------------------------===//
164164
include "clang/Basic/BuiltinsRISCVXAndes.td"
165+
166+
//===----------------------------------------------------------------------===//
167+
// MIPS extensions.
168+
//===----------------------------------------------------------------------===//
169+
include "clang/Basic/BuiltinsRISCVXMIPS.td"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//==- BuiltinsRISCVXMIPS.td - RISC-V MIPS Builtin database ----*- C++ -*-==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file defines the MIPS-specific builtin function database. Users of
10+
// this file must define the BUILTIN macro to make use of this information.
11+
//
12+
//===----------------------------------------------------------------------===//
13+
14+
//===----------------------------------------------------------------------===//
15+
// MIPS execution control extensions.
16+
//===----------------------------------------------------------------------===//
17+
let Attributes = [NoThrow, Const] in {
18+
def mips_pause : RISCVBuiltin<"void()", "xmipsexectl">;
19+
def mips_ehb : RISCVBuiltin<"void()", "xmipsexectl">;
20+
def mips_ihb : RISCVBuiltin<"void()", "xmipsexectl">;
21+
}

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -497,14 +497,14 @@ let Features = "avx", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWid
497497
def blendps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<8, float>, _Constant int)">;
498498
def blendvpd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<4, double>, _Vector<4, double>)">;
499499
def blendvps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<8, float>, _Vector<8, float>)">;
500+
def vinsertf128_pd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<2, double>, _Constant int)">;
501+
def vinsertf128_ps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<4, float>, _Constant int)">;
502+
def vinsertf128_si256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<4, int>, _Constant int)">;
500503
}
501504

502505
let Features = "avx", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
503506
def vpermilpd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Constant int)">;
504507
def vpermilps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Constant int)">;
505-
def vinsertf128_pd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<2, double>, _Constant int)">;
506-
def vinsertf128_ps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<4, float>, _Constant int)">;
507-
def vinsertf128_si256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<4, int>, _Constant int)">;
508508
def sqrtpd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>)">;
509509
def sqrtps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>)">;
510510
def rsqrtps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>)">;
@@ -513,6 +513,7 @@ let Features = "avx", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in
513513
def roundps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Constant int)">;
514514
}
515515

516+
516517
let Features = "avx", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
517518
def vtestzpd : X86Builtin<"int(_Vector<2, double>, _Vector<2, double>)">;
518519
def vtestcpd : X86Builtin<"int(_Vector<2, double>, _Vector<2, double>)">;
@@ -609,9 +610,9 @@ let Features = "avx2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] i
609610
def permti256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<4, long long int>, _Constant int)">;
610611
def permdi256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Constant int)">;
611612
def extract128i256 : X86Builtin<"_Vector<2, long long int>(_Vector<4, long long int>, _Constant int)">;
612-
def insert128i256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<2, long long int>, _Constant int)">;
613613
}
614614

615+
615616
let Features = "avx2", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
616617
def pavgb256 : X86Builtin<"_Vector<32, unsigned char>(_Vector<32, unsigned char>, _Vector<32, unsigned char>)">;
617618
def pavgw256 : X86Builtin<"_Vector<16, unsigned short>(_Vector<16, unsigned short>, _Vector<16, unsigned short>)">;
@@ -644,6 +645,8 @@ let Features = "avx2", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWi
644645
def psrlv8si : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>)">;
645646
def psllv4di : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<4, long long int>)">;
646647
def psrlv4di : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<4, long long int>)">;
648+
649+
def insert128i256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<2, long long int>, _Constant int)">;
647650
}
648651

649652
let Features = "avx2", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
@@ -2945,29 +2948,29 @@ let Features = "avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<256
29452948
def extracti32x4_256_mask : X86Builtin<"_Vector<4, int>(_Vector<8, int>, _Constant int, _Vector<4, int>, unsigned char)">;
29462949
}
29472950

2948-
let Features = "avx512dq", Attributes = [NoThrow, Const, RequiredVectorWidth<512>] in {
2951+
let Features = "avx512dq", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
29492952
def insertf32x8 : X86Builtin<"_Vector<16, float>(_Vector<16, float>, _Vector<8, float>, _Constant int)">;
29502953
def insertf64x2_512 : X86Builtin<"_Vector<8, double>(_Vector<8, double>, _Vector<2, double>, _Constant int)">;
29512954
def inserti32x8 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<8, int>, _Constant int)">;
29522955
def inserti64x2_512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<2, long long int>, _Constant int)">;
29532956
}
29542957

2955-
let Features = "avx512f", Attributes = [NoThrow, Const, RequiredVectorWidth<512>] in {
2958+
let Features = "avx512f", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
29562959
def insertf64x4 : X86Builtin<"_Vector<8, double>(_Vector<8, double>, _Vector<4, double>, _Constant int)">;
29572960
def inserti64x4 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<4, long long int>, _Constant int)">;
29582961
}
29592962

2960-
let Features = "avx512dq,avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
2963+
let Features = "avx512dq,avx512vl", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
29612964
def insertf64x2_256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<2, double>, _Constant int)">;
29622965
def inserti64x2_256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<2, long long int>, _Constant int)">;
29632966
}
29642967

2965-
let Features = "avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
2968+
let Features = "avx512vl", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
29662969
def insertf32x4_256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<4, float>, _Constant int)">;
29672970
def inserti32x4_256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<4, int>, _Constant int)">;
29682971
}
29692972

2970-
let Features = "avx512f", Attributes = [NoThrow, Const, RequiredVectorWidth<512>] in {
2973+
let Features = "avx512f", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
29712974
def insertf32x4 : X86Builtin<"_Vector<16, float>(_Vector<16, float>, _Vector<4, float>, _Constant int)">;
29722975
def inserti32x4 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<4, int>, _Constant int)">;
29732976
}

0 commit comments

Comments
 (0)