Skip to content

Commit 9955df6

Browse files
authored
Merge branch 'main' into p/libc-hdrgen-yaml-template
2 parents eca30ba + dc0e258 commit 9955df6

File tree

59 files changed

+1898
-270
lines changed

Some content is hidden

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

59 files changed

+1898
-270
lines changed

clang/include/clang-c/Index.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2198,7 +2198,11 @@ enum CXCursorKind {
21982198
*/
21992199
CXCursor_OpenACCShutdownConstruct = 329,
22002200

2201-
CXCursor_LastStmt = CXCursor_OpenACCShutdownConstruct,
2201+
/** OpenACC set Construct.
2202+
*/
2203+
CXCursor_OpenACCSetConstruct = 330,
2204+
2205+
CXCursor_LastStmt = CXCursor_OpenACCSetConstruct,
22022206

22032207
/**
22042208
* Cursor that represents the translation unit itself.

clang/include/clang/AST/OpenACCClause.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,19 @@ class OpenACCDeviceNumClause : public OpenACCClauseWithSingleIntExpr {
633633
SourceLocation EndLoc);
634634
};
635635

636+
class OpenACCDefaultAsyncClause : public OpenACCClauseWithSingleIntExpr {
637+
OpenACCDefaultAsyncClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
638+
Expr *IntExpr, SourceLocation EndLoc);
639+
640+
public:
641+
static bool classof(const OpenACCClause *C) {
642+
return C->getClauseKind() == OpenACCClauseKind::DefaultAsync;
643+
}
644+
static OpenACCDefaultAsyncClause *
645+
Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
646+
Expr *IntExpr, SourceLocation EndLoc);
647+
};
648+
636649
/// Represents a 'collapse' clause on a 'loop' construct. This clause takes an
637650
/// integer constant expression 'N' that represents how deep to collapse the
638651
/// construct. It also takes an optional 'force' tag that permits intervening

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4080,6 +4080,8 @@ DEF_TRAVERSE_STMT(OpenACCInitConstruct,
40804080
{ TRY_TO(VisitOpenACCClauseList(S->clauses())); })
40814081
DEF_TRAVERSE_STMT(OpenACCShutdownConstruct,
40824082
{ TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4083+
DEF_TRAVERSE_STMT(OpenACCSetConstruct,
4084+
{ TRY_TO(VisitOpenACCClauseList(S->clauses())); })
40834085

40844086
// Traverse HLSL: Out argument expression
40854087
DEF_TRAVERSE_STMT(HLSLOutArgExpr, {})

clang/include/clang/AST/StmtOpenACC.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,5 +672,45 @@ class OpenACCShutdownConstruct final
672672
SourceLocation End, ArrayRef<const OpenACCClause *> Clauses);
673673
};
674674

675+
// This class represents a 'set' construct, which has just a clause list.
676+
class OpenACCSetConstruct final
677+
: public OpenACCConstructStmt,
678+
private llvm::TrailingObjects<OpenACCSetConstruct,
679+
const OpenACCClause *> {
680+
friend TrailingObjects;
681+
OpenACCSetConstruct(unsigned NumClauses)
682+
: OpenACCConstructStmt(OpenACCSetConstructClass,
683+
OpenACCDirectiveKind::Set, SourceLocation{},
684+
SourceLocation{}, SourceLocation{}) {
685+
std::uninitialized_value_construct(
686+
getTrailingObjects<const OpenACCClause *>(),
687+
getTrailingObjects<const OpenACCClause *>() + NumClauses);
688+
setClauseList(MutableArrayRef(getTrailingObjects<const OpenACCClause *>(),
689+
NumClauses));
690+
}
691+
692+
OpenACCSetConstruct(SourceLocation Start, SourceLocation DirectiveLoc,
693+
SourceLocation End,
694+
ArrayRef<const OpenACCClause *> Clauses)
695+
: OpenACCConstructStmt(OpenACCSetConstructClass,
696+
OpenACCDirectiveKind::Set, Start, DirectiveLoc,
697+
End) {
698+
std::uninitialized_copy(Clauses.begin(), Clauses.end(),
699+
getTrailingObjects<const OpenACCClause *>());
700+
setClauseList(MutableArrayRef(getTrailingObjects<const OpenACCClause *>(),
701+
Clauses.size()));
702+
}
703+
704+
public:
705+
static bool classof(const Stmt *T) {
706+
return T->getStmtClass() == OpenACCSetConstructClass;
707+
}
708+
static OpenACCSetConstruct *CreateEmpty(const ASTContext &C,
709+
unsigned NumClauses);
710+
static OpenACCSetConstruct *Create(const ASTContext &C, SourceLocation Start,
711+
SourceLocation DirectiveLoc,
712+
SourceLocation End,
713+
ArrayRef<const OpenACCClause *> Clauses);
714+
};
675715
} // namespace clang
676716
#endif // LLVM_CLANG_AST_STMTOPENACC_H

clang/include/clang/AST/TextNodeDumper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ class TextNodeDumper
417417
void VisitOpenACCHostDataConstruct(const OpenACCHostDataConstruct *S);
418418
void VisitOpenACCWaitConstruct(const OpenACCWaitConstruct *S);
419419
void VisitOpenACCInitConstruct(const OpenACCInitConstruct *S);
420+
void VisitOpenACCSetConstruct(const OpenACCSetConstruct *S);
420421
void VisitOpenACCShutdownConstruct(const OpenACCShutdownConstruct *S);
421422
void VisitOpenACCAsteriskSizeExpr(const OpenACCAsteriskSizeExpr *S);
422423
void VisitEmbedExpr(const EmbedExpr *S);

clang/include/clang/Basic/OpenACCClauses.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ VISIT_CLAUSE(Create)
3838
CLAUSE_ALIAS(PCreate, Create, true)
3939
CLAUSE_ALIAS(PresentOrCreate, Create, true)
4040
VISIT_CLAUSE(Default)
41+
VISIT_CLAUSE(DefaultAsync)
4142
VISIT_CLAUSE(Delete)
4243
VISIT_CLAUSE(Detach)
4344
VISIT_CLAUSE(DeviceNum)

clang/include/clang/Basic/StmtNodes.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ def OpenACCHostDataConstruct : StmtNode<OpenACCAssociatedStmtConstruct>;
315315
def OpenACCWaitConstruct : StmtNode<OpenACCConstructStmt>;
316316
def OpenACCInitConstruct : StmtNode<OpenACCConstructStmt>;
317317
def OpenACCShutdownConstruct : StmtNode<OpenACCConstructStmt>;
318+
def OpenACCSetConstruct : StmtNode<OpenACCConstructStmt>;
318319

319320
// OpenACC Additional Expressions.
320321
def OpenACCAsteriskSizeExpr : StmtNode<Expr>;

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ class SemaOpenACC : public SemaBase {
297297
ClauseKind == OpenACCClauseKind::NumWorkers ||
298298
ClauseKind == OpenACCClauseKind::Async ||
299299
ClauseKind == OpenACCClauseKind::DeviceNum ||
300+
ClauseKind == OpenACCClauseKind::DefaultAsync ||
300301
ClauseKind == OpenACCClauseKind::Tile ||
301302
ClauseKind == OpenACCClauseKind::Worker ||
302303
ClauseKind == OpenACCClauseKind::Vector ||
@@ -349,6 +350,7 @@ class SemaOpenACC : public SemaBase {
349350
ClauseKind == OpenACCClauseKind::NumWorkers ||
350351
ClauseKind == OpenACCClauseKind::Async ||
351352
ClauseKind == OpenACCClauseKind::DeviceNum ||
353+
ClauseKind == OpenACCClauseKind::DefaultAsync ||
352354
ClauseKind == OpenACCClauseKind::Tile ||
353355
ClauseKind == OpenACCClauseKind::Gang ||
354356
ClauseKind == OpenACCClauseKind::Worker ||
@@ -486,6 +488,7 @@ class SemaOpenACC : public SemaBase {
486488
ClauseKind == OpenACCClauseKind::NumWorkers ||
487489
ClauseKind == OpenACCClauseKind::Async ||
488490
ClauseKind == OpenACCClauseKind::DeviceNum ||
491+
ClauseKind == OpenACCClauseKind::DefaultAsync ||
489492
ClauseKind == OpenACCClauseKind::Tile ||
490493
ClauseKind == OpenACCClauseKind::Worker ||
491494
ClauseKind == OpenACCClauseKind::Vector ||
@@ -498,6 +501,7 @@ class SemaOpenACC : public SemaBase {
498501
ClauseKind == OpenACCClauseKind::NumWorkers ||
499502
ClauseKind == OpenACCClauseKind::Async ||
500503
ClauseKind == OpenACCClauseKind::DeviceNum ||
504+
ClauseKind == OpenACCClauseKind::DefaultAsync ||
501505
ClauseKind == OpenACCClauseKind::Tile ||
502506
ClauseKind == OpenACCClauseKind::Worker ||
503507
ClauseKind == OpenACCClauseKind::Vector ||

clang/include/clang/Serialization/ASTBitCodes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,6 +2024,7 @@ enum StmtCode {
20242024
STMT_OPENACC_WAIT_CONSTRUCT,
20252025
STMT_OPENACC_INIT_CONSTRUCT,
20262026
STMT_OPENACC_SHUTDOWN_CONSTRUCT,
2027+
STMT_OPENACC_SET_CONSTRUCT,
20272028

20282029
// HLSL Constructs
20292030
EXPR_HLSL_OUT_ARG,

clang/lib/AST/OpenACCClause.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ bool OpenACCClauseWithSingleIntExpr::classof(const OpenACCClause *C) {
4747
return OpenACCNumWorkersClause::classof(C) ||
4848
OpenACCVectorLengthClause::classof(C) ||
4949
OpenACCDeviceNumClause::classof(C) ||
50+
OpenACCDefaultAsyncClause::classof(C) ||
5051
OpenACCVectorClause::classof(C) || OpenACCWorkerClause::classof(C) ||
5152
OpenACCCollapseClause::classof(C) || OpenACCAsyncClause::classof(C);
5253
}
@@ -239,6 +240,27 @@ OpenACCDeviceNumClause *OpenACCDeviceNumClause::Create(const ASTContext &C,
239240
return new (Mem) OpenACCDeviceNumClause(BeginLoc, LParenLoc, IntExpr, EndLoc);
240241
}
241242

243+
OpenACCDefaultAsyncClause::OpenACCDefaultAsyncClause(SourceLocation BeginLoc,
244+
SourceLocation LParenLoc,
245+
Expr *IntExpr,
246+
SourceLocation EndLoc)
247+
: OpenACCClauseWithSingleIntExpr(OpenACCClauseKind::DefaultAsync, BeginLoc,
248+
LParenLoc, IntExpr, EndLoc) {
249+
assert((IntExpr->isInstantiationDependent() ||
250+
IntExpr->getType()->isIntegerType()) &&
251+
"default_async expression type not scalar/dependent");
252+
}
253+
254+
OpenACCDefaultAsyncClause *
255+
OpenACCDefaultAsyncClause::Create(const ASTContext &C, SourceLocation BeginLoc,
256+
SourceLocation LParenLoc, Expr *IntExpr,
257+
SourceLocation EndLoc) {
258+
void *Mem = C.Allocate(sizeof(OpenACCDefaultAsyncClause),
259+
alignof(OpenACCDefaultAsyncClause));
260+
return new (Mem)
261+
OpenACCDefaultAsyncClause(BeginLoc, LParenLoc, IntExpr, EndLoc);
262+
}
263+
242264
OpenACCWaitClause *OpenACCWaitClause::Create(
243265
const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
244266
Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef<Expr *> QueueIdExprs,
@@ -575,6 +597,13 @@ void OpenACCClausePrinter::VisitDeviceNumClause(
575597
OS << ")";
576598
}
577599

600+
void OpenACCClausePrinter::VisitDefaultAsyncClause(
601+
const OpenACCDefaultAsyncClause &C) {
602+
OS << "default_async(";
603+
printExpr(C.getIntExpr());
604+
OS << ")";
605+
}
606+
578607
void OpenACCClausePrinter::VisitAsyncClause(const OpenACCAsyncClause &C) {
579608
OS << "async";
580609
if (C.hasIntExpr()) {

0 commit comments

Comments
 (0)