Skip to content

Commit f4917cd

Browse files
committed
Merge from 'main' to 'sycl-web' (47 commits)
CONFLICT (content): Merge conflict in clang/lib/Sema/SemaLambda.cpp
2 parents 5e44c50 + 127bf44 commit f4917cd

File tree

164 files changed

+4007
-1258
lines changed

Some content is hidden

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

164 files changed

+4007
-1258
lines changed

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,13 +1227,10 @@ bool BinaryFunction::disassemble() {
12271227
BC.DisAsm->getInstruction(TempInst, Size, FunctionData.slice(Offset),
12281228
AbsoluteInstrAddr, nulls());
12291229
if (!BC.validateEncoding(TempInst, FunctionData.slice(Offset, Size))) {
1230-
if (opts::Verbosity >= 0) {
1231-
errs() << "BOLT-WARNING: internal assembler/disassembler error "
1232-
"detected for AVX512 instruction:\n";
1233-
BC.printInstruction(errs(), TempInst, AbsoluteInstrAddr);
1234-
errs() << " in function " << *this << '\n';
1235-
}
1236-
1230+
errs() << "BOLT-WARNING: internal assembler/disassembler error "
1231+
"detected for AVX512 instruction:\n";
1232+
BC.printInstruction(errs(), TempInst, AbsoluteInstrAddr);
1233+
errs() << " in function " << *this << '\n';
12371234
setIgnored();
12381235
break;
12391236
}

clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,8 @@ bool ForLoopIndexUseVisitor::TraverseLambdaCapture(LambdaExpr *LE,
785785
const LambdaCapture *C,
786786
Expr *Init) {
787787
if (C->capturesVariable()) {
788-
const VarDecl *VDecl = C->getCapturedVar();
789-
if (areSameVariable(IndexVar, cast<ValueDecl>(VDecl))) {
788+
const ValueDecl *VDecl = C->getCapturedVar();
789+
if (areSameVariable(IndexVar, VDecl)) {
790790
// FIXME: if the index is captured, it will count as an usage and the
791791
// alias (if any) won't work, because it is only used in case of having
792792
// exactly one usage.

clang/docs/ReleaseNotes.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ C++ Language Changes in Clang
108108
C++20 Feature Support
109109
^^^^^^^^^^^^^^^^^^^^^
110110

111+
- Support capturing structured bindings in lambdas
112+
(`P1091R3 <https://wg21.link/p1091r3>`_ and `P1381R1 <https://wg21.link/P1381R1>`).
113+
This fixes issues `GH52720 <https://github.com/llvm/llvm-project/issues/52720>`_,
114+
`GH54300 <https://github.com/llvm/llvm-project/issues/54300>`_,
115+
`GH54301 <https://github.com/llvm/llvm-project/issues/54301>`_,
116+
and `GH49430 <https://github.com/llvm/llvm-project/issues/49430>`_.
117+
118+
119+
120+
111121
C++2b Feature Support
112122
^^^^^^^^^^^^^^^^^^^^^
113123

@@ -138,6 +148,8 @@ CUDA Support in Clang
138148
X86 Support in Clang
139149
--------------------
140150

151+
- Support ``-mindirect-branch-cs-prefix`` for call and jmp to indirect thunk.
152+
141153
DWARF Support in Clang
142154
----------------------
143155

clang/include/clang/AST/Decl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,11 @@ class ValueDecl : public NamedDecl {
690690
/// or declared with the weak or weak-ref attr.
691691
bool isWeak() const;
692692

693+
/// Whether this variable is the implicit variable for a lambda init-capture.
694+
/// Only VarDecl can be init captures, but both VarDecl and BindingDecl
695+
/// can be captured.
696+
bool isInitCapture() const;
697+
693698
// Implement isa/cast/dyncast/etc.
694699
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
695700
static bool classofKind(Kind K) { return K >= firstValue && K <= lastValue; }

clang/include/clang/AST/DeclCXX.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,8 +1057,9 @@ class CXXRecordDecl : public RecordDecl {
10571057
///
10581058
/// \note No entries will be added for init-captures, as they do not capture
10591059
/// variables.
1060-
void getCaptureFields(llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
1061-
FieldDecl *&ThisCapture) const;
1060+
void
1061+
getCaptureFields(llvm::DenseMap<const ValueDecl *, FieldDecl *> &Captures,
1062+
FieldDecl *&ThisCapture) const;
10621063

10631064
using capture_const_iterator = const LambdaCapture *;
10641065
using capture_const_range = llvm::iterator_range<capture_const_iterator>;

clang/include/clang/AST/LambdaCapture.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class LambdaCapture {
7171
/// capture that is a pack expansion, or an invalid source
7272
/// location to indicate that this is not a pack expansion.
7373
LambdaCapture(SourceLocation Loc, bool Implicit, LambdaCaptureKind Kind,
74-
VarDecl *Var = nullptr,
74+
ValueDecl *Var = nullptr,
7575
SourceLocation EllipsisLoc = SourceLocation());
7676

7777
/// Determine the kind of capture.
@@ -86,7 +86,7 @@ class LambdaCapture {
8686

8787
/// Determine whether this capture handles a variable.
8888
bool capturesVariable() const {
89-
return isa_and_nonnull<VarDecl>(DeclAndBits.getPointer());
89+
return isa_and_nonnull<ValueDecl>(DeclAndBits.getPointer());
9090
}
9191

9292
/// Determine whether this captures a variable length array bound
@@ -101,9 +101,9 @@ class LambdaCapture {
101101
///
102102
/// This operation is only valid if this capture is a variable capture
103103
/// (other than a capture of \c this).
104-
VarDecl *getCapturedVar() const {
104+
ValueDecl *getCapturedVar() const {
105105
assert(capturesVariable() && "No variable available for capture");
106-
return static_cast<VarDecl *>(DeclAndBits.getPointer());
106+
return static_cast<ValueDecl *>(DeclAndBits.getPointer());
107107
}
108108

109109
/// Determine whether this was an implicit capture (not

clang/include/clang/AST/Stmt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class RecordDecl;
5959
class SourceManager;
6060
class StringLiteral;
6161
class Token;
62+
class ValueDecl;
6263
class VarDecl;
6364

6465
//===----------------------------------------------------------------------===//

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4722,7 +4722,7 @@ AST_MATCHER_P(LambdaExpr, hasAnyCapture, internal::Matcher<LambdaCapture>,
47224722
/// In the matcher
47234723
/// lambdaExpr(hasAnyCapture(lambdaCapture(capturesVar(hasName("x")))),
47244724
/// capturesVar(hasName("x")) matches `x` and `x = 1`.
4725-
AST_MATCHER_P(LambdaCapture, capturesVar, internal::Matcher<VarDecl>,
4725+
AST_MATCHER_P(LambdaCapture, capturesVar, internal::Matcher<ValueDecl>,
47264726
InnerMatcher) {
47274727
auto *capturedVar = Node.getCapturedVar();
47284728
return capturedVar && InnerMatcher.matches(*capturedVar, Finder, Builder);

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ CODEGENOPT(CFProtectionBranch , 1, 0) ///< if -fcf-protection is
108108
///< set to full or branch.
109109
CODEGENOPT(IBTSeal, 1, 0) ///< set to optimize CFProtectionBranch.
110110
CODEGENOPT(FunctionReturnThunks, 1, 0) ///< -mfunction-return={keep|thunk-extern}
111+
CODEGENOPT(IndirectBranchCSPrefix, 1, 0) ///< if -mindirect-branch-cs-prefix
112+
///< is set.
111113

112114
CODEGENOPT(XRayInstrumentFunctions , 1, 0) ///< Set when -fxray-instrument is
113115
///< enabled.

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9074,6 +9074,16 @@ def ext_ms_anonymous_record : ExtWarn<
90749074
def err_reference_to_local_in_enclosing_context : Error<
90759075
"reference to local %select{variable|binding}1 %0 declared in enclosing "
90769076
"%select{%3|block literal|lambda expression|context}2">;
9077+
def err_bitfield_capture_by_ref : Error<
9078+
"cannot capture a bit-field by reference">;
9079+
def err_capture_binding_openmp : Error<
9080+
"capturing a structured binding is not yet supported in OpenMP">;
9081+
def ext_capture_binding : ExtWarn<
9082+
"captured structured bindings are a C++20 extension">, InGroup<CXX20>;
9083+
def warn_cxx17_compat_capture_binding : Warning<
9084+
"captured structured bindings are incompatible with "
9085+
"C++ standards before C++20">,
9086+
InGroup<CXXPre20Compat>, DefaultIgnore;
90779087

90789088
def err_static_data_member_not_allowed_in_local_class : Error<
90799089
"static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;

0 commit comments

Comments
 (0)