Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit f0daa1f

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:89a080cb79972abae240c226090af9a3094e2269 into amd-gfx:93971a479db3
Local branch amd-gfx 93971a4 Merged main:9f858c7b79f9edff082050b930fee347887f8e6d into amd-gfx:d168cedb5f80 Remote branch main 89a080c [llvm][NFC] Document cl::opt MisExpectTolerance and fix typo
2 parents 93971a4 + 89a080c commit f0daa1f

Some content is hidden

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

52 files changed

+3514
-1137
lines changed

clang/include/clang/AST/OpenACCClause.h

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#include "clang/AST/StmtIterator.h"
1818
#include "clang/Basic/OpenACCKinds.h"
1919

20-
#include <utility>
21-
2220
namespace clang {
2321
/// This is the base type for all OpenACC Clauses.
2422
class OpenACCClause {
@@ -77,63 +75,6 @@ class OpenACCClauseWithParams : public OpenACCClause {
7775
}
7876
};
7977

80-
using DeviceTypeArgument = std::pair<IdentifierInfo *, SourceLocation>;
81-
/// A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or
82-
/// an identifier. The 'asterisk' means 'the rest'.
83-
class OpenACCDeviceTypeClause final
84-
: public OpenACCClauseWithParams,
85-
public llvm::TrailingObjects<OpenACCDeviceTypeClause,
86-
DeviceTypeArgument> {
87-
// Data stored in trailing objects as IdentifierInfo* /SourceLocation pairs. A
88-
// nullptr IdentifierInfo* represents an asterisk.
89-
unsigned NumArchs;
90-
OpenACCDeviceTypeClause(OpenACCClauseKind K, SourceLocation BeginLoc,
91-
SourceLocation LParenLoc,
92-
ArrayRef<DeviceTypeArgument> Archs,
93-
SourceLocation EndLoc)
94-
: OpenACCClauseWithParams(K, BeginLoc, LParenLoc, EndLoc),
95-
NumArchs(Archs.size()) {
96-
assert(
97-
(K == OpenACCClauseKind::DeviceType || K == OpenACCClauseKind::DType) &&
98-
"Invalid clause kind for device-type");
99-
100-
assert(!llvm::any_of(Archs, [](const DeviceTypeArgument &Arg) {
101-
return Arg.second.isInvalid();
102-
}) && "Invalid SourceLocation for an argument");
103-
104-
assert(Archs.size() == 1 ||
105-
!llvm::any_of(Archs,
106-
[](const DeviceTypeArgument &Arg) {
107-
return Arg.first == nullptr;
108-
}) &&
109-
"Only a single asterisk version is permitted, and must be the "
110-
"only one");
111-
112-
std::uninitialized_copy(Archs.begin(), Archs.end(),
113-
getTrailingObjects<DeviceTypeArgument>());
114-
}
115-
116-
public:
117-
static bool classof(const OpenACCClause *C) {
118-
return C->getClauseKind() == OpenACCClauseKind::DType ||
119-
C->getClauseKind() == OpenACCClauseKind::DeviceType;
120-
}
121-
bool hasAsterisk() const {
122-
return getArchitectures().size() > 0 &&
123-
getArchitectures()[0].first == nullptr;
124-
}
125-
126-
ArrayRef<DeviceTypeArgument> getArchitectures() const {
127-
return ArrayRef<DeviceTypeArgument>(
128-
getTrailingObjects<DeviceTypeArgument>(), NumArchs);
129-
}
130-
131-
static OpenACCDeviceTypeClause *
132-
Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc,
133-
SourceLocation LParenLoc, ArrayRef<DeviceTypeArgument> Archs,
134-
SourceLocation EndLoc);
135-
};
136-
13778
/// A 'default' clause, has the optional 'none' or 'present' argument.
13879
class OpenACCDefaultClause : public OpenACCClauseWithParams {
13980
friend class ASTReaderStmt;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12344,8 +12344,4 @@ def warn_acc_deprecated_alias_name
1234412344
def err_acc_var_not_pointer_type
1234512345
: Error<"expected pointer in '%0' clause, type is %1">;
1234612346
def note_acc_expected_pointer_var : Note<"expected variable of pointer type">;
12347-
def err_acc_clause_after_device_type
12348-
: Error<"OpenACC clause '%0' may not follow a '%1' clause in a "
12349-
"compute construct">;
12350-
1235112347
} // end of sema component.

clang/include/clang/Basic/OpenACCClauses.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ CLAUSE_ALIAS(PCreate, Create)
3737
CLAUSE_ALIAS(PresentOrCreate, Create)
3838
VISIT_CLAUSE(Default)
3939
VISIT_CLAUSE(DevicePtr)
40-
VISIT_CLAUSE(DeviceType)
41-
CLAUSE_ALIAS(DType, DeviceType)
4240
VISIT_CLAUSE(FirstPrivate)
4341
VISIT_CLAUSE(If)
4442
VISIT_CLAUSE(NoCreate)

clang/include/clang/Parse/Parser.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3720,8 +3720,7 @@ class Parser : public CodeCompletionHandler {
37203720
SourceLocation Loc,
37213721
llvm::SmallVectorImpl<Expr *> &IntExprs);
37223722
/// Parses the 'device-type-list', which is a list of identifiers.
3723-
bool ParseOpenACCDeviceTypeList(
3724-
llvm::SmallVector<std::pair<IdentifierInfo *, SourceLocation>> &Archs);
3723+
bool ParseOpenACCDeviceTypeList();
37253724
/// Parses the 'async-argument', which is an integral value with two
37263725
/// 'special' values that are likely negative (but come from Macros).
37273726
OpenACCIntExprParseResult ParseOpenACCAsyncArgument(OpenACCDirectiveKind DK,

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ class OpenACCClause;
2626

2727
class SemaOpenACC : public SemaBase {
2828
public:
29-
// Redeclaration of the version in OpenACCClause.h.
30-
using DeviceTypeArgument = std::pair<IdentifierInfo *, SourceLocation>;
31-
3229
/// A type to represent all the data for an OpenACC Clause that has been
3330
/// parsed, but not yet created/semantically analyzed. This is effectively a
3431
/// discriminated union on the 'Clause Kind', with all of the individual
@@ -63,12 +60,8 @@ class SemaOpenACC : public SemaBase {
6360
SmallVector<Expr *> QueueIdExprs;
6461
};
6562

66-
struct DeviceTypeDetails {
67-
SmallVector<DeviceTypeArgument> Archs;
68-
};
69-
7063
std::variant<std::monostate, DefaultDetails, ConditionDetails,
71-
IntExprDetails, VarListDetails, WaitDetails, DeviceTypeDetails>
64+
IntExprDetails, VarListDetails, WaitDetails>
7265
Details = std::monostate{};
7366

7467
public:
@@ -216,13 +209,6 @@ class SemaOpenACC : public SemaBase {
216209
return std::get<VarListDetails>(Details).IsZero;
217210
}
218211

219-
ArrayRef<DeviceTypeArgument> getDeviceTypeArchitectures() const {
220-
assert((ClauseKind == OpenACCClauseKind::DeviceType ||
221-
ClauseKind == OpenACCClauseKind::DType) &&
222-
"Only 'device_type'/'dtype' has a device-type-arg list");
223-
return std::get<DeviceTypeDetails>(Details).Archs;
224-
}
225-
226212
void setLParenLoc(SourceLocation EndLoc) { LParenLoc = EndLoc; }
227213
void setEndLoc(SourceLocation EndLoc) { ClauseRange.setEnd(EndLoc); }
228214

@@ -340,13 +326,6 @@ class SemaOpenACC : public SemaBase {
340326
"Parsed clause kind does not have a wait-details");
341327
Details = WaitDetails{DevNum, QueuesLoc, std::move(IntExprs)};
342328
}
343-
344-
void setDeviceTypeDetails(llvm::SmallVector<DeviceTypeArgument> &&Archs) {
345-
assert((ClauseKind == OpenACCClauseKind::DeviceType ||
346-
ClauseKind == OpenACCClauseKind::DType) &&
347-
"Only 'device_type'/'dtype' has a device-type-arg list");
348-
Details = DeviceTypeDetails{std::move(Archs)};
349-
}
350329
};
351330

352331
SemaOpenACC(Sema &S);

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2159,7 +2159,9 @@ bool ByteCodeExprGen<Emitter>::VisitCXXConstructExpr(
21592159
if (T->isArrayType()) {
21602160
const ConstantArrayType *CAT =
21612161
Ctx.getASTContext().getAsConstantArrayType(E->getType());
2162-
assert(CAT);
2162+
if (!CAT)
2163+
return false;
2164+
21632165
size_t NumElems = CAT->getZExtSize();
21642166
const Function *Func = getFunction(E->getConstructor());
21652167
if (!Func || !Func->isConstexpr())

clang/lib/AST/Interp/Program.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ Descriptor *Program::createDescriptor(const DeclTy &D, const Type *Ty,
386386

387387
// Array of unknown bounds - cannot be accessed and pointer arithmetic
388388
// is forbidden on pointers to such objects.
389-
if (isa<IncompleteArrayType>(ArrayType)) {
389+
if (isa<IncompleteArrayType>(ArrayType) ||
390+
isa<VariableArrayType>(ArrayType)) {
390391
if (std::optional<PrimType> T = Ctx.classify(ElemTy)) {
391392
return allocateDescriptor(D, *T, MDSize, IsTemporary,
392393
Descriptor::UnknownSize{});

clang/lib/AST/OpenACCClause.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
using namespace clang;
1919

2020
bool OpenACCClauseWithParams::classof(const OpenACCClause *C) {
21-
return OpenACCDeviceTypeClause::classof(C) ||
22-
OpenACCClauseWithCondition::classof(C) ||
21+
return OpenACCClauseWithCondition::classof(C) ||
2322
OpenACCClauseWithExprs::classof(C);
2423
}
2524
bool OpenACCClauseWithExprs::classof(const OpenACCClause *C) {
@@ -299,17 +298,6 @@ OpenACCCreateClause::Create(const ASTContext &C, OpenACCClauseKind Spelling,
299298
VarList, EndLoc);
300299
}
301300

302-
OpenACCDeviceTypeClause *OpenACCDeviceTypeClause::Create(
303-
const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc,
304-
SourceLocation LParenLoc, ArrayRef<DeviceTypeArgument> Archs,
305-
SourceLocation EndLoc) {
306-
void *Mem =
307-
C.Allocate(OpenACCDeviceTypeClause::totalSizeToAlloc<DeviceTypeArgument>(
308-
Archs.size()));
309-
return new (Mem)
310-
OpenACCDeviceTypeClause(K, BeginLoc, LParenLoc, Archs, EndLoc);
311-
}
312-
313301
//===----------------------------------------------------------------------===//
314302
// OpenACC clauses printing methods
315303
//===----------------------------------------------------------------------===//
@@ -463,17 +451,3 @@ void OpenACCClausePrinter::VisitWaitClause(const OpenACCWaitClause &C) {
463451
OS << ")";
464452
}
465453
}
466-
467-
void OpenACCClausePrinter::VisitDeviceTypeClause(
468-
const OpenACCDeviceTypeClause &C) {
469-
OS << C.getClauseKind();
470-
OS << "(";
471-
llvm::interleaveComma(C.getArchitectures(), OS,
472-
[&](const DeviceTypeArgument &Arch) {
473-
if (Arch.first == nullptr)
474-
OS << "*";
475-
else
476-
OS << Arch.first;
477-
});
478-
OS << ")";
479-
}

clang/lib/AST/StmtProfile.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,9 +2585,6 @@ void OpenACCClauseProfiler::VisitWaitClause(const OpenACCWaitClause &Clause) {
25852585
for (auto *E : Clause.getQueueIdExprs())
25862586
Profiler.VisitStmt(E);
25872587
}
2588-
/// Nothing to do here, there are no sub-statements.
2589-
void OpenACCClauseProfiler::VisitDeviceTypeClause(
2590-
const OpenACCDeviceTypeClause &Clause) {}
25912588
} // namespace
25922589

25932590
void StmtProfiler::VisitOpenACCComputeConstruct(

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -444,19 +444,6 @@ void TextNodeDumper::Visit(const OpenACCClause *C) {
444444
if (cast<OpenACCWaitClause>(C)->hasQueuesTag())
445445
OS << " has queues tag";
446446
break;
447-
case OpenACCClauseKind::DeviceType:
448-
case OpenACCClauseKind::DType:
449-
OS << "(";
450-
llvm::interleaveComma(
451-
cast<OpenACCDeviceTypeClause>(C)->getArchitectures(), OS,
452-
[&](const DeviceTypeArgument &Arch) {
453-
if (Arch.first == nullptr)
454-
OS << "*";
455-
else
456-
OS << Arch.first->getName();
457-
});
458-
OS << ")";
459-
break;
460447
default:
461448
// Nothing to do here.
462449
break;

0 commit comments

Comments
 (0)