Skip to content

Commit f65a38c

Browse files
committed
Merge from 'main' to 'sycl-web' (41 commits)
CONFLICT (content): Merge conflict in clang/lib/CodeGen/CGLoopInfo.cpp CONFLICT (content): Merge conflict in clang/lib/CodeGen/CGLoopInfo.h CONFLICT (content): Merge conflict in clang/lib/Sema/SemaStmtAttr.cpp CONFLICT (content): Merge conflict in clang/lib/Sema/SemaTemplateInstantiate.cpp CONFLICT (content): Merge conflict in clang/lib/Sema/TreeTransform.h
2 parents 062fe9b + 48ff354 commit f65a38c

File tree

155 files changed

+5189
-3113
lines changed

Some content is hidden

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

155 files changed

+5189
-3113
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ env:
4444
jobs:
4545
stage1:
4646
runs-on:
47-
group: libcxx-runners-16
47+
group: libcxx-runners-8
4848
continue-on-error: false
4949
strategy:
5050
fail-fast: true
@@ -163,10 +163,10 @@ jobs:
163163
machine: libcxx-runners-8
164164
std_modules: 'ON'
165165
- config: 'generic-asan'
166-
machine: libcxx-runners-16
166+
machine: libcxx-runners-8
167167
std_modules: 'OFF'
168168
- config: 'generic-tsan'
169-
machine: libcxx-runners-16
169+
machine: libcxx-runners-8
170170
std_modules: 'OFF'
171171
- config: 'generic-ubsan'
172172
machine: libcxx-runners-8

bolt/test/lsda.cpp renamed to bolt/test/lsda-section-name.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// This test check that LSDA section named by .gcc_except_table.main is
22
// disassembled by BOLT.
33

4-
// RUN: %clang++ %cxxflags -O3 -flto=thin -no-pie -c %s -o %t.o
5-
// RUN: %clang++ %cxxflags -flto=thin -no-pie -fuse-ld=lld %t.o -o %t.exe \
4+
// RUN: %clang++ %cxxflags -O3 -no-pie -c %s -o %t.o
5+
// RUN: %clang++ %cxxflags -no-pie -fuse-ld=lld %t.o -o %t.exe \
66
// RUN: -Wl,-q -Wl,--script=%S/Inputs/lsda.ldscript
77
// RUN: llvm-readelf -SW %t.exe | FileCheck %s
88
// RUN: llvm-bolt %t.exe -o %t.bolt

clang/docs/ReleaseNotes.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ C23 Feature Support
209209
- Clang now supports ``<stdckdint.h>`` which defines several macros for performing
210210
checked integer arithmetic. It is also exposed in pre-C23 modes.
211211

212+
- Completed the implementation of
213+
`N2508 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2508.pdf>`_. We
214+
previously implemented allowing a label at the end of a compound statement,
215+
and now we've implemented allowing a label to be followed by a declaration
216+
instead of a statement.
217+
212218
Non-comprehensive list of changes in this release
213219
-------------------------------------------------
214220

@@ -311,6 +317,23 @@ Attribute Changes in Clang
311317
should be a coroutine. A non-coroutine function marked with ``[[clang::coro_wrapper]]``
312318
is still allowed to return the such a type. This is helpful for analyzers to recognize coroutines from the function signatures.
313319

320+
- Clang now supports ``[[clang::code_align(N)]]`` as an attribute which can be
321+
applied to a loop and specifies the byte alignment for a loop. This attribute
322+
accepts a positive integer constant initialization expression indicating the
323+
number of bytes for the minimum alignment boundary. Its value must be a power
324+
of 2, between 1 and 4096(inclusive).
325+
326+
.. code-block:: c++
327+
328+
void Array(int *array, size_t n) {
329+
[[clang::code_align(64)]] for (int i = 0; i < n; ++i) array[i] = 0;
330+
}
331+
332+
template<int A>
333+
void func() {
334+
[[clang::code_align(A)]] for(;;) { }
335+
}
336+
314337
Improvements to Clang's diagnostics
315338
-----------------------------------
316339
- Clang constexpr evaluator now prints template arguments when displaying
@@ -566,6 +589,23 @@ Bug Fixes in This Version
566589
Fixes (`#67687 <https://github.com/llvm/llvm-project/issues/67687>`_)
567590
- Fix crash from constexpr evaluator evaluating uninitialized arrays as rvalue.
568591
Fixes (`#67317 <https://github.com/llvm/llvm-project/issues/67317>`_)
592+
- Clang now properly diagnoses use of stand-alone OpenMP directives after a
593+
label (including ``case`` or ``default`` labels).
594+
595+
Before:
596+
597+
.. code-block:: c++
598+
599+
label:
600+
#pragma omp barrier // ok
601+
602+
After:
603+
604+
.. code-block:: c++
605+
606+
label:
607+
#pragma omp barrier // error: '#pragma omp barrier' cannot be an immediate substatement
608+
569609
- Fixed an issue that a benign assertion might hit when instantiating a pack expansion
570610
inside a lambda. (`#61460 <https://github.com/llvm/llvm-project/issues/61460>`_)
571611

