diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2019-03-21 15:33:24 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2019-03-21 15:33:24 +0000 |
commit | 33ef20ec2f1324b1fbee60f502d9a3ede550d5d8 (patch) | |
tree | adeee29f521a1605b5b695f62fffededb7c34872 /clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp | |
parent | de0e4ae024eced8fa952c4b8d9e0f0a607a0a86b (diff) | |
download | bcm5719-llvm-33ef20ec2f1324b1fbee60f502d9a3ede550d5d8.tar.gz bcm5719-llvm-33ef20ec2f1324b1fbee60f502d9a3ede550d5d8.zip |
[ASTTypeTraits][ASTMatchers][OpenMP] OMPClause handling
Summary:
`OMPClause` is the base class, it is not descendant from **any**
other class, therefore for it to work with e.g.
`VariadicDynCastAllOfMatcher<>`, it needs to be handled here.
Reviewers: sbenza, bkramer, pcc, klimek, hokein, gribozavr, aaron.ballman, george.karpenkov
Reviewed By: gribozavr, aaron.ballman
Subscribers: guansong, jdoerfert, alexfh, ABataev, cfe-commits
Tags: #openmp, #clang
Differential Revision: https://reviews.llvm.org/D57112
llvm-svn: 356675
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 |