diff options
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp')
-rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp index 4bce409cab4..16e682aeff1 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp @@ -1789,5 +1789,43 @@ void x() { EXPECT_TRUE(notMatchesWithOpenMP(Source2, Matcher)); } +TEST(OMPDefaultClause, Matches) { + auto Matcher = ompExecutableDirective(hasAnyClause(ompDefaultClause())); + + const std::string Source0 = R"( +void x() { +; +})"; + EXPECT_TRUE(notMatchesWithOpenMP(Source0, Matcher)); + + const std::string Source1 = R"( +void x() { +#pragma omp parallel +; +})"; + EXPECT_TRUE(notMatchesWithOpenMP(Source1, Matcher)); + + const std::string Source2 = R"( +void x() { +#pragma omp parallel default(none) +; +})"; + EXPECT_TRUE(matchesWithOpenMP(Source2, Matcher)); + + const std::string Source3 = R"( +void x() { +#pragma omp parallel default(shared) +; +})"; + EXPECT_TRUE(matchesWithOpenMP(Source3, Matcher)); + + const std::string Source4 = R"( +void x(int x) { +#pragma omp parallel num_threads(x) +; +})"; + EXPECT_TRUE(notMatchesWithOpenMP(Source4, Matcher)); +} + } // namespace ast_matchers } // namespace clang |