Skip to content

Commit 85653b4

Browse files
committed
support_for_target_directive_clang_unittests
1 parent 846d871 commit 85653b4

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8735,6 +8735,21 @@ AST_MATCHER_P(OMPExecutableDirective, hasAnyClause,
87358735
Builder) != Clauses.end();
87368736
}
87378737

8738+
/// Matches any ``#pragma omp target update`` executable directive.
8739+
///
8740+
/// Given
8741+
///
8742+
/// \code
8743+
/// #pragma omp target update from(a)
8744+
/// #pragma omp target update to(b)
8745+
/// \endcode
8746+
///
8747+
/// ``ompTargetUpdateDirective()`` matches both ``omp target update from(a)``
8748+
/// and ``omp target update to(b)``.
8749+
extern const internal::VariadicDynCastAllOfMatcher<Stmt,
8750+
OMPTargetUpdateDirective>
8751+
ompTargetUpdateDirective;
8752+
87388753
/// Matches OpenMP ``default`` clause.
87398754
///
87408755
/// Given
@@ -8848,6 +8863,18 @@ AST_MATCHER_P(OMPExecutableDirective, isAllowedToContainClauseKind,
88488863
Finder->getASTContext().getLangOpts().OpenMP);
88498864
}
88508865

8866+
/// Matches OpenMP ``from`` clause.
8867+
///
8868+
/// Given
8869+
///
8870+
/// \code
8871+
/// #pragma omp target update from(a)
8872+
/// \endcode
8873+
///
8874+
/// ``ompFromClause()`` matches ``from(a)``.
8875+
extern const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPFromClause>
8876+
ompFromClause;
8877+
88518878
//----------------------------------------------------------------------------//
88528879
// End OpenMP handling.
88538880
//----------------------------------------------------------------------------//

clang/lib/ASTMatchers/ASTMatchersInternal.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,8 +1125,12 @@ AST_TYPELOC_TRAVERSE_MATCHER_DEF(
11251125

11261126
const internal::VariadicDynCastAllOfMatcher<Stmt, OMPExecutableDirective>
11271127
ompExecutableDirective;
1128+
const internal::VariadicDynCastAllOfMatcher<Stmt, OMPTargetUpdateDirective>
1129+
ompTargetUpdateDirective;
11281130
const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause>
11291131
ompDefaultClause;
1132+
const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPFromClause>
1133+
ompFromClause;
11301134
const internal::VariadicDynCastAllOfMatcher<Decl, CXXDeductionGuideDecl>
11311135
cxxDeductionGuideDecl;
11321136

clang/lib/ASTMatchers/Dynamic/Registry.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,9 @@ RegistryMaps::RegistryMaps() {
531531
REGISTER_MATCHER(ofClass);
532532
REGISTER_MATCHER(ofKind);
533533
REGISTER_MATCHER(ompDefaultClause);
534+
REGISTER_MATCHER(ompFromClause);
534535
REGISTER_MATCHER(ompExecutableDirective);
536+
REGISTER_MATCHER(ompTargetUpdateDirective);
535537
REGISTER_MATCHER(on);
536538
REGISTER_MATCHER(onImplicitObjectArgument);
537539
REGISTER_MATCHER(opaqueValueExpr);

0 commit comments

Comments
 (0)