[PATCH] D103665: [Clang][OpenMP] Add static version of getSingleClause<ClauseT> NFC.
Michael Kruse via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 3 21:10:54 PDT 2021
Meinersbur updated this revision to Diff 349762.
Meinersbur edited the summary of this revision.
Meinersbur added a comment.
Add context
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103665/new/
https://reviews.llvm.org/D103665
Files:
clang/include/clang/AST/StmtOpenMP.h
Index: clang/include/clang/AST/StmtOpenMP.h
===================================================================
--- clang/include/clang/AST/StmtOpenMP.h
+++ clang/include/clang/AST/StmtOpenMP.h
@@ -460,17 +460,22 @@
/// directive). Returns nullptr if no clause of this kind is associated with
/// the directive.
template <typename SpecificClause>
- const SpecificClause *getSingleClause() const {
- auto Clauses = getClausesOfKind<SpecificClause>();
+ static const SpecificClause *getSingleClause(ArrayRef<OMPClause *> Clauses) {
+ auto ClausesOfKind = getClausesOfKind<SpecificClause>(Clauses);
- if (Clauses.begin() != Clauses.end()) {
- assert(std::next(Clauses.begin()) == Clauses.end() &&
+ if (ClausesOfKind.begin() != ClausesOfKind.end()) {
+ assert(std::next(ClausesOfKind.begin()) == ClausesOfKind.end() &&
"There are at least 2 clauses of the specified kind");
- return *Clauses.begin();
+ return *ClausesOfKind.begin();
}
return nullptr;
}
+ template <typename SpecificClause>
+ const SpecificClause *getSingleClause() const {
+ return getSingleClause<SpecificClause>(clauses());
+ }
+
/// Returns true if the current directive has one or more clauses of a
/// specific kind.
template <typename SpecificClause>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103665.349762.patch
Type: text/x-patch
Size: 1311 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210604/1704360e/attachment.bin>
More information about the cfe-commits
mailing list