Skip to content

Commit f3356d2

Browse files
committed
Merge from 'main' to 'sycl-web' (73 commits)
CONFLICT (content): Merge conflict in llvm/test/CMakeLists.txt
2 parents 225106d + 13605ab commit f3356d2

File tree

303 files changed

+15000
-1979
lines changed

Some content is hidden

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

303 files changed

+15000
-1979
lines changed

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/LanguageExtensions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ The elementwise intrinsics ``__builtin_elementwise_popcount``,
772772
``__builtin_elementwise_bitreverse``, ``__builtin_elementwise_add_sat``,
773773
``__builtin_elementwise_sub_sat``, ``__builtin_elementwise_max``,
774774
``__builtin_elementwise_min``, ``__builtin_elementwise_abs``,
775-
``__builtin_elementwise_ctlz``, ``__builtin_elementwise_cttz``, and
775+
``__builtin_elementwise_clzg``, ``__builtin_elementwise_ctzg``, and
776776
``__builtin_elementwise_fma`` can be called in a ``constexpr`` context.
777777

778778
No implicit promotion of integer types takes place. The mixing of integer types
@@ -884,11 +884,11 @@ T __builtin_elementwise_fshr(T x, T y, T z) perform a funnel shift right. Co
884884
right by z (modulo the bit width of the original arguments),
885885
and the least significant bits are extracted to produce
886886
a result that is the same size as the original arguments.
887-
T __builtin_elementwise_ctlz(T x[, T y]) return the number of leading 0 bits in the first argument. If integer types
887+
T __builtin_elementwise_clzg(T x[, T y]) return the number of leading 0 bits in the first argument. If integer types
888888
the first argument is 0 and an optional second argument is provided,
889889
the second argument is returned. It is undefined behaviour if the
890890
first argument is 0 and no second argument is provided.
891-
T __builtin_elementwise_cttz(T x[, T y]) return the number of trailing 0 bits in the first argument. If integer types
891+
T __builtin_elementwise_ctzg(T x[, T y]) return the number of trailing 0 bits in the first argument. If integer types
892892
the first argument is 0 and an optional second argument is provided,
893893
the second argument is returned. It is undefined behaviour if the
894894
first argument is 0 and no second argument is provided.

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
@@ -3848,4 +3848,25 @@ typename clang::LazyGenerationalUpdatePtr<Owner, T, Update>::ValueType
38483848
return Value;
38493849
}
38503850

3851+
template <> struct llvm::DenseMapInfo<llvm::FoldingSetNodeID> {
3852+
static FoldingSetNodeID getEmptyKey() { return FoldingSetNodeID{}; }
3853+
3854+
static FoldingSetNodeID getTombstoneKey() {
3855+
FoldingSetNodeID ID;
3856+
for (size_t I = 0; I < sizeof(ID) / sizeof(unsigned); ++I) {
3857+
ID.AddInteger(std::numeric_limits<unsigned>::max());
3858+
}
3859+
return ID;
3860+
}
3861+
3862+
static unsigned getHashValue(const FoldingSetNodeID &Val) {
3863+
return Val.ComputeHash();
3864+
}
3865+
3866+
static bool isEqual(const FoldingSetNodeID &LHS,
3867+
const FoldingSetNodeID &RHS) {
3868+
return LHS == RHS;
3869+
}
3870+
};
3871+
38513872
#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
@@ -4522,6 +4522,23 @@ class RecordDecl : public TagDecl {
45224522
return field_begin() == field_end();
45234523
}
45244524

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

clang/include/clang/Basic/Builtins.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,13 +1551,13 @@ def ElementwiseFshr : Builtin {
15511551
}
15521552

15531553
def ElementwiseCtlz : Builtin {
1554-
let Spellings = ["__builtin_elementwise_ctlz"];
1554+
let Spellings = ["__builtin_elementwise_clzg"];
15551555
let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
15561556
let Prototype = "void(...)";
15571557
}
15581558

15591559
def ElementwiseCttz : Builtin {
1560-
let Spellings = ["__builtin_elementwise_cttz"];
1560+
let Spellings = ["__builtin_elementwise_ctzg"];
15611561
let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
15621562
let Prototype = "void(...)";
15631563
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def note_constexpr_non_const_vectorelements : Note<
401401
def note_constexpr_assumption_failed : Note<
402402
"assumption evaluated to false">;
403403
def note_constexpr_countzeroes_zero : Note<
404-
"evaluation of %select{__builtin_elementwise_ctlz|__builtin_elementwise_cttz}0 "
404+
"evaluation of %select{__builtin_elementwise_clzg|__builtin_elementwise_ctzg}0 "
405405
"with a zero value is undefined">;
406406
def err_experimental_clang_interp_failed : Error<
407407
"the experimental clang interpreter failed to evaluate an expression">;

clang/include/clang/StaticAnalyzer/Checkers/Checkers.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ def UnretainedLocalVarsChecker : Checker<"UnretainedLocalVarsChecker">,
17261726
Documentation<HasDocumentation>;
17271727

17281728
def RetainPtrCtorAdoptChecker : Checker<"RetainPtrCtorAdoptChecker">,
1729-
HelpText<"Check for correct use of RetainPtr constructor, adoptNS, and adoptCF">,
1729+
HelpText<"Check for correct use of RetainPtr/OSObjectPtr constructor, adoptNS, adoptCF, and adoptOSObject">,
17301730
Documentation<HasDocumentation>;
17311731

17321732
} // end alpha.webkit

0 commit comments

Comments
 (0)