clang/include/clang/AST/OpenMPClause.h

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,89 +2513,6 @@ class OMPRelaxedClause final : public OMPClause {
25132513
}
25142514
};
25152515

2516-
/// This represents 'fail' clause in the '#pragma omp atomic'
2517-
/// directive.
2518-
///
2519-
/// \code
2520-
/// #pragma omp atomic compare fail
2521-
/// \endcode
2522-
/// In this example directive '#pragma omp atomic compare' has 'fail' clause.
2523-
class OMPFailClause final : public OMPClause {
2524-
2525-
// FailParameter is a memory-order-clause. Storing the ClauseKind is
2526-
// sufficient for our purpose.
2527-
OpenMPClauseKind FailParameter = llvm::omp::Clause::OMPC_unknown;
2528-
SourceLocation FailParameterLoc;
2529-
SourceLocation LParenLoc;
2530-
2531-
friend class OMPClauseReader;
2532-
2533-
/// Sets the location of '(' in fail clause.
2534-
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2535-
2536-
/// Sets the location of memoryOrder clause argument in fail clause.
2537-
void setFailParameterLoc(SourceLocation Loc) { FailParameterLoc = Loc; }
2538-
2539-
/// Sets the mem_order clause for 'atomic compare fail' directive.
2540-
void setFailParameter(OpenMPClauseKind FailParameter) {
2541-
this->FailParameter = FailParameter;
2542-
assert(checkFailClauseParameter(FailParameter) &&
2543-
"Invalid fail clause parameter");
2544-
}
2545-
2546-
public:
2547-
/// Build 'fail' clause.
2548-
///
2549-
/// \param StartLoc Starting location of the clause.
2550-
/// \param EndLoc Ending location of the clause.
2551-
OMPFailClause(SourceLocation StartLoc, SourceLocation EndLoc)
2552-
: OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc) {}
2553-
2554-
OMPFailClause(OpenMPClauseKind FailParameter, SourceLocation FailParameterLoc,
2555-
SourceLocation StartLoc, SourceLocation LParenLoc,
2556-
SourceLocation EndLoc)
2557-
: OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc),
2558-
FailParameterLoc(FailParameterLoc), LParenLoc(LParenLoc) {
2559-
2560-
setFailParameter(FailParameter);
2561-
}
2562-
2563-
/// Build an empty clause.
2564-
OMPFailClause()
2565-
: OMPClause(llvm::omp::OMPC_fail, SourceLocation(), SourceLocation()) {}
2566-
2567-
child_range children() {
2568-
return child_range(child_iterator(), child_iterator());
2569-
}
2570-
2571-
const_child_range children() const {
2572-
return const_child_range(const_child_iterator(), const_child_iterator());
2573-
}
2574-
2575-
child_range used_children() {
2576-
return child_range(child_iterator(), child_iterator());
2577-
}
2578-
const_child_range used_children() const {
2579-
return const_child_range(const_child_iterator(), const_child_iterator());
2580-
}
2581-
2582-
static bool classof(const OMPClause *T) {
2583-
return T->getClauseKind() == llvm::omp::OMPC_fail;
2584-
}
2585-
2586-
/// Gets the location of '(' (for the parameter) in fail clause.
2587-
SourceLocation getLParenLoc() const {
2588-
return LParenLoc;
2589-
}
2590-
2591-
/// Gets the location of Fail Parameter (type memory-order-clause) in
2592-
/// fail clause.
2593-
SourceLocation getFailParameterLoc() const { return FailParameterLoc; }
2594-
2595-
/// Gets the parameter (type memory-order-clause) in Fail clause.
2596-
OpenMPClauseKind getFailParameter() const { return FailParameter; }
2597-
};
2598-
25992516
/// This represents clause 'private' in the '#pragma omp ...' directives.
26002517
///
26012518
/// \code

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,11 +3413,6 @@ bool RecursiveASTVisitor<Derived>::VisitOMPCompareClause(OMPCompareClause *) {
34133413
return true;
34143414
}
34153415

3416-
template <typename Derived>
3417-
bool RecursiveASTVisitor<Derived>::VisitOMPFailClause(OMPFailClause *) {
3418-
return true;
3419-
}
3420-
34213416
template <typename Derived>
34223417
bool RecursiveASTVisitor<Derived>::VisitOMPSeqCstClause(OMPSeqCstClause *) {
34233418
return true;

clang/include/clang/Basic/Attr.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5378,3 +5378,15 @@ def PreferredType: InheritableAttr {
53785378
let Args = [TypeArgument<"Type", 1>];
53795379
let Documentation = [PreferredTypeDocumentation];
53805380
}
5381+
5382+
def CodeAlign: StmtAttr {
5383+
let Spellings = [Clang<"code_align">];
5384+
let Subjects = SubjectList<[ForStmt, CXXForRangeStmt, WhileStmt, DoStmt],
5385+
ErrorDiag, "'for', 'while', and 'do' statements">;
5386+
let Args = [ExprArgument<"Alignment">];
5387+
let Documentation = [CodeAlignAttrDocs];
5388+
let AdditionalMembers = [{
5389+
static constexpr int MinimumAlignment = 1;
5390+
static constexpr int MaximumAlignment = 4096;
5391+
}];
5392+
}

clang/include/clang/Basic/AttrDocs.td

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9244,3 +9244,44 @@ Note: ``a_promise_type::get_return_object`` is exempted from this analysis as it
92449244
implementation detail of any coroutine library.
92459245
}];
92469246
}
9247+
9248+
def CodeAlignAttrDocs : Documentation {
9249+
let Category = DocCatVariable;
9250+
let Heading = "clang::code_align";
9251+
let Content = [{
9252+
The ``clang::code_align(N)`` attribute applies to a loop and specifies the byte
9253+
alignment for a loop. The attribute accepts a positive integer constant
9254+
initialization expression indicating the number of bytes for the minimum
9255+
alignment boundary. Its value must be a power of 2, between 1 and 4096
9256+
(inclusive).
9257+
9258+
.. code-block:: c++
9259+
9260+
void foo() {
9261+
int var = 0;
9262+
[[clang::code_align(16)]] for (int i = 0; i < 10; ++i) var++;
9263+
}
9264+
9265+
void Array(int *array, size_t n) {
9266+
[[clang::code_align(64)]] for (int i = 0; i < n; ++i) array[i] = 0;
9267+
}
9268+
9269+
void count () {
9270+
int a1[10], int i = 0;
9271+
[[clang::code_align(32)]] while (i < 10) { a1[i] += 3; }
9272+
}
9273+
9274+
void check() {
9275+
int a = 10;
9276+
[[clang::code_align(8)]] do {
9277+
a = a + 1;
9278+
} while (a < 20);
9279+
}
9280+
9281+
template<int A>
9282+
void func() {
9283+
[[clang::code_align(A)]] for(;;) { }
9284+
}
9285+
9286+
}];
9287+
}

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ def note_missing_selector_name : Note<
299299
def note_force_empty_selector_name : Note<
300300
"or insert whitespace before ':' to use %0 as parameter name "
301301
"and have an empty entry in the selector">;
302+
def ext_c_label_followed_by_declaration : ExtWarn<
303+
"label followed by a declaration is a C23 extension">,
304+
InGroup<C23>;
305+
def warn_c23_compat_label_followed_by_declaration : Warning<
306+
"label followed by a declaration is incompatible with C standards before "
307+
"C23">, InGroup<CPre23Compat>, DefaultIgnore;
302308
def ext_c_label_end_of_compound_statement : ExtWarn<
303309
"label at end of compound statement is a C23 extension">,
304310
InGroup<C23>;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10100,6 +10100,11 @@ def err_duplicate_case_differing_expr : Error<
1010010100
def warn_case_empty_range : Warning<"empty case range specified">;
1010110101
def warn_missing_case_for_condition :
1010210102
Warning<"no case matching constant switch condition '%0'">;
10103+
def err_loop_attr_conflict : Error<
10104+
"conflicting loop attribute %0">;
10105+
def err_attribute_power_of_two_in_range : Error<
10106+
"%0 attribute requires an integer argument which is a constant power of two "
10107+
"between %1 and %2 inclusive; provided argument was %3">;
1010310108

1010410109
def warn_def_missing_case : Warning<"%plural{"
1010510110
"1:enumeration value %1 not explicitly handled in switch|"
@@ -11044,8 +11049,6 @@ def note_omp_atomic_compare: Note<
1104411049
"expect binary operator in conditional expression|expect '<', '>' or '==' as order operator|expect comparison in a form of 'x == e', 'e == x', 'x ordop expr', or 'expr ordop x'|"
1104511050
"expect lvalue for result value|expect scalar value|expect integer value|unexpected 'else' statement|expect '==' operator|expect an assignment statement 'v = x'|"
1104611051
"expect a 'if' statement|expect no more than two statements|expect a compound statement|expect 'else' statement|expect a form 'r = x == e; if (r) ...'}0">;
11047-
def err_omp_atomic_fail_wrong_or_no_clauses : Error<"expected a memory order clause">;
11048-
def err_omp_atomic_fail_no_compare : Error<"expected 'compare' clause with the 'fail' modifier">;
1104911052
def err_omp_atomic_several_clauses : Error<
1105011053
"directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update', 'capture', or 'compare' clause">;
1105111054
def err_omp_several_mem_order_clauses : Error<

clang/include/clang/Basic/OpenACCKinds.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ enum class OpenACCDirectiveKind {
3333
Loop,
3434
// FIXME: 'cache'
3535

36-
// FIXME: Combined Constructs.
36+
// Combined Constructs.
37+
ParallelLoop,
38+
SerialLoop,
39+
KernelsLoop,
3740

3841
// FIXME: atomic Construct variants.
3942

0 commit comments

Comments
 (0)