Skip to content

Commit 3c40f43

Browse files
Merge from 'main' to 'sycl-web' (49 commits)
CONFLICT (content): Merge conflict in clang/lib/AST/ItaniumMangle.cpp CONFLICT (content): Merge conflict in clang/lib/Sema/SemaExceptionSpec.cpp
2 parents f1e463c + 89fb849 commit 3c40f43

File tree

1,189 files changed

+253948
-415708
lines changed

Some content is hidden

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

1,189 files changed

+253948
-415708
lines changed

.github/workflows/release-binaries-save-stage/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ inputs:
1010
required: true
1111
type: 'string'
1212

13+
permissions:
14+
contents: read
15+
1316
runs:
1417
using: "composite"
1518
steps:
@@ -18,6 +21,9 @@ runs:
1821
- name: Package Build and Source Directories
1922
shell: bash
2023
run: |
24+
# Remove .git/config to avoid leaking GITHUB_TOKEN stored there.
25+
# See https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/
26+
rm -Rf .git/config
2127
# Windows does not support symlinks, so we need to dereference them.
2228
tar --exclude build/ ${{ (runner.os == 'Windows' && '-h') || '' }} -c . | zstd -T0 -c > ../llvm-project.tar.zst
2329
mv ../llvm-project.tar.zst .

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ foreach(target riscv32-unknown-elf)
382382
foreach(lang C;CXX;ASM)
383383
# TODO: The preprocessor defines workaround various issues in libc and libc++ integration.
384384
# These should be addressed and removed over time.
385-
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dtimeval=struct timeval{int tv_sec; int tv_usec;}\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
385+
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dtimeval=struct timeval{int tv_sec; int tv_usec;}\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
386386
endforeach()
387387
foreach(type SHARED;MODULE;EXE)
388388
set(RUNTIMES_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ Bug Fixes to C++ Support
336336
- Mangle placeholders for deduced types as a template-prefix, such that mangling
337337
of template template parameters uses the correct production. (#GH106182)
338338
- Fixed an assertion failure when converting vectors to int/float with invalid expressions. (#GH105486)
339+
- Template parameter names are considered in the name lookup of out-of-line class template
340+
specialization right before its declaration context. (#GH64082)
339341

340342
Bug Fixes to AST Handling
341343
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/ASTContext.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,14 @@ class ASTContext : public RefCountedBase<ASTContext> {
13861386
/// in the return type and parameter types.
13871387
bool hasSameFunctionTypeIgnoringPtrSizes(QualType T, QualType U);
13881388

1389+
/// Get or construct a function type that is equivalent to the input type
1390+
/// except that the parameter ABI annotations are stripped.
1391+
QualType getFunctionTypeWithoutParamABIs(QualType T) const;
1392+
1393+
/// Determine if two function types are the same, ignoring parameter ABI
1394+
/// annotations.
1395+
bool hasSameFunctionTypeIgnoringParamABI(QualType T, QualType U) const;
1396+
13891397
/// Return the uniqued reference to the type for a complex
13901398
/// number with the specified element type.
13911399
QualType getComplexType(QualType T) const;

clang/include/clang/AST/Attr.h

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -228,20 +228,7 @@ class ParameterABIAttr : public InheritableParamAttr {
228228
InheritEvenIfAlreadyPresent) {}
229229

230230
public:
231-
ParameterABI getABI() const {
232-
switch (getKind()) {
233-
case attr::SwiftContext:
234-
return ParameterABI::SwiftContext;
235-
case attr::SwiftAsyncContext:
236-
return ParameterABI::SwiftAsyncContext;
237-
case attr::SwiftErrorResult:
238-
return ParameterABI::SwiftErrorResult;
239-
case attr::SwiftIndirectResult:
240-
return ParameterABI::SwiftIndirectResult;
241-
default:
242-
llvm_unreachable("bad parameter ABI attribute kind");
243-
}
244-
}
231+
ParameterABI getABI() const;
245232

246233
static bool classof(const Attr *A) {
247234
return A->getKind() >= attr::FirstParameterABIAttr &&
@@ -383,6 +370,29 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
383370
DB.AddTaggedVal(reinterpret_cast<uint64_t>(At), DiagnosticsEngine::ak_attr);
384371
return DB;
385372
}
373+
374+
inline ParameterABI ParameterABIAttr::getABI() const {
375+
switch (getKind()) {
376+
case attr::SwiftContext:
377+
return ParameterABI::SwiftContext;
378+
case attr::SwiftAsyncContext:
379+
return ParameterABI::SwiftAsyncContext;
380+
case attr::SwiftErrorResult:
381+
return ParameterABI::SwiftErrorResult;
382+
case attr::SwiftIndirectResult:
383+
return ParameterABI::SwiftIndirectResult;
384+
case attr::HLSLParamModifier: {
385+
const auto *A = cast<HLSLParamModifierAttr>(this);
386+
if (A->isOut())
387+
return ParameterABI::HLSLOut;
388+
if (A->isInOut())
389+
return ParameterABI::HLSLInOut;
390+
return ParameterABI::Ordinary;
391+
}
392+
default:
393+
llvm_unreachable("bad parameter ABI attribute kind");
394+
}
395+
}
386396
} // end namespace clang
387397

388398
#endif

clang/include/clang/AST/Expr.h

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7112,6 +7112,103 @@ class ArraySectionExpr : public Expr {
71127112
void setRBracketLoc(SourceLocation L) { RBracketLoc = L; }
71137113
};
71147114

7115+
/// This class represents temporary values used to represent inout and out
7116+
/// arguments in HLSL. From the callee perspective these parameters are more or
7117+
/// less __restrict__ T&. They are guaranteed to not alias any memory. inout
7118+
/// parameters are initialized by the caller, and out parameters are references
7119+
/// to uninitialized memory.
7120+
///
7121+
/// In the caller, the argument expression creates a temporary in local memory
7122+
/// and the address of the temporary is passed into the callee. There may be
7123+
/// implicit conversion sequences to initialize the temporary, and on expiration
7124+
/// of the temporary an inverse conversion sequence is applied as a write-back
7125+
/// conversion to the source l-value.
7126+
///
7127+
/// This AST node has three sub-expressions:
7128+
/// - An OpaqueValueExpr with a source that is the argument lvalue expression.
7129+
/// - An OpaqueValueExpr with a source that is an implicit conversion
7130+
/// sequence from the source lvalue to the argument type.
7131+
/// - An expression that assigns the second expression into the first,
7132+
/// performing any necessary conversions.
7133+
class HLSLOutArgExpr : public Expr {
7134+
friend class ASTStmtReader;
7135+
7136+
enum {
7137+
BaseLValue,
7138+
CastedTemporary,
7139+
WritebackCast,
7140+
NumSubExprs,
7141+
};
7142+
7143+
Stmt *SubExprs[NumSubExprs];
7144+
bool IsInOut;
7145+
7146+
HLSLOutArgExpr(QualType Ty, OpaqueValueExpr *B, OpaqueValueExpr *OpV,
7147+
Expr *WB, bool IsInOut)
7148+
: Expr(HLSLOutArgExprClass, Ty, VK_LValue, OK_Ordinary),
7149+
IsInOut(IsInOut) {
7150+
SubExprs[BaseLValue] = B;
7151+
SubExprs[CastedTemporary] = OpV;
7152+
SubExprs[WritebackCast] = WB;
7153+
assert(!Ty->isDependentType() && "HLSLOutArgExpr given a dependent type!");
7154+
}
7155+
7156+
explicit HLSLOutArgExpr(EmptyShell Shell)
7157+
: Expr(HLSLOutArgExprClass, Shell) {}
7158+
7159+
public:
7160+
static HLSLOutArgExpr *Create(const ASTContext &C, QualType Ty,
7161+
OpaqueValueExpr *Base, OpaqueValueExpr *OpV,
7162+
Expr *WB, bool IsInOut);
7163+
static HLSLOutArgExpr *CreateEmpty(const ASTContext &Ctx);
7164+
7165+
const OpaqueValueExpr *getOpaqueArgLValue() const {
7166+
return cast<OpaqueValueExpr>(SubExprs[BaseLValue]);
7167+
}
7168+
OpaqueValueExpr *getOpaqueArgLValue() {
7169+
return cast<OpaqueValueExpr>(SubExprs[BaseLValue]);
7170+
}
7171+
7172+
/// Return the l-value expression that was written as the argument
7173+
/// in source. Everything else here is implicitly generated.
7174+
const Expr *getArgLValue() const {
7175+
return getOpaqueArgLValue()->getSourceExpr();
7176+
}
7177+
Expr *getArgLValue() { return getOpaqueArgLValue()->getSourceExpr(); }
7178+
7179+
const Expr *getWritebackCast() const {
7180+
return cast<Expr>(SubExprs[WritebackCast]);
7181+
}
7182+
Expr *getWritebackCast() { return cast<Expr>(SubExprs[WritebackCast]); }
7183+
7184+
const OpaqueValueExpr *getCastedTemporary() const {
7185+
return cast<OpaqueValueExpr>(SubExprs[CastedTemporary]);
7186+
}
7187+
OpaqueValueExpr *getCastedTemporary() {
7188+
return cast<OpaqueValueExpr>(SubExprs[CastedTemporary]);
7189+
}
7190+
7191+
/// returns true if the parameter is inout and false if the parameter is out.
7192+
bool isInOut() const { return IsInOut; }
7193+
7194+
SourceLocation getBeginLoc() const LLVM_READONLY {
7195+
return SubExprs[BaseLValue]->getBeginLoc();
7196+
}
7197+
7198+
SourceLocation getEndLoc() const LLVM_READONLY {
7199+
return SubExprs[BaseLValue]->getEndLoc();
7200+
}
7201+
7202+
static bool classof(const Stmt *T) {
7203+
return T->getStmtClass() == HLSLOutArgExprClass;
7204+
}
7205+
7206+
// Iterators
7207+
child_range children() {
7208+
return child_range(&SubExprs[BaseLValue], &SubExprs[NumSubExprs]);
7209+
}
7210+
};
7211+
71157212
/// Frontend produces RecoveryExprs on semantic errors that prevent creating
71167213
/// other well-formed expressions. E.g. when type-checking of a binary operator
71177214
/// fails, we cannot produce a BinaryOperator expression. Instead, we can choose

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4070,6 +4070,9 @@ DEF_TRAVERSE_STMT(OpenACCComputeConstruct,
40704070
DEF_TRAVERSE_STMT(OpenACCLoopConstruct,
40714071
{ TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
40724072

4073+
// Traverse HLSL: Out argument expression
4074+
DEF_TRAVERSE_STMT(HLSLOutArgExpr, {})
4075+
40734076
// FIXME: look at the following tricky-seeming exprs to see if we
40744077
// need to recurse on anything. These are ones that have methods
40754078
// returning decls or qualtypes or nestednamespecifier -- though I'm

clang/include/clang/AST/TextNodeDumper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ class TextNodeDumper
408408
void
409409
VisitLifetimeExtendedTemporaryDecl(const LifetimeExtendedTemporaryDecl *D);
410410
void VisitHLSLBufferDecl(const HLSLBufferDecl *D);
411+
void VisitHLSLOutArgExpr(const HLSLOutArgExpr *E);
411412
void VisitOpenACCConstructStmt(const OpenACCConstructStmt *S);
412413
void VisitOpenACCLoopConstruct(const OpenACCLoopConstruct *S);
413414
void VisitEmbedExpr(const EmbedExpr *S);

clang/include/clang/Basic/Attr.td

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5664,18 +5664,33 @@ def HLSLGroupSharedAddressSpace : TypeAttr {
56645664
let Documentation = [HLSLGroupSharedAddressSpaceDocs];
56655665
}
56665666

5667-
def HLSLParamModifier : TypeAttr {
5667+
def HLSLParamModifier : ParameterABIAttr {
56685668
let Spellings = [CustomKeyword<"in">, CustomKeyword<"inout">, CustomKeyword<"out">];
56695669
let Accessors = [Accessor<"isIn", [CustomKeyword<"in">]>,
56705670
Accessor<"isInOut", [CustomKeyword<"inout">]>,
56715671
Accessor<"isOut", [CustomKeyword<"out">]>,
56725672
Accessor<"isAnyOut", [CustomKeyword<"out">, CustomKeyword<"inout">]>,
56735673
Accessor<"isAnyIn", [CustomKeyword<"in">, CustomKeyword<"inout">]>];
5674-
let Subjects = SubjectList<[ParmVar]>;
56755674
let Documentation = [HLSLParamQualifierDocs];
56765675
let Args = [DefaultBoolArgument<"MergedSpelling", /*default*/0, /*fake*/1>];
56775676
}
56785677

5678+
def HLSLWaveSize: InheritableAttr {
5679+
let Spellings = [Microsoft<"WaveSize">];
5680+
let Args = [IntArgument<"Min">, DefaultIntArgument<"Max", 0>, DefaultIntArgument<"Preferred", 0>];
5681+
let Subjects = SubjectList<[HLSLEntry]>;
5682+
let LangOpts = [HLSL];
5683+
let AdditionalMembers = [{
5684+
private:
5685+
int SpelledArgsCount = 0;
5686+
5687+
public:
5688+
void setSpelledArgsCount(int C) { SpelledArgsCount = C; }
5689+
int getSpelledArgsCount() const { return SpelledArgsCount; }
5690+
}];
5691+
let Documentation = [WaveSizeDocs];
5692+
}
5693+
56795694
def RandomizeLayout : InheritableAttr {
56805695
let Spellings = [GCC<"randomize_layout">];
56815696
let Subjects = SubjectList<[Record]>;

clang/include/clang/Basic/AttrDocs.td

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9132,6 +9132,43 @@ flag.
91329132
}];
91339133
}
91349134

9135+
def WaveSizeDocs : Documentation {
9136+
let Category = DocCatFunction;
9137+
let Content = [{
9138+
The ``WaveSize`` attribute specify a wave size on a shader entry point in order
9139+
to indicate either that a shader depends on or strongly prefers a specific wave
9140+
size.
9141+
There're 2 versions of the attribute: ``WaveSize`` and ``RangedWaveSize``.
9142+
The syntax for ``WaveSize`` is:
9143+
9144+
.. code-block:: text
9145+
9146+
``[WaveSize(<numLanes>)]``
9147+
9148+
The allowed wave sizes that an HLSL shader may specify are the powers of 2
9149+
between 4 and 128, inclusive.
9150+
In other words, the set: [4, 8, 16, 32, 64, 128].
9151+
9152+
The syntax for ``RangedWaveSize`` is:
9153+
9154+
.. code-block:: text
9155+
9156+
``[WaveSize(<minWaveSize>, <maxWaveSize>, [prefWaveSize])]``
9157+
9158+
Where minWaveSize is the minimum wave size supported by the shader representing
9159+
the beginning of the allowed range, maxWaveSize is the maximum wave size
9160+
supported by the shader representing the end of the allowed range, and
9161+
prefWaveSize is the optional preferred wave size representing the size expected
9162+
to be the most optimal for this shader.
9163+
9164+
``WaveSize`` is available for HLSL shader model 6.6 and later.
9165+
``RangedWaveSize`` available for HLSL shader model 6.8 and later.
9166+
9167+
The full documentation is available here: https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_WaveSize.html
9168+
and https://microsoft.github.io/hlsl-specs/proposals/0013-wave-size-range.html
9169+
}];
9170+
}
9171+
91359172
def NumThreadsDocs : Documentation {
91369173
let Category = DocCatFunction;
91379174
let Content = [{

0 commit comments

Comments
 (0)