Skip to content

Commit 1d3cf87

Browse files
author
iclsrc
committed
Merge from 'main' to 'sycl-web' (22 commits)
2 parents ad1f8a8 + 13b20e7 commit 1d3cf87

File tree

79 files changed

+2444
-1213
lines changed

Some content is hidden

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

79 files changed

+2444
-1213
lines changed

clang-tools-extra/include-cleaner/lib/Record.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ toFileEntries(llvm::ArrayRef<StringRef> FileNames, FileManager &FM) {
424424
llvm::SmallVector<FileEntryRef> Results;
425425

426426
for (auto FName : FileNames) {
427-
// FIMXE: log the failing cases?
427+
// FIXME: log the failing cases?
428428
if (auto FE = FM.getOptionalFileRef(FName))
429429
Results.push_back(*FE);
430430
}

clang-tools-extra/test/clang-tidy/checkers/bugprone/invalid-enum-default-initialization.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Enum2 E2_2 = Enum2();
4242
// CHECK-NOTES: :14:6: note: enum is defined here
4343

4444
void f1() {
45-
static Enum1 S; // FIMXE: warn for this?
45+
static Enum1 S; // FIXME: warn for this?
4646
Enum1 A;
4747
Enum1 B = Enum1();
4848
// CHECK-NOTES: :[[@LINE-1]]:13: warning: enum value of type 'Enum1' initialized with invalid value of 0, enum doesn't have a zero-value enumerator
@@ -62,7 +62,7 @@ void f2() {
6262
// CHECK-NOTES: :9:12: note: enum is defined here
6363
// CHECK-NOTES: :[[@LINE-3]]:17: warning: enum value of type 'Enum1' initialized with invalid value of 0, enum doesn't have a zero-value enumerator
6464
// CHECK-NOTES: :9:12: note: enum is defined here
65-
Enum1 D[5] = {}; // FIMXE: warn for this?
65+
Enum1 D[5] = {}; // FIXME: warn for this?
6666
// CHECK-NOTES: :[[@LINE-1]]:16: warning: enum value of type 'Enum1' initialized with invalid value of 0, enum doesn't have a zero-value enumerator
6767
// CHECK-NOTES: :9:12: note: enum is defined here
6868
}

clang/docs/LanguageExtensions.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,6 +2884,50 @@ between the host and device is known to be compatible.
28842884
);
28852885
#pragma OPENCL EXTENSION __cl_clang_non_portable_kernel_param_types : disable
28862886
2887+
``__cl_clang_function_scope_local_variables``
2888+
----------------------------------------------
2889+
2890+
This extension allows declaring variables in the local address space within
2891+
function scope, including non-kernel functions or nested scopes within a kernel,
2892+
using regular OpenCL extension pragma mechanism detailed in `the OpenCL
2893+
Extension Specification, section 1.2
2894+
<https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#extensions-overview>`_.
2895+
2896+
This relaxes the `Declaration Scopes and Variable Types
2897+
<https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_C.html#_usage_for_declaration_scopes_and_variable_types>`_
2898+
rule that limits local-address-space variable declarations to the outermost
2899+
compound statement inside the body of the kernel function.
2900+
2901+
To expose static local allocations at kernel scope, targets can either force-
2902+
inline non-kernel functions that declare local memory or pass a kernel-allocated
2903+
local buffer to those functions via an implicit argument.
2904+
2905+
.. code-block:: c++
2906+
2907+
#pragma OPENCL EXTENSION __cl_clang_function_scope_local_variables : enable
2908+
kernel void kernel1(...)
2909+
{
2910+
{
2911+
local float a; // compiled - no diagnostic generated
2912+
}
2913+
}
2914+
void foo()
2915+
{
2916+
local float c; // compiled - no diagnostic generated
2917+
}
2918+
2919+
#pragma OPENCL EXTENSION __cl_clang_function_scope_local_variables : disable
2920+
kernel void kernel2(...)
2921+
{
2922+
{
2923+
local float a; // error - variables in the local address space can only be declared in the outermost scope of a kernel function
2924+
}
2925+
}
2926+
void bar()
2927+
{
2928+
local float c; // error - non-kernel function variable cannot be declared in local address space
2929+
}
2930+
28872931
Remove address space builtin function
28882932
-------------------------------------
28892933

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ Miscellaneous Clang Crashes Fixed
198198
- Fixed a crash when attempting to jump over initialization of a variable with variably modified type. (#GH175540)
199199
- Fixed a crash when using loop hint with a value dependent argument inside a
200200
generic lambda. (#GH172289)
201+
- Fixed a crash in C++ overload resolution with ``_Atomic``-qualified argument types. (#GH170433)
201202

202203
OpenACC Specific Changes
203204
------------------------

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2797,7 +2797,7 @@ DEF_TRAVERSE_STMT(CXXNewExpr, {
27972797
DEF_TRAVERSE_STMT(OffsetOfExpr, {
27982798
// The child-iterator will pick up the expression representing
27992799
// the field.
2800-
// FIMXE: for code like offsetof(Foo, a.b.c), should we get
2800+
// FIXME: for code like offsetof(Foo, a.b.c), should we get
28012801
// making a MemberExpr callbacks for Foo.a, Foo.a.b, and Foo.a.b.c?
28022802
TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
28032803
})

clang/include/clang/Basic/OpenCLExtensions.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ OPENCL_GENERIC_EXTENSION(__opencl_c_work_group_collective_functions, false, 200,
131131
OPENCL_EXTENSION(cl_clang_storage_class_specifiers, true, 100)
132132
OPENCL_EXTENSION(__cl_clang_function_pointers, true, 100)
133133
OPENCL_EXTENSION(__cl_clang_variadic_functions, true, 100)
134+
OPENCL_EXTENSION(__cl_clang_function_scope_local_variables, true, 100)
134135
OPENCL_EXTENSION(__cl_clang_non_portable_kernel_param_types, true, 100)
135136
OPENCL_EXTENSION(__cl_clang_bitfields, true, 100)
136137

clang/include/clang/Sema/Overload.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ class Sema;
444444
if (auto *N = T->getAs<MemberPointerType>();
445445
N && N->isMemberFunctionPointer())
446446
T = C.getDecayedType(N->getPointeeType());
447-
return T;
447+
448+
return T.getAtomicUnqualifiedType();
448449
};
449450
// The types might differ if there is an array-to-pointer conversion
450451
// an function-to-pointer conversion, or lvalue-to-rvalue conversion.

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7406,7 +7406,8 @@ bool Compiler<Emitter>::emitComplexComparison(const Expr *LHS, const Expr *RHS,
74067406
const BinaryOperator *E) {
74077407
assert(E->isComparisonOp());
74087408
assert(!Initializing);
7409-
assert(!DiscardResult);
7409+
if (DiscardResult)
7410+
return this->discard(LHS) && this->discard(RHS);
74107411

74117412
PrimType ElemT;
74127413
bool LHSIsComplex;

clang/lib/AST/ByteCode/Interp.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,8 +2628,9 @@ static inline bool CastFloatingIntegralAP(InterpState &S, CodePtr OpPC,
26282628
auto Status = F.convertToInteger(Result);
26292629

26302630
// Float-to-Integral overflow check.
2631-
if ((Status & APFloat::opStatus::opInvalidOp) && F.isFinite())
2632-
return handleOverflow(S, OpPC, F.getAPFloat());
2631+
if ((Status & APFloat::opStatus::opInvalidOp) && F.isFinite() &&
2632+
!handleOverflow(S, OpPC, F.getAPFloat()))
2633+
return false;
26332634

26342635
FPOptions FPO = FPOptions::getFromOpaqueInt(FPOI);
26352636

@@ -2649,8 +2650,9 @@ static inline bool CastFloatingIntegralAPS(InterpState &S, CodePtr OpPC,
26492650
auto Status = F.convertToInteger(Result);
26502651

26512652
// Float-to-Integral overflow check.
2652-
if ((Status & APFloat::opStatus::opInvalidOp) && F.isFinite())
2653-
return handleOverflow(S, OpPC, F.getAPFloat());
2653+
if ((Status & APFloat::opStatus::opInvalidOp) && F.isFinite() &&
2654+
!handleOverflow(S, OpPC, F.getAPFloat()))
2655+
return false;
26542656

26552657
FPOptions FPO = FPOptions::getFromOpaqueInt(FPOI);
26562658

clang/lib/Sema/SemaDecl.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9099,8 +9099,17 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
90999099
NewVD->setInvalidDecl();
91009100
return;
91019101
}
9102-
if (T.getAddressSpace() == LangAS::opencl_constant ||
9103-
T.getAddressSpace() == LangAS::opencl_local) {
9102+
// When this extension is enabled, 'local' variables are permitted in
9103+
// non-kernel functions and within nested scopes of kernel functions,
9104+
// bypassing standard OpenCL address space restrictions.
9105+
bool AllowFunctionScopeLocalVariables =
9106+
T.getAddressSpace() == LangAS::opencl_local &&
9107+
getOpenCLOptions().isAvailableOption(
9108+
"__cl_clang_function_scope_local_variables", getLangOpts());
9109+
if (AllowFunctionScopeLocalVariables) {
9110+
// Direct pass: No further diagnostics needed for this specific case.
9111+
} else if (T.getAddressSpace() == LangAS::opencl_constant ||
9112+
T.getAddressSpace() == LangAS::opencl_local) {
91049113
FunctionDecl *FD = getCurFunctionDecl();
91059114
// OpenCL v1.1 s6.5.2 and s6.5.3: no local or constant variables
91069115
// in functions.
@@ -15601,7 +15610,7 @@ void Sema::ActOnDocumentableDecls(ArrayRef<Decl *> Group) {
1560115610
}
1560215611
}
1560315612

15604-
// FIMXE: We assume every Decl in the group is in the same file.
15613+
// FIXME: We assume every Decl in the group is in the same file.
1560515614
// This is false when preprocessor constructs the group from decls in
1560615615
// different files (e. g. macros or #include).
1560715616
Context.attachCommentsToJustParsedDecls(Group, &getPreprocessor());

0 commit comments

Comments
 (0)