Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 27 additions & 30 deletions clang/include/clang/AST/OpenACCClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class OpenACCDeviceTypeClause final
"Only a single asterisk version is permitted, and must be the "
"only one");

llvm::uninitialized_copy(Archs, getTrailingObjects<DeviceTypeArgument>());
llvm::uninitialized_copy(Archs, getTrailingObjects());
}

public:
Expand All @@ -307,8 +307,7 @@ class OpenACCDeviceTypeClause final
}

ArrayRef<DeviceTypeArgument> getArchitectures() const {
return ArrayRef<DeviceTypeArgument>(
getTrailingObjects<DeviceTypeArgument>(), NumArchs);
return getTrailingObjects<DeviceTypeArgument>(NumArchs);
}

static OpenACCDeviceTypeClause *
Expand Down Expand Up @@ -421,9 +420,7 @@ class OpenACCSelfClause final

// Intentionally internal, meant to be an implementation detail of everything
// else. All non-internal uses should go through getConditionExpr/getVarList.
llvm::ArrayRef<Expr *> getExprs() const {
return {getTrailingObjects<Expr *>(), NumExprs};
}
ArrayRef<Expr *> getExprs() const { return getTrailingObjects(NumExprs); }

public:
static bool classof(const OpenACCClause *C) {
Expand Down Expand Up @@ -472,8 +469,8 @@ class OpenACCSelfClause final

child_range children() {
return child_range(
reinterpret_cast<Stmt **>(getTrailingObjects<Expr *>()),
reinterpret_cast<Stmt **>(getTrailingObjects<Expr *>() + NumExprs));
reinterpret_cast<Stmt **>(getTrailingObjects()),
reinterpret_cast<Stmt **>(getTrailingObjects() + NumExprs));
}

const_child_range children() const {
Expand Down Expand Up @@ -546,10 +543,10 @@ class OpenACCWaitClause final
QueuesLoc(QueuesLoc) {
// The first element of the trailing storage is always the devnum expr,
// whether it is used or not.
auto *Exprs = getTrailingObjects<Expr *>();
auto *Exprs = getTrailingObjects();
llvm::uninitialized_copy(ArrayRef(DevNumExpr), Exprs);
llvm::uninitialized_copy(QueueIdExprs, Exprs + 1);
setExprs(getTrailingObjects<Expr *>(QueueIdExprs.size() + 1));
setExprs(getTrailingObjects(QueueIdExprs.size() + 1));
}

public:
Expand Down Expand Up @@ -586,7 +583,7 @@ class OpenACCNumGangsClause final
ArrayRef<Expr *> IntExprs, SourceLocation EndLoc)
: OpenACCClauseWithExprs(OpenACCClauseKind::NumGangs, BeginLoc, LParenLoc,
EndLoc) {
setExprs(getTrailingObjects<Expr *>(IntExprs.size()), IntExprs);
setExprs(getTrailingObjects(IntExprs.size()), IntExprs);
}

public:
Expand Down Expand Up @@ -614,7 +611,7 @@ class OpenACCTileClause final
ArrayRef<Expr *> SizeExprs, SourceLocation EndLoc)
: OpenACCClauseWithExprs(OpenACCClauseKind::Tile, BeginLoc, LParenLoc,
EndLoc) {
setExprs(getTrailingObjects<Expr *>(SizeExprs.size()), SizeExprs);
setExprs(getTrailingObjects(SizeExprs.size()), SizeExprs);
}

public:
Expand Down Expand Up @@ -851,7 +848,7 @@ class OpenACCPrivateClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::Private, BeginLoc,
LParenLoc, EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -872,7 +869,7 @@ class OpenACCFirstPrivateClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::FirstPrivate, BeginLoc,
LParenLoc, EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -893,7 +890,7 @@ class OpenACCDevicePtrClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::DevicePtr, BeginLoc,
LParenLoc, EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -914,7 +911,7 @@ class OpenACCAttachClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::Attach, BeginLoc, LParenLoc,
EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -935,7 +932,7 @@ class OpenACCDetachClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::Detach, BeginLoc, LParenLoc,
EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -956,7 +953,7 @@ class OpenACCDeleteClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::Delete, BeginLoc, LParenLoc,
EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -977,7 +974,7 @@ class OpenACCUseDeviceClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::UseDevice, BeginLoc,
LParenLoc, EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -998,7 +995,7 @@ class OpenACCNoCreateClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::NoCreate, BeginLoc,
LParenLoc, EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -1019,7 +1016,7 @@ class OpenACCPresentClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::Present, BeginLoc,
LParenLoc, EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -1039,7 +1036,7 @@ class OpenACCHostClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::Host, BeginLoc, LParenLoc,
EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -1061,7 +1058,7 @@ class OpenACCDeviceClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::Device, BeginLoc, LParenLoc,
EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -1088,7 +1085,7 @@ class OpenACCCopyClause final
Spelling == OpenACCClauseKind::PCopy ||
Spelling == OpenACCClauseKind::PresentOrCopy) &&
"Invalid clause kind for copy-clause");
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand Down Expand Up @@ -1121,7 +1118,7 @@ class OpenACCCopyInClause final
Spelling == OpenACCClauseKind::PCopyIn ||
Spelling == OpenACCClauseKind::PresentOrCopyIn) &&
"Invalid clause kind for copyin-clause");
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand Down Expand Up @@ -1153,7 +1150,7 @@ class OpenACCCopyOutClause final
Spelling == OpenACCClauseKind::PCopyOut ||
Spelling == OpenACCClauseKind::PresentOrCopyOut) &&
"Invalid clause kind for copyout-clause");
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand Down Expand Up @@ -1185,7 +1182,7 @@ class OpenACCCreateClause final
Spelling == OpenACCClauseKind::PCreate ||
Spelling == OpenACCClauseKind::PresentOrCreate) &&
"Invalid clause kind for create-clause");
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand Down Expand Up @@ -1214,7 +1211,7 @@ class OpenACCReductionClause final
: OpenACCClauseWithVarList(OpenACCClauseKind::Reduction, BeginLoc,
LParenLoc, EndLoc),
Op(Operator) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -1239,7 +1236,7 @@ class OpenACCLinkClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::Link, BeginLoc, LParenLoc,
EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand All @@ -1262,7 +1259,7 @@ class OpenACCDeviceResidentClause final
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::DeviceResident, BeginLoc,
LParenLoc, EndLoc) {
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
setExprs(getTrailingObjects(VarList.size()), VarList);
}

public:
Expand Down
61 changes: 22 additions & 39 deletions clang/include/clang/AST/OpenMPClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ template <class T> class OMPVarListClause : public OMPClause {

/// Fetches list of variables associated with this clause.
MutableArrayRef<Expr *> getVarRefs() {
return MutableArrayRef<Expr *>(
static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
return static_cast<T *>(this)->template getTrailingObjects<Expr *>(NumVars);
}

/// Sets the list of variables for this clause.
Expand Down Expand Up @@ -336,8 +335,7 @@ template <class T> class OMPVarListClause : public OMPClause {

/// Fetches list of all variables in the clause.
ArrayRef<const Expr *> getVarRefs() const {
return llvm::ArrayRef(
static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
return static_cast<const T *>(this)->template getTrailingObjects<Expr *>(
NumVars);
}
};
Expand Down Expand Up @@ -382,10 +380,8 @@ template <class T> class OMPDirectiveListClause : public OMPClause {
}

MutableArrayRef<OpenMPDirectiveKind> getDirectiveKinds() {
return MutableArrayRef<OpenMPDirectiveKind>(
static_cast<T *>(this)
->template getTrailingObjects<OpenMPDirectiveKind>(),
NumKinds);
return static_cast<T *>(this)
->template getTrailingObjects<OpenMPDirectiveKind>(NumKinds);
}

void setDirectiveKinds(ArrayRef<OpenMPDirectiveKind> DK) {
Expand Down Expand Up @@ -984,14 +980,12 @@ class OMPSizesClause final

/// Returns the tile size expressions.
MutableArrayRef<Expr *> getSizesRefs() {
return MutableArrayRef<Expr *>(static_cast<OMPSizesClause *>(this)
->template getTrailingObjects<Expr *>(),
NumSizes);
return static_cast<OMPSizesClause *>(this)
->template getTrailingObjects<Expr *>(NumSizes);
}
ArrayRef<Expr *> getSizesRefs() const {
return ArrayRef<Expr *>(static_cast<const OMPSizesClause *>(this)
->template getTrailingObjects<Expr *>(),
NumSizes);
return static_cast<const OMPSizesClause *>(this)
->template getTrailingObjects<Expr *>(NumSizes);
}

/// Sets the tile size expressions.
Expand Down Expand Up @@ -1090,14 +1084,12 @@ class OMPPermutationClause final
/// Returns the permutation index expressions.
///@{
MutableArrayRef<Expr *> getArgsRefs() {
return MutableArrayRef<Expr *>(static_cast<OMPPermutationClause *>(this)
->template getTrailingObjects<Expr *>(),
NumLoops);
return static_cast<OMPPermutationClause *>(this)
->template getTrailingObjects<Expr *>(NumLoops);
}
ArrayRef<Expr *> getArgsRefs() const {
return ArrayRef<Expr *>(static_cast<const OMPPermutationClause *>(this)
->template getTrailingObjects<Expr *>(),
NumLoops);
return static_cast<const OMPPermutationClause *>(this)
->template getTrailingObjects<Expr *>(NumLoops);
}
///@}

Expand Down Expand Up @@ -3841,7 +3833,7 @@ class OMPReductionClause final
return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size());
}
ArrayRef<const Expr *> getRHSExprs() const {
return llvm::ArrayRef(getLHSExprs().end(), varlist_size());
return ArrayRef(getLHSExprs().end(), varlist_size());
}

/// Set list of helper reduction expressions, required for proper
Expand Down Expand Up @@ -5925,18 +5917,15 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
/// Get the unique declarations that are in the trailing objects of the
/// class.
MutableArrayRef<ValueDecl *> getUniqueDeclsRef() {
return MutableArrayRef<ValueDecl *>(
static_cast<T *>(this)->template getTrailingObjects<ValueDecl *>(),
return static_cast<T *>(this)->template getTrailingObjects<ValueDecl *>(
NumUniqueDeclarations);
}

/// Get the unique declarations that are in the trailing objects of the
/// class.
ArrayRef<ValueDecl *> getUniqueDeclsRef() const {
return ArrayRef<ValueDecl *>(
static_cast<const T *>(this)
->template getTrailingObjects<ValueDecl *>(),
NumUniqueDeclarations);
return static_cast<const T *>(this)
->template getTrailingObjects<ValueDecl *>(NumUniqueDeclarations);
}

/// Set the unique declarations that are in the trailing objects of the
Expand All @@ -5950,16 +5939,14 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
/// Get the number of lists per declaration that are in the trailing
/// objects of the class.
MutableArrayRef<unsigned> getDeclNumListsRef() {
return MutableArrayRef<unsigned>(
static_cast<T *>(this)->template getTrailingObjects<unsigned>(),
return static_cast<T *>(this)->template getTrailingObjects<unsigned>(
NumUniqueDeclarations);
}

/// Get the number of lists per declaration that are in the trailing
/// objects of the class.
ArrayRef<unsigned> getDeclNumListsRef() const {
return ArrayRef<unsigned>(
static_cast<const T *>(this)->template getTrailingObjects<unsigned>(),
return static_cast<const T *>(this)->template getTrailingObjects<unsigned>(
NumUniqueDeclarations);
}

Expand Down Expand Up @@ -5999,18 +5986,14 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,

/// Get the components that are in the trailing objects of the class.
MutableArrayRef<MappableComponent> getComponentsRef() {
return MutableArrayRef<MappableComponent>(
static_cast<T *>(this)
->template getTrailingObjects<MappableComponent>(),
NumComponents);
return static_cast<T *>(this)
->template getTrailingObjects<MappableComponent>(NumComponents);
}

/// Get the components that are in the trailing objects of the class.
ArrayRef<MappableComponent> getComponentsRef() const {
return ArrayRef<MappableComponent>(
static_cast<const T *>(this)
->template getTrailingObjects<MappableComponent>(),
NumComponents);
return static_cast<const T *>(this)
->template getTrailingObjects<MappableComponent>(NumComponents);
}

/// Set the components that are in the trailing objects of the class.
Expand Down
5 changes: 2 additions & 3 deletions clang/lib/AST/OpenACCClause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ OpenACCSelfClause::OpenACCSelfClause(SourceLocation BeginLoc,
: OpenACCClauseWithParams(OpenACCClauseKind::Self, BeginLoc, LParenLoc,
EndLoc),
HasConditionExpr(std::nullopt), NumExprs(VarList.size()) {
llvm::uninitialized_copy(VarList, getTrailingObjects<Expr *>());
llvm::uninitialized_copy(VarList, getTrailingObjects());
}

OpenACCSelfClause::OpenACCSelfClause(SourceLocation BeginLoc,
Expand All @@ -126,8 +126,7 @@ OpenACCSelfClause::OpenACCSelfClause(SourceLocation BeginLoc,
assert((!ConditionExpr || ConditionExpr->isInstantiationDependent() ||
ConditionExpr->getType()->isScalarType()) &&
"Condition expression type not scalar/dependent");
llvm::uninitialized_copy(ArrayRef(ConditionExpr),
getTrailingObjects<Expr *>());
llvm::uninitialized_copy(ArrayRef(ConditionExpr), getTrailingObjects());
}

OpenACCClause::child_range OpenACCClause::children() {
Expand Down