aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
authorerichkeane <ekeane@nvidia.com>2024-05-13 08:40:43 -0700
committererichkeane <ekeane@nvidia.com>2024-05-13 08:40:43 -0700
commit06f04b2e27f2586d3db2204ed4e54f8b78fea74e (patch)
tree77ba511ca951b2dc6f668fbc3fa885a595948728 /clang
parente8eb52d167eb2bf972b3cfa67ff1028b86cd209d (diff)
downloadllvm-06f04b2e27f2586d3db2204ed4e54f8b78fea74e.zip
llvm-06f04b2e27f2586d3db2204ed4e54f8b78fea74e.tar.gz
llvm-06f04b2e27f2586d3db2204ed4e54f8b78fea74e.tar.bz2
Revert "[OpenACC] device_type clause Sema for Compute constructs"
This reverts commit c4a9a374749deb5f2a932a7d4ef9321be1b2ae5d. This and the followup patch keep hitting an assert I wrote on the build bots in a way that isn't clear. Reverting so I can fix it without a rush.
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/OpenACCClause.h59
-rw-r--r--clang/include/clang/Basic/DiagnosticSemaKinds.td4
-rw-r--r--clang/include/clang/Basic/OpenACCClauses.def2
-rw-r--r--clang/include/clang/Parse/Parser.h3
-rw-r--r--clang/include/clang/Sema/SemaOpenACC.h23
-rw-r--r--clang/lib/AST/OpenACCClause.cpp28
-rw-r--r--clang/lib/AST/StmtProfile.cpp3
-rw-r--r--clang/lib/AST/TextNodeDumper.cpp13
-rw-r--r--clang/lib/Parse/ParseOpenACC.cpp21
-rw-r--r--clang/lib/Sema/SemaOpenACC.cpp55
-rw-r--r--clang/lib/Sema/TreeTransform.h10
-rw-r--r--clang/lib/Serialization/ASTReader.cpp17
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp15
-rw-r--r--clang/test/AST/ast-print-openacc-compute-construct.cpp23
-rw-r--r--clang/test/ParserOpenACC/parse-clauses.c28
-rw-r--r--clang/test/SemaOpenACC/compute-construct-device_type-ast.cpp105
-rw-r--r--clang/test/SemaOpenACC/compute-construct-device_type-clause.c221
-rw-r--r--clang/test/SemaOpenACC/compute-construct-device_type-clause.cpp25
-rw-r--r--clang/tools/libclang/CIndex.cpp2
19 files changed, 35 insertions, 622 deletions
diff --git a/clang/include/clang/AST/OpenACCClause.h b/clang/include/clang/AST/OpenACCClause.h
index 607a2b9..3d0b1ab 100644
--- a/clang/include/clang/AST/OpenACCClause.h
+++ b/clang/include/clang/AST/OpenACCClause.h
@@ -17,8 +17,6 @@
#include "clang/AST/StmtIterator.h"
#include "clang/Basic/OpenACCKinds.h"
-#include <utility>
-
namespace clang {
/// This is the base type for all OpenACC Clauses.
class OpenACCClause {
@@ -77,63 +75,6 @@ public:
}
};
-using DeviceTypeArgument = std::pair<IdentifierInfo *, SourceLocation>;
-/// A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or
-/// an identifier. The 'asterisk' means 'the rest'.
-class OpenACCDeviceTypeClause final
- : public OpenACCClauseWithParams,
- public llvm::TrailingObjects<OpenACCDeviceTypeClause,
- DeviceTypeArgument> {
- // Data stored in trailing objects as IdentifierInfo* /SourceLocation pairs. A
- // nullptr IdentifierInfo* represents an asterisk.
- unsigned NumArchs;
- OpenACCDeviceTypeClause(OpenACCClauseKind K, SourceLocation BeginLoc,
- SourceLocation LParenLoc,
- ArrayRef<DeviceTypeArgument> Archs,
- SourceLocation EndLoc)
- : OpenACCClauseWithParams(K, BeginLoc, LParenLoc, EndLoc),
- NumArchs(Archs.size()) {
- assert(
- (K == OpenACCClauseKind::DeviceType || K == OpenACCClauseKind::DType) &&
- "Invalid clause kind for device-type");
-
- assert(!llvm::any_of(Archs, [](const DeviceTypeArgument &Arg) {
- return Arg.second.isInvalid();
- }) && "Invalid SourceLocation for an argument");
-
- assert(
- (Archs.size() == 1 || !llvm::any_of(Archs,
- [](const DeviceTypeArgument &Arg) {
- return Arg.first == nullptr;
- })) &&
- "Only a single asterisk version is permitted, and must be the "
- "only one");
-
- std::uninitialized_copy(Archs.begin(), Archs.end(),
- getTrailingObjects<DeviceTypeArgument>());
- }
-
-public:
- static bool classof(const OpenACCClause *C) {
- return C->getClauseKind() == OpenACCClauseKind::DType ||
- C->getClauseKind() == OpenACCClauseKind::DeviceType;
- }
- bool hasAsterisk() const {
- return getArchitectures().size() > 0 &&
- getArchitectures()[0].first == nullptr;
- }
-
- ArrayRef<DeviceTypeArgument> getArchitectures() const {
- return ArrayRef<DeviceTypeArgument>(
- getTrailingObjects<DeviceTypeArgument>(), NumArchs);
- }
-
- static OpenACCDeviceTypeClause *
- Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc,
- SourceLocation LParenLoc, ArrayRef<DeviceTypeArgument> Archs,
- SourceLocation EndLoc);
-};
-
/// A 'default' clause, has the optional 'none' or 'present' argument.
class OpenACCDefaultClause : public OpenACCClauseWithParams {
friend class ASTReaderStmt;
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 6100fba..9e82130 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -12344,8 +12344,4 @@ def warn_acc_deprecated_alias_name
def err_acc_var_not_pointer_type
: Error<"expected pointer in '%0' clause, type is %1">;
def note_acc_expected_pointer_var : Note<"expected variable of pointer type">;
-def err_acc_clause_after_device_type
- : Error<"OpenACC clause '%0' may not follow a '%1' clause in a "
- "compute construct">;
-
} // end of sema component.
diff --git a/clang/include/clang/Basic/OpenACCClauses.def b/clang/include/clang/Basic/OpenACCClauses.def
index 7ecc517..afb7b30 100644
--- a/clang/include/clang/Basic/OpenACCClauses.def
+++ b/clang/include/clang/Basic/OpenACCClauses.def
@@ -37,8 +37,6 @@ CLAUSE_ALIAS(PCreate, Create)
CLAUSE_ALIAS(PresentOrCreate, Create)
VISIT_CLAUSE(Default)
VISIT_CLAUSE(DevicePtr)
-VISIT_CLAUSE(DeviceType)
-CLAUSE_ALIAS(DType, DeviceType)
VISIT_CLAUSE(FirstPrivate)
VISIT_CLAUSE(If)
VISIT_CLAUSE(NoCreate)
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index 3910cba..61589fb 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -3720,8 +3720,7 @@ private:
SourceLocation Loc,
llvm::SmallVectorImpl<Expr *> &IntExprs);
/// Parses the 'device-type-list', which is a list of identifiers.
- bool ParseOpenACCDeviceTypeList(
- llvm::SmallVector<std::pair<IdentifierInfo *, SourceLocation>> &Archs);
+ bool ParseOpenACCDeviceTypeList();
/// Parses the 'async-argument', which is an integral value with two
/// 'special' values that are likely negative (but come from Macros).
OpenACCIntExprParseResult ParseOpenACCAsyncArgument(OpenACCDirectiveKind DK,
diff --git a/clang/include/clang/Sema/SemaOpenACC.h b/clang/include/clang/Sema/SemaOpenACC.h
index f838fa9..e684ee6 100644
--- a/clang/include/clang/Sema/SemaOpenACC.h
+++ b/clang/include/clang/Sema/SemaOpenACC.h
@@ -26,9 +26,6 @@ class OpenACCClause;
class SemaOpenACC : public SemaBase {
public:
- // Redeclaration of the version in OpenACCClause.h.
- using DeviceTypeArgument = std::pair<IdentifierInfo *, SourceLocation>;
-
/// A type to represent all the data for an OpenACC Clause that has been
/// parsed, but not yet created/semantically analyzed. This is effectively a
/// discriminated union on the 'Clause Kind', with all of the individual
@@ -63,12 +60,8 @@ public:
SmallVector<Expr *> QueueIdExprs;
};
- struct DeviceTypeDetails {
- SmallVector<DeviceTypeArgument> Archs;
- };
-
std::variant<std::monostate, DefaultDetails, ConditionDetails,
- IntExprDetails, VarListDetails, WaitDetails, DeviceTypeDetails>
+ IntExprDetails, VarListDetails, WaitDetails>
Details = std::monostate{};
public:
@@ -216,13 +209,6 @@ public:
return std::get<VarListDetails>(Details).IsZero;
}
- ArrayRef<DeviceTypeArgument> getDeviceTypeArchitectures() const {
- assert((ClauseKind == OpenACCClauseKind::DeviceType ||
- ClauseKind == OpenACCClauseKind::DType) &&
- "Only 'device_type'/'dtype' has a device-type-arg list");
- return std::get<DeviceTypeDetails>(Details).Archs;
- }
-
void setLParenLoc(SourceLocation EndLoc) { LParenLoc = EndLoc; }
void setEndLoc(SourceLocation EndLoc) { ClauseRange.setEnd(EndLoc); }
@@ -340,13 +326,6 @@ public:
"Parsed clause kind does not have a wait-details");
Details = WaitDetails{DevNum, QueuesLoc, std::move(IntExprs)};
}
-
- void setDeviceTypeDetails(llvm::SmallVector<DeviceTypeArgument> &&Archs) {
- assert((ClauseKind == OpenACCClauseKind::DeviceType ||
- ClauseKind == OpenACCClauseKind::DType) &&
- "Only 'device_type'/'dtype' has a device-type-arg list");
- Details = DeviceTypeDetails{std::move(Archs)};
- }
};
SemaOpenACC(Sema &S);
diff --git a/clang/lib/AST/OpenACCClause.cpp b/clang/lib/AST/OpenACCClause.cpp
index f80ecc90..ee13437 100644
--- a/clang/lib/AST/OpenACCClause.cpp
+++ b/clang/lib/AST/OpenACCClause.cpp
@@ -18,8 +18,7 @@
using namespace clang;
bool OpenACCClauseWithParams::classof(const OpenACCClause *C) {
- return OpenACCDeviceTypeClause::classof(C) ||
- OpenACCClauseWithCondition::classof(C) ||
+ return OpenACCClauseWithCondition::classof(C) ||
OpenACCClauseWithExprs::classof(C);
}
bool OpenACCClauseWithExprs::classof(const OpenACCClause *C) {
@@ -299,17 +298,6 @@ OpenACCCreateClause::Create(const ASTContext &C, OpenACCClauseKind Spelling,
VarList, EndLoc);
}
-OpenACCDeviceTypeClause *OpenACCDeviceTypeClause::Create(
- const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc,
- SourceLocation LParenLoc, ArrayRef<DeviceTypeArgument> Archs,
- SourceLocation EndLoc) {
- void *Mem =
- C.Allocate(OpenACCDeviceTypeClause::totalSizeToAlloc<DeviceTypeArgument>(
- Archs.size()));
- return new (Mem)
- OpenACCDeviceTypeClause(K, BeginLoc, LParenLoc, Archs, EndLoc);
-}
-
//===----------------------------------------------------------------------===//
// OpenACC clauses printing methods
//===----------------------------------------------------------------------===//
@@ -463,17 +451,3 @@ void OpenACCClausePrinter::VisitWaitClause(const OpenACCWaitClause &C) {
OS << ")";
}
}
-
-void OpenACCClausePrinter::VisitDeviceTypeClause(
- const OpenACCDeviceTypeClause &C) {
- OS << C.getClauseKind();
- OS << "(";
- llvm::interleaveComma(C.getArchitectures(), OS,
- [&](const DeviceTypeArgument &Arch) {
- if (Arch.first == nullptr)
- OS << "*";
- else
- OS << Arch.first;
- });
- OS << ")";
-}
diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index caab4ab..8fb8940 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -2585,9 +2585,6 @@ void OpenACCClauseProfiler::VisitWaitClause(const OpenACCWaitClause &Clause) {
for (auto *E : Clause.getQueueIdExprs())
Profiler.VisitStmt(E);
}
-/// Nothing to do here, there are no sub-statements.
-void OpenACCClauseProfiler::VisitDeviceTypeClause(
- const OpenACCDeviceTypeClause &Clause) {}
} // namespace
void StmtProfiler::VisitOpenACCComputeConstruct(
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index efcd747..12aa585 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -444,19 +444,6 @@ void TextNodeDumper::Visit(const OpenACCClause *C) {
if (cast<OpenACCWaitClause>(C)->hasQueuesTag())
OS << " has queues tag";
break;
- case OpenACCClauseKind::DeviceType:
- case OpenACCClauseKind::DType:
- OS << "(";
- llvm::interleaveComma(
- cast<OpenACCDeviceTypeClause>(C)->getArchitectures(), OS,
- [&](const DeviceTypeArgument &Arch) {
- if (Arch.first == nullptr)
- OS << "*";
- else
- OS << Arch.first->getName();
- });
- OS << ")";
- break;
default:
// Nothing to do here.
break;
diff --git a/clang/lib/Parse/ParseOpenACC.cpp b/clang/lib/Parse/ParseOpenACC.cpp
index 261c9cd..0e10632 100644
--- a/clang/lib/Parse/ParseOpenACC.cpp
+++ b/clang/lib/Parse/ParseOpenACC.cpp
@@ -711,15 +711,14 @@ bool Parser::ParseOpenACCIntExprList(OpenACCDirectiveKind DK,
/// device_type( device-type-list )
///
/// The device_type clause may be abbreviated to dtype.
-bool Parser::ParseOpenACCDeviceTypeList(
- llvm::SmallVector<std::pair<IdentifierInfo *, SourceLocation>> &Archs) {
+bool Parser::ParseOpenACCDeviceTypeList() {
if (expectIdentifierOrKeyword(*this)) {
SkipUntil(tok::r_paren, tok::annot_pragma_openacc_end,
Parser::StopBeforeMatch);
- return true;
+ return false;
}
- Archs.emplace_back(getCurToken().getIdentifierInfo(), ConsumeToken());
+ ConsumeToken();
while (!getCurToken().isOneOf(tok::r_paren, tok::annot_pragma_openacc_end)) {
ExpectAndConsume(tok::comma);
@@ -727,9 +726,9 @@ bool Parser::ParseOpenACCDeviceTypeList(
if (expectIdentifierOrKeyword(*this)) {
SkipUntil(tok::r_paren, tok::annot_pragma_openacc_end,
Parser::StopBeforeMatch);
- return true;
+ return false;
}
- Archs.emplace_back(getCurToken().getIdentifierInfo(), ConsumeToken());
+ ConsumeToken();
}
return false;
}
@@ -1022,20 +1021,16 @@ Parser::OpenACCClauseParseResult Parser::ParseOpenACCClauseParams(
break;
}
case OpenACCClauseKind::DType:
- case OpenACCClauseKind::DeviceType: {
- llvm::SmallVector<std::pair<IdentifierInfo *, SourceLocation>> Archs;
+ case OpenACCClauseKind::DeviceType:
if (getCurToken().is(tok::star)) {
// FIXME: We want to mark that this is an 'everything else' type of
// device_type in Sema.
- ParsedClause.setDeviceTypeDetails({{nullptr, ConsumeToken()}});
- } else if (!ParseOpenACCDeviceTypeList(Archs)) {
- ParsedClause.setDeviceTypeDetails(std::move(Archs));
- } else {
+ ConsumeToken();
+ } else if (ParseOpenACCDeviceTypeList()) {
Parens.skipToEnd();
return OpenACCCanContinue();
}
break;
- }
case OpenACCClauseKind::Tile:
if (ParseOpenACCSizeExprList()) {
Parens.skipToEnd();
diff --git a/clang/lib/Sema/SemaOpenACC.cpp b/clang/lib/Sema/SemaOpenACC.cpp
index f174b2f..656d309 100644
--- a/clang/lib/Sema/SemaOpenACC.cpp
+++ b/clang/lib/Sema/SemaOpenACC.cpp
@@ -255,33 +255,6 @@ bool checkAlreadyHasClauseOfKind(
return false;
}
-/// Implement check from OpenACC3.3: section 2.5.4:
-/// Only the async, wait, num_gangs, num_workers, and vector_length clauses may
-/// follow a device_type clause.
-bool checkValidAfterDeviceType(
- SemaOpenACC &S, const OpenACCDeviceTypeClause &DeviceTypeClause,
- const SemaOpenACC::OpenACCParsedClause &NewClause) {
- // This is only a requirement on compute constructs so far, so this is fine
- // otherwise.
- if (!isOpenACCComputeDirectiveKind(NewClause.getDirectiveKind()))
- return false;
- switch (NewClause.getClauseKind()) {
- case OpenACCClauseKind::Async:
- case OpenACCClauseKind::Wait:
- case OpenACCClauseKind::NumGangs:
- case OpenACCClauseKind::NumWorkers:
- case OpenACCClauseKind::VectorLength:
- case OpenACCClauseKind::DType:
- case OpenACCClauseKind::DeviceType:
- return false;
- default:
- S.Diag(NewClause.getBeginLoc(), diag::err_acc_clause_after_device_type)
- << NewClause.getClauseKind() << DeviceTypeClause.getClauseKind();
- S.Diag(DeviceTypeClause.getBeginLoc(), diag::note_acc_previous_clause_here);
- return true;
- }
-}
-
} // namespace
SemaOpenACC::SemaOpenACC(Sema &S) : SemaBase(S) {}
@@ -300,17 +273,6 @@ SemaOpenACC::ActOnClause(ArrayRef<const OpenACCClause *> ExistingClauses,
return nullptr;
}
- if (const auto *DevTypeClause =
- llvm::find_if(ExistingClauses,
- [&](const OpenACCClause *C) {
- return isa<OpenACCDeviceTypeClause>(C);
- });
- DevTypeClause != ExistingClauses.end()) {
- if (checkValidAfterDeviceType(
- *this, *cast<OpenACCDeviceTypeClause>(*DevTypeClause), Clause))
- return nullptr;
- }
-
switch (Clause.getClauseKind()) {
case OpenACCClauseKind::Default: {
// Restrictions only properly implemented on 'compute' constructs, and
@@ -689,23 +651,6 @@ SemaOpenACC::ActOnClause(ArrayRef<const OpenACCClause *> ExistingClauses,
Clause.getDevNumExpr(), Clause.getQueuesLoc(), Clause.getQueueIdExprs(),
Clause.getEndLoc());
}
- case OpenACCClauseKind::DType:
- case OpenACCClauseKind::DeviceType: {
- // Restrictions only properly implemented on 'compute' constructs, and
- // 'compute' constructs are the only construct that can do anything with
- // this yet, so skip/treat as unimplemented in this case.
- if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()))
- break;
-
- // TODO OpenACC: Once we get enough of the CodeGen implemented that we have
- // a source for the list of valid architectures, we need to warn on unknown
- // identifiers here.
-
- return OpenACCDeviceTypeClause::Create(
- getASTContext(), Clause.getClauseKind(), Clause.getBeginLoc(),
- Clause.getLParenLoc(), Clause.getDeviceTypeArchitectures(),
- Clause.getEndLoc());
- }
default:
break;
}
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index ab26d1b..1269650 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -11480,16 +11480,6 @@ void OpenACCClauseTransform<Derived>::VisitWaitClause(
ParsedClause.getQueuesLoc(), ParsedClause.getQueueIdExprs(),
ParsedClause.getEndLoc());
}
-
-template <typename Derived>
-void OpenACCClauseTransform<Derived>::VisitDeviceTypeClause(
- const OpenACCDeviceTypeClause &C) {
- // Nothing to transform here, just create a new version of 'C'.
- NewClause = OpenACCDeviceTypeClause::Create(
- Self.getSema().getASTContext(), C.getClauseKind(),
- ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
- C.getArchitectures(), ParsedClause.getEndLoc());
-}
} // namespace
template <typename Derived>
OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 8f437a7..7627996 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -11905,21 +11905,6 @@ OpenACCClause *ASTRecordReader::readOpenACCClause() {
DevNumExpr, QueuesLoc, QueueIdExprs,
EndLoc);
}
- case OpenACCClauseKind::DeviceType:
- case OpenACCClauseKind::DType: {
- SourceLocation LParenLoc = readSourceLocation();
- llvm::SmallVector<DeviceTypeArgument> Archs;
- unsigned NumArchs = readInt();
-
- for (unsigned I = 0; I < NumArchs; ++I) {
- IdentifierInfo *Ident = readBool() ? readIdentifier() : nullptr;
- SourceLocation Loc = readSourceLocation();
- Archs.emplace_back(Ident, Loc);
- }
-
- return OpenACCDeviceTypeClause::Create(getContext(), ClauseKind, BeginLoc,
- LParenLoc, Archs, EndLoc);
- }
case OpenACCClauseKind::Finalize:
case OpenACCClauseKind::IfPresent:
@@ -11941,6 +11926,8 @@ OpenACCClause *ASTRecordReader::readOpenACCClause() {
case OpenACCClauseKind::Bind:
case OpenACCClauseKind::DeviceNum:
case OpenACCClauseKind::DefaultAsync:
+ case OpenACCClauseKind::DeviceType:
+ case OpenACCClauseKind::DType:
case OpenACCClauseKind::Tile:
case OpenACCClauseKind::Gang:
case OpenACCClauseKind::Invalid:
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 7a9d392..6154ead 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -7933,19 +7933,6 @@ void ASTRecordWriter::writeOpenACCClause(const OpenACCClause *C) {
writeOpenACCIntExprList(WC->getQueueIdExprs());
return;
}
- case OpenACCClauseKind::DeviceType:
- case OpenACCClauseKind::DType: {
- const auto *DTC = cast<OpenACCDeviceTypeClause>(C);
- writeSourceLocation(DTC->getLParenLoc());
- writeUInt32(DTC->getArchitectures().size());
- for (const DeviceTypeArgument &Arg : DTC->getArchitectures()) {
- writeBool(Arg.first);
- if (Arg.first)
- AddIdentifierRef(Arg.first);
- writeSourceLocation(Arg.second);
- }
- return;
- }
case OpenACCClauseKind::Finalize:
case OpenACCClauseKind::IfPresent:
@@ -7967,6 +7954,8 @@ void ASTRecordWriter::writeOpenACCClause(const OpenACCClause *C) {
case OpenACCClauseKind::Bind:
case OpenACCClauseKind::DeviceNum:
case OpenACCClauseKind::DefaultAsync:
+ case OpenACCClauseKind::DeviceType:
+ case OpenACCClauseKind::DType:
case OpenACCClauseKind::Tile:
case OpenACCClauseKind::Gang:
case OpenACCClauseKind::Invalid:
diff --git a/clang/test/AST/ast-print-openacc-compute-construct.cpp b/clang/test/AST/ast-print-openacc-compute-construct.cpp
index cdd9ab3..0bfb90b 100644
--- a/clang/test/AST/ast-print-openacc-compute-construct.cpp
+++ b/clang/test/AST/ast-print-openacc-compute-construct.cpp
@@ -107,28 +107,5 @@ void foo() {
// CHECK: #pragma acc parallel wait(devnum: i : queues: *iPtr, i)
#pragma acc parallel wait(devnum:i:queues:*iPtr, i)
while(true);
-
- bool SomeB;
- struct SomeStruct{} SomeStructImpl;
-
-//#pragma acc parallel dtype(SomeB)
-#pragma acc parallel dtype(SomeB)
- while(true);
-
-//#pragma acc parallel device_type(SomeStruct)
-#pragma acc parallel device_type(SomeStruct)
- while(true);
-
-//#pragma acc parallel device_type(int)
-#pragma acc parallel device_type(int)
- while(true);
-
-//#pragma acc parallel dtype(bool)
-#pragma acc parallel dtype(bool)
- while(true);
-
-//#pragma acc parallel device_type (SomeStructImpl)
-#pragma acc parallel device_type (SomeStructImpl)
- while(true);
}
diff --git a/clang/test/ParserOpenACC/parse-clauses.c b/clang/test/ParserOpenACC/parse-clauses.c
index 694f28b..51858b4 100644
--- a/clang/test/ParserOpenACC/parse-clauses.c
+++ b/clang/test/ParserOpenACC/parse-clauses.c
@@ -1126,10 +1126,12 @@ void device_type() {
#pragma acc parallel dtype(
{}
- // expected-error@+1{{expected identifier}}
+ // expected-error@+2{{expected identifier}}
+ // expected-warning@+1{{OpenACC clause 'device_type' not yet implemented, clause ignored}}
#pragma acc parallel device_type()
{}
- // expected-error@+1{{expected identifier}}
+ // expected-error@+2{{expected identifier}}
+ // expected-warning@+1{{OpenACC clause 'dtype' not yet implemented, clause ignored}}
#pragma acc parallel dtype()
{}
@@ -1171,10 +1173,12 @@ void device_type() {
#pragma acc parallel dtype(ident, ident2
{}
- // expected-error@+1{{expected identifier}}
+ // expected-error@+2{{expected identifier}}
+ // expected-warning@+1{{OpenACC clause 'device_type' not yet implemented, clause ignored}}
#pragma acc parallel device_type(ident, ident2,)
{}
- // expected-error@+1{{expected identifier}}
+ // expected-error@+2{{expected identifier}}
+ // expected-warning@+1{{OpenACC clause 'dtype' not yet implemented, clause ignored}}
#pragma acc parallel dtype(ident, ident2,)
{}
@@ -1196,25 +1200,33 @@ void device_type() {
#pragma acc parallel dtype(*,ident)
{}
- // expected-error@+1{{expected identifier}}
+ // expected-error@+2{{expected identifier}}
+ // expected-warning@+1{{OpenACC clause 'device_type' not yet implemented, clause ignored}}
#pragma acc parallel device_type(ident, *)
{}
- // expected-error@+1{{expected identifier}}
+ // expected-error@+2{{expected identifier}}
+ // expected-warning@+1{{OpenACC clause 'dtype' not yet implemented, clause ignored}}
#pragma acc parallel dtype(ident, *)
{}
- // expected-error@+1{{expected identifier}}
+ // expected-error@+2{{expected identifier}}
+ // expected-warning@+1{{OpenACC clause 'device_type' not yet implemented, clause ignored}}
#pragma acc parallel device_type("foo", 54)
{}
- // expected-error@+1{{expected identifier}}
+ // expected-error@+2{{expected identifier}}
+ // expected-warning@+1{{OpenACC clause 'dtype' not yet implemented, clause ignored}}
#pragma acc parallel dtype(31, "bar")
{}
+ // expected-warning@+1{{OpenACC clause 'device_type' not yet implemented, clause ignored}}
#pragma acc parallel device_type(ident, auto, int, float)
{}
+ // expected-warning@+1{{OpenACC clause 'dtype' not yet implemented, clause ignored}}
#pragma acc parallel dtype(ident, auto, int, float)
{}
+ // expected-warning@+2{{OpenACC clause 'device_type' not yet implemented, clause ignored}}
+ // expected-warning@+1{{OpenACC clause 'dtype' not yet implemented, clause ignored}}
#pragma acc parallel device_type(ident, auto, int, float) dtype(ident, auto, int, float)
{}
}
diff --git a/clang/test/SemaOpenACC/compute-construct-device_type-ast.cpp b/clang/test/SemaOpenACC/compute-construct-device_type-ast.cpp
deleted file mode 100644
index 8a2423f..0000000
--- a/clang/test/SemaOpenACC/compute-construct-device_type-ast.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-// RUN: %clang_cc1 %s -fopenacc -ast-dump | FileCheck %s
-
-// Test this with PCH.
-// RUN: %clang_cc1 %s -fopenacc -emit-pch -o %t %s
-// RUN: %clang_cc1 %s -fopenacc -include-pch %t -ast-dump-all | FileCheck %s
-#ifndef PCH_HELPER
-#define PCH_HELPER
-
-struct SomeS{};
-void NormalUses() {
- // CHECK: FunctionDecl{{.*}}NormalUses
- // CHECK-NEXT: CompoundStmt
-
- SomeS SomeImpl;
- // CHECK-NEXT: DeclStmt
- // CHECK-NEXT: VarDecl{{.*}} SomeImpl 'SomeS'
- // CHECK-NEXT: CXXConstructExpr
- bool SomeVar;
- // CHECK-NEXT: DeclStmt
- // CHECK-NEXT: VarDecl{{.*}} SomeVar 'bool'
-
-#pragma acc parallel device_type(SomeS) dtype(SomeImpl)
- while(true){}
- // CHECK-NEXT: OpenACCComputeConstruct{{.*}}parallel
- // CHECK-NEXT: device_type(SomeS)
- // CHECK-NEXT: dtype(SomeImpl)
- // CHECK-NEXT: WhileStmt
- // CHECK-NEXT: CXXBoolLiteralExpr
- // CHECK-NEXT: CompoundStmt
-#pragma acc parallel device_type(SomeVar) dtype(int)
- while(true){}
- // CHECK-NEXT: OpenACCComputeConstruct{{.*}}parallel
- // CHECK-NEXT: device_type(SomeVar)
- // CHECK-NEXT: dtype(int)
- // CHECK-NEXT: WhileStmt
- // CHECK-NEXT: CXXBoolLiteralExpr
- // CHECK-NEXT: CompoundStmt
-#pragma acc parallel device_type(private) dtype(struct)
- while(true){}
- // CHECK-NEXT: OpenACCComputeConstruct{{.*}}parallel
- // CHECK-NEXT: device_type(private)
- // CHECK-NEXT: dtype(struct)
- // CHECK-NEXT: WhileStmt
- // CHECK-NEXT: CXXBoolLiteralExpr
- // CHECK-NEXT: CompoundStmt
-#pragma acc parallel device_type(private) dtype(class)
- while(true){}
- // CHECK-NEXT: OpenACCComputeConstruct{{.*}}parallel
- // CHECK-NEXT: device_type(private)
- // CHECK-NEXT: dtype(class)
- // CHECK-NEXT: WhileStmt
- // CHECK-NEXT: CXXBoolLiteralExpr
- // CHECK-NEXT: CompoundStmt
-#pragma acc parallel device_type(float) dtype(*)
- while(true){}
- // CHECK-NEXT: OpenACCComputeConstruct{{.*}}parallel
- // CHECK-NEXT: device_type(float)
- // CHECK-NEXT: dtype(*)
- // CHECK-NEXT: WhileStmt
- // CHECK-NEXT: CXXBoolLiteralExpr
- // CHECK-NEXT: CompoundStmt
-#pragma acc parallel device_type(float, int) dtype(*)
- while(true){}
- // CHECK-NEXT: OpenACCComputeConstruct{{.*}}parallel
- // CHECK-NEXT: device_type(float, int)
- // CHECK-NEXT: dtype(*)
- // CHECK-NEXT: WhileStmt
- // CHECK-NEXT: CXXBoolLiteralExpr
- // CHECK-NEXT: CompoundStmt
-}
-
-template<typename T>
-void TemplUses() {
- // CHECK-NEXT: FunctionTemplateDecl{{.*}}TemplUses
- // CHECK-NEXT: TemplateTypeParmDecl{{.*}}T
- // CHECK-NEXT: FunctionDecl{{.*}}TemplUses
- // CHECK-NEXT: CompoundStmt
-#pragma acc parallel device_type(T) dtype(T)
- while(true){}
- // CHECK-NEXT: OpenACCComputeConstruct{{.*}}parallel
- // CHECK-NEXT: device_type(T)
- // CHECK-NEXT: dtype(T)
- // CHECK-NEXT: WhileStmt
- // CHECK-NEXT: CXXBoolLiteralExpr
- // CHECK-NEXT: CompoundStmt
-
-
- // Instantiations
- // CHECK-NEXT: FunctionDecl{{.*}} TemplUses 'void ()' implicit_instantiation
- // CHECK-NEXT: TemplateArgument type 'int'
- // CHECK-NEXT: BuiltinType{{.*}} 'int'
- // CHECK-NEXT: CompoundStmt
-
- // CHECK-NEXT: OpenACCComputeConstruct{{.*}}parallel
- // CHECK-NEXT: device_type(T)
- // CHECK-NEXT: dtype(T)
- // CHECK-NEXT: WhileStmt
- // CHECK-NEXT: CXXBoolLiteralExpr
- // CHECK-NEXT: CompoundStmt
-}
-
-void Inst() {
- TemplUses<int>();
-}
-#endif // PCH_HELPER
diff --git a/clang/test/SemaOpenACC/compute-construct-device_type-clause.c b/clang/test/SemaOpenACC/compute-construct-device_type-clause.c
deleted file mode 100644
index 15c9cf3..0000000
--- a/clang/test/SemaOpenACC/compute-construct-device_type-clause.c
+++ /dev/null
@@ -1,221 +0,0 @@
-// RUN: %clang_cc1 %s -fopenacc -verify
-
-#define MACRO +FOO
-
-void uses() {
- typedef struct S{} STy;
- STy SImpl;
-
-#pragma acc parallel device_type(I)
- while(1);
-#pragma acc serial device_type(S) dtype(STy)
- while(1);
-#pragma acc kernels dtype(SImpl)
- while(1);
-#pragma acc kernels dtype(int) device_type(*)
- while(1);
-#pragma acc kernels dtype(true) device_type(false)
- while(1);
-
- // expected-error@+1{{expected identifier}}
-#pragma acc kernels dtype(int, *)
- while(1);
-
-#pragma acc parallel device_type(I, int)
- while(1);
- // expected-error@+2{{expected ','}}
- // expected-error@+1{{expected identifier}}
-#pragma acc kernels dtype(int{})
- while(1);
- // expected-error@+1{{expected identifier}}
-#pragma acc kernels dtype(5)
- while(1);
- // expected-error@+1{{expected identifier}}
-#pragma acc kernels dtype(MACRO)
- while(1);
-
-
- // Only 'async', 'wait', num_gangs', 'num_workers', 'vector_length' allowed after 'device_type'.
-
- // expected-error@+2{{OpenACC clause 'finalize' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) finalize
- while(1);
- // expected-error@+2{{OpenACC clause 'if_present' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) if_present
- while(1);
- // expected-error@+2{{OpenACC clause 'seq' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) seq
- while(1);
- // expected-error@+2{{OpenACC clause 'independent' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) independent
- while(1);
- // expected-error@+2{{OpenACC clause 'auto' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) auto
- while(1);
- // expected-error@+2{{OpenACC clause 'worker' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) worker
- while(1);
- // expected-error@+2{{OpenACC clause 'nohost' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) nohost
- while(1);
- // expected-error@+2{{OpenACC clause 'default' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) default(none)
- while(1);
- // expected-error@+2{{OpenACC clause 'if' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) if(1)
- while(1);
- // expected-error@+2{{OpenACC clause 'self' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) self
- while(1);
-
- int Var;
- int *VarPtr;
- // expected-error@+2{{OpenACC clause 'copy' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) copy(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'pcopy' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) pcopy(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'present_or_copy' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) present_or_copy(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'use_device' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) use_device(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'attach' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) attach(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'delete' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) delete(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'detach' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) detach(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'device' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) device(VarPtr)
- while(1);
- // expected-error@+2{{OpenACC clause 'deviceptr' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) deviceptr(VarPtr)
- while(1);
- // expected-error@+2{{OpenACC clause 'device_resident' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) device_resident(VarPtr)
- while(1);
- // expected-error@+2{{OpenACC clause 'firstprivate' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc parallel device_type(*) firstprivate(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'host' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) host(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'link' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) link(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'no_create' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) no_create(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'present' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) present(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'private' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc parallel device_type(*) private(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'copyout' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) copyout(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'pcopyout' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) pcopyout(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'present_or_copyout' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) present_or_copyout(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'copyin' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) copyin(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'pcopyin' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) pcopyin(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'present_or_copyin' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) present_or_copyin(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'create' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) create(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'pcreate' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) pcreate(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'present_or_create' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) present_or_create(Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'reduction' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) reduction(+:Var)
- while(1);
- // expected-error@+2{{OpenACC clause 'collapse' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) collapse(1)
- while(1);
- // expected-error@+2{{OpenACC clause 'bind' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) bind(Var)
- while(1);
-#pragma acc kernels device_type(*) vector_length(1)
- while(1);
-#pragma acc kernels device_type(*) num_gangs(1)
- while(1);
-#pragma acc kernels device_type(*) num_workers(1)
- while(1);
- // expected-error@+2{{OpenACC clause 'device_num' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) device_num(1)
- while(1);
- // expected-error@+2{{OpenACC clause 'default_async' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) default_async(1)
- while(1);
-#pragma acc kernels device_type(*) async
- while(1);
- // expected-error@+2{{OpenACC clause 'tile' may not follow a 'device_type' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels device_type(*) tile(Var, 1)
- while(1);
- // expected-error@+2{{OpenACC clause 'gang' may not follow a 'dtype' clause in a compute construct}}
- // expected-note@+1{{previous clause is here}}
-#pragma acc kernels dtype(*) gang
- while(1);
-#pragma acc kernels device_type(*) wait
- while(1);
-}
diff --git a/clang/test/SemaOpenACC/compute-construct-device_type-clause.cpp b/clang/test/SemaOpenACC/compute-construct-device_type-clause.cpp
deleted file mode 100644
index ed40e8bb..0000000
--- a/clang/test/SemaOpenACC/compute-construct-device_type-clause.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// RUN: %clang_cc1 %s -fopenacc -verify
-
-template<typename T>
-void TemplUses() {
-#pragma acc parallel device_type(I)
- while(true);
-#pragma acc parallel dtype(*)
- while(true);
-#pragma acc parallel device_type(class)
- while(true);
-#pragma acc parallel device_type(private)
- while(true);
-#pragma acc parallel device_type(bool)
- while(true);
-#pragma acc kernels dtype(true) device_type(false)
- while(true);
- // expected-error@+2{{expected ','}}
- // expected-error@+1{{expected identifier}}
-#pragma acc parallel device_type(T::value)
- while(true);
-}
-
-void Inst() {
- TemplUses<int>(); // #INST
-}
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 8b9417f..ae6659f 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -2857,8 +2857,6 @@ void OpenACCClauseEnqueue::VisitWaitClause(const OpenACCWaitClause &C) {
for (Expr *QE : C.getQueueIdExprs())
Visitor.AddStmt(QE);
}
-void OpenACCClauseEnqueue::VisitDeviceTypeClause(
- const OpenACCDeviceTypeClause &C) {}
} // namespace
void EnqueueVisitor::EnqueueChildren(const OpenACCClause *C) {