| Roman Lebedev | b570060 | 2019-03-20 16:32:36 +0000 | [diff] [blame] | 1 | //===- unittests/AST/OMPStructuredBlockTest.cpp ---------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // Fine-grained tests for IsOMPStructuredBlock bit of Stmt. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "ASTPrint.h" |
| 14 | #include "clang/AST/ASTContext.h" |
| 15 | #include "clang/AST/StmtOpenMP.h" |
| 16 | #include "clang/ASTMatchers/ASTMatchFinder.h" |
| 17 | #include "clang/Tooling/Tooling.h" |
| 18 | #include "llvm/ADT/SmallString.h" |
| 19 | #include "gmock/gmock.h" |
| 20 | #include "gtest/gtest.h" |
| 21 | |
| 22 | using namespace clang; |
| 23 | using namespace ast_matchers; |
| 24 | using namespace tooling; |
| 25 | |
| 26 | namespace { |
| 27 | |
| 28 | AST_MATCHER(Stmt, isOMPStructuredBlock) { return Node.isOMPStructuredBlock(); } |
| 29 | |
| 30 | const ast_matchers::internal::VariadicDynCastAllOfMatcher< |
| 31 | Stmt, OMPExecutableDirective> |
| 32 | ompExecutableDirective; |
| 33 | |
| 34 | const ast_matchers::internal::VariadicDynCastAllOfMatcher< |
| 35 | OMPExecutableDirective, OMPTargetDirective> |
| 36 | ompTargetDirective; |
| 37 | |
| 38 | StatementMatcher OMPInnermostStructuredBlockMatcher() { |
| 39 | return stmt(isOMPStructuredBlock(), |
| 40 | unless(hasDescendant(stmt(isOMPStructuredBlock())))) |
| 41 | .bind("id"); |
| 42 | } |
| 43 | |
| 44 | AST_MATCHER(OMPExecutableDirective, isStandaloneDirective) { |
| 45 | return Node.isStandaloneDirective(); |
| 46 | } |
| 47 | |
| 48 | StatementMatcher OMPStandaloneDirectiveMatcher() { |
| 49 | return stmt(ompExecutableDirective(isStandaloneDirective())).bind("id"); |
| 50 | } |
| 51 | |
| 52 | template <typename T> |
| 53 | ::testing::AssertionResult |
| 54 | PrintedOMPStmtMatches(StringRef Code, const T &NodeMatch, |
| 55 | StringRef ExpectedPrinted, |
| 56 | PolicyAdjusterType PolicyAdjuster = None) { |
| 57 | std::vector<std::string> Args = { |
| Jordan Rupprecht | bcb8316 | 2019-03-20 21:01:56 +0000 | [diff] [blame^] | 58 | "-fopenmp=libomp", |
| Roman Lebedev | b570060 | 2019-03-20 16:32:36 +0000 | [diff] [blame] | 59 | }; |
| 60 | return PrintedStmtMatches(Code, Args, NodeMatch, ExpectedPrinted, |
| 61 | PolicyAdjuster); |
| 62 | } |
| 63 | |
| 64 | static testing::AssertionResult NoMatches(StringRef Code, |
| 65 | const StatementMatcher &StmtMatch) { |
| 66 | PrintMatch Printer((PolicyAdjusterType())); |
| 67 | MatchFinder Finder; |
| 68 | Finder.addMatcher(StmtMatch, &Printer); |
| 69 | std::unique_ptr<FrontendActionFactory> Factory( |
| 70 | newFrontendActionFactory(&Finder)); |
| 71 | if (!runToolOnCode(Factory->create(), Code)) |
| 72 | return testing::AssertionFailure() |
| 73 | << "Parsing error in \"" << Code.str() << "\""; |
| 74 | if (Printer.getNumFoundStmts() == 0) |
| 75 | return testing::AssertionSuccess(); |
| 76 | return testing::AssertionFailure() |
| 77 | << "Matcher should match only zero statements (found " |
| 78 | << Printer.getNumFoundStmts() << ")"; |
| 79 | } |
| 80 | |
| 81 | } // unnamed namespace |
| 82 | |
| 83 | TEST(OMPStructuredBlock, TestAtomic) { |
| 84 | const char *Source = |
| 85 | R"( |
| 86 | void test(int i) { |
| 87 | #pragma omp atomic |
| 88 | ++i; |
| 89 | })"; |
| 90 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 91 | Source, OMPInnermostStructuredBlockMatcher(), "++i")); |
| 92 | } |
| 93 | |
| 94 | TEST(OMPStructuredBlock, TestBarrier) { |
| 95 | const char *Source = |
| 96 | R"( |
| 97 | void test() { |
| 98 | #pragma omp barrier |
| 99 | })"; |
| 100 | ASSERT_TRUE(PrintedOMPStmtMatches(Source, OMPStandaloneDirectiveMatcher(), |
| 101 | "#pragma omp barrier\n")); |
| 102 | ASSERT_TRUE(NoMatches(Source, OMPInnermostStructuredBlockMatcher())); |
| 103 | } |
| 104 | |
| 105 | TEST(OMPStructuredBlock, TestCancel) { |
| 106 | const char *Source = |
| 107 | R"( |
| 108 | void test() { |
| 109 | #pragma omp parallel |
| 110 | { |
| 111 | #pragma omp cancel parallel |
| 112 | } |
| 113 | })"; |
| 114 | ASSERT_TRUE( |
| 115 | PrintedOMPStmtMatches(Source, OMPInnermostStructuredBlockMatcher(), R"({ |
| 116 | #pragma omp cancel parallel |
| 117 | } |
| 118 | )")); |
| 119 | ASSERT_TRUE(PrintedOMPStmtMatches(Source, OMPStandaloneDirectiveMatcher(), |
| 120 | "#pragma omp cancel parallel\n")); |
| 121 | } |
| 122 | |
| 123 | TEST(OMPStructuredBlock, TestCancellationPoint) { |
| 124 | const char *Source = |
| 125 | R"( |
| 126 | void test() { |
| 127 | #pragma omp parallel |
| 128 | { |
| 129 | #pragma omp cancellation point parallel |
| 130 | } |
| 131 | })"; |
| 132 | ASSERT_TRUE( |
| 133 | PrintedOMPStmtMatches(Source, OMPInnermostStructuredBlockMatcher(), R"({ |
| 134 | #pragma omp cancellation point parallel |
| 135 | } |
| 136 | )")); |
| 137 | ASSERT_TRUE( |
| 138 | PrintedOMPStmtMatches(Source, OMPStandaloneDirectiveMatcher(), |
| 139 | "#pragma omp cancellation point parallel\n")); |
| 140 | } |
| 141 | |
| 142 | TEST(OMPStructuredBlock, TestCritical) { |
| 143 | const char *Source = |
| 144 | R"( |
| 145 | void test() { |
| 146 | #pragma omp critical |
| 147 | ; |
| 148 | })"; |
| 149 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 150 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 151 | } |
| 152 | |
| 153 | //----------------------------------------------------------------------------// |
| 154 | // Loop tests |
| 155 | //----------------------------------------------------------------------------// |
| 156 | |
| 157 | class OMPStructuredBlockLoop : public ::testing::TestWithParam<const char *> {}; |
| 158 | |
| 159 | TEST_P(OMPStructuredBlockLoop, TestDirective0) { |
| 160 | const std::string Source = |
| 161 | R"( |
| 162 | void test(int x) { |
| 163 | #pragma omp )" + |
| 164 | std::string(GetParam()) + R"( |
| 165 | for (int i = 0; i < x; i++) |
| 166 | ; |
| 167 | })"; |
| 168 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 169 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 170 | } |
| 171 | |
| 172 | TEST_P(OMPStructuredBlockLoop, TestDirective1) { |
| 173 | const std::string Source = |
| 174 | R"( |
| 175 | void test(int x, int y) { |
| 176 | #pragma omp )" + |
| 177 | std::string(GetParam()) + R"( |
| 178 | for (int i = 0; i < x; i++) |
| 179 | for (int i = 0; i < y; i++) |
| 180 | ; |
| 181 | })"; |
| 182 | ASSERT_TRUE(PrintedOMPStmtMatches(Source, |
| 183 | OMPInnermostStructuredBlockMatcher(), |
| 184 | "for (int i = 0; i < y; i++)\n ;\n")); |
| 185 | } |
| 186 | |
| 187 | TEST_P(OMPStructuredBlockLoop, TestDirectiveCollapse1) { |
| 188 | const std::string Source = |
| 189 | R"( |
| 190 | void test(int x, int y) { |
| 191 | #pragma omp )" + |
| 192 | std::string(GetParam()) + R"( collapse(1) |
| 193 | for (int i = 0; i < x; i++) |
| 194 | for (int i = 0; i < y; i++) |
| 195 | ; |
| 196 | })"; |
| 197 | ASSERT_TRUE(PrintedOMPStmtMatches(Source, |
| 198 | OMPInnermostStructuredBlockMatcher(), |
| 199 | "for (int i = 0; i < y; i++)\n ;\n")); |
| 200 | } |
| 201 | |
| 202 | TEST_P(OMPStructuredBlockLoop, TestDirectiveCollapse2) { |
| 203 | const std::string Source = |
| 204 | R"( |
| 205 | void test(int x, int y) { |
| 206 | #pragma omp )" + |
| 207 | std::string(GetParam()) + R"( collapse(2) |
| 208 | for (int i = 0; i < x; i++) |
| 209 | for (int i = 0; i < y; i++) |
| 210 | ; |
| 211 | })"; |
| 212 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 213 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 214 | } |
| 215 | |
| 216 | TEST_P(OMPStructuredBlockLoop, TestDirectiveCollapse22) { |
| 217 | const std::string Source = |
| 218 | R"( |
| 219 | void test(int x, int y, int z) { |
| 220 | #pragma omp )" + |
| 221 | std::string(GetParam()) + R"( collapse(2) |
| 222 | for (int i = 0; i < x; i++) |
| 223 | for (int i = 0; i < y; i++) |
| 224 | for (int i = 0; i < z; i++) |
| 225 | ; |
| 226 | })"; |
| 227 | ASSERT_TRUE(PrintedOMPStmtMatches(Source, |
| 228 | OMPInnermostStructuredBlockMatcher(), |
| 229 | "for (int i = 0; i < z; i++)\n ;\n")); |
| 230 | } |
| 231 | |
| 232 | INSTANTIATE_TEST_CASE_P( |
| 233 | OMPStructuredBlockLoopDirectives, OMPStructuredBlockLoop, |
| 234 | ::testing::Values("simd", "for", "for simd", "parallel for", |
| 235 | "parallel for simd", "target parallel for", "taskloop", |
| 236 | "taskloop simd", "distribute", "distribute parallel for", |
| 237 | "distribute parallel for simd", "distribute simd", |
| 238 | "target parallel for simd", "target simd", |
| 239 | "target\n#pragma omp teams distribute", |
| 240 | "target\n#pragma omp teams distribute simd", |
| 241 | "target\n#pragma omp teams distribute parallel for simd", |
| 242 | "target\n#pragma omp teams distribute parallel for", |
| 243 | "target teams distribute", |
| 244 | "target teams distribute parallel for", |
| 245 | "target teams distribute parallel for simd", |
| 246 | "target teams distribute simd"), ); |
| 247 | |
| 248 | //----------------------------------------------------------------------------// |
| 249 | // End Loop tests |
| 250 | //----------------------------------------------------------------------------// |
| 251 | |
| 252 | TEST(OMPStructuredBlock, TestFlush) { |
| 253 | const char *Source = |
| 254 | R"( |
| 255 | void test() { |
| 256 | #pragma omp flush |
| 257 | })"; |
| 258 | ASSERT_TRUE(PrintedOMPStmtMatches(Source, OMPStandaloneDirectiveMatcher(), |
| 259 | "#pragma omp flush\n")); |
| 260 | ASSERT_TRUE(NoMatches(Source, OMPInnermostStructuredBlockMatcher())); |
| 261 | } |
| 262 | |
| 263 | TEST(OMPStructuredBlock, TestMaster) { |
| 264 | const char *Source = |
| 265 | R"( |
| 266 | void test() { |
| 267 | #pragma omp master |
| 268 | ; |
| 269 | })"; |
| 270 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 271 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 272 | } |
| 273 | |
| 274 | TEST(OMPStructuredBlock, TestOrdered0) { |
| 275 | const char *Source = |
| 276 | R"( |
| 277 | void test() { |
| 278 | #pragma omp ordered |
| 279 | ; |
| 280 | })"; |
| 281 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 282 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 283 | } |
| 284 | |
| 285 | TEST(OMPStructuredBlock, TestOrdered1) { |
| 286 | const char *Source = |
| 287 | R"( |
| 288 | void test(int x) { |
| 289 | #pragma omp for ordered |
| 290 | for (int i = 0; i < x; i++) |
| 291 | ; |
| 292 | })"; |
| 293 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 294 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 295 | } |
| 296 | |
| 297 | TEST(OMPStructuredBlock, TestOrdered2) { |
| 298 | const char *Source = |
| 299 | R"( |
| 300 | void test(int x) { |
| 301 | #pragma omp for ordered(1) |
| 302 | for (int i = 0; i < x; i++) { |
| 303 | #pragma omp ordered depend(source) |
| 304 | } |
| 305 | })"; |
| 306 | ASSERT_TRUE( |
| 307 | PrintedOMPStmtMatches(Source, OMPInnermostStructuredBlockMatcher(), |
| 308 | "{\n #pragma omp ordered depend(source)\n}\n")); |
| 309 | ASSERT_TRUE(PrintedOMPStmtMatches(Source, OMPStandaloneDirectiveMatcher(), |
| 310 | "#pragma omp ordered depend(source)\n")); |
| 311 | } |
| 312 | |
| 313 | TEST(OMPStructuredBlock, DISABLED_TestParallelMaster0XFAIL) { |
| 314 | const char *Source = |
| 315 | R"( |
| 316 | void test() { |
| 317 | #pragma omp parallel master |
| 318 | ; |
| 319 | })"; |
| 320 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 321 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 322 | } |
| 323 | |
| 324 | TEST(OMPStructuredBlock, DISABLED_TestParallelMaster1XFAIL) { |
| 325 | const char *Source = |
| 326 | R"( |
| 327 | void test() { |
| 328 | #pragma omp parallel master |
| 329 | { ; } |
| 330 | })"; |
| 331 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 332 | Source, OMPInnermostStructuredBlockMatcher(), "{\n ;\n}\n")); |
| 333 | } |
| 334 | |
| 335 | TEST(OMPStructuredBlock, TestParallelSections) { |
| 336 | const char *Source = |
| 337 | R"( |
| 338 | void test() { |
| 339 | #pragma omp parallel sections |
| 340 | { ; } |
| 341 | })"; |
| 342 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 343 | Source, OMPInnermostStructuredBlockMatcher(), "{\n ;\n}\n")); |
| 344 | } |
| 345 | |
| 346 | TEST(OMPStructuredBlock, TestParallelDirective) { |
| 347 | const char *Source = |
| 348 | R"( |
| 349 | void test() { |
| 350 | #pragma omp parallel |
| 351 | ; |
| 352 | })"; |
| 353 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 354 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 355 | } |
| 356 | |
| 357 | const ast_matchers::internal::VariadicDynCastAllOfMatcher< |
| 358 | OMPExecutableDirective, OMPSectionsDirective> |
| 359 | ompSectionsDirective; |
| 360 | |
| 361 | const ast_matchers::internal::VariadicDynCastAllOfMatcher< |
| 362 | OMPExecutableDirective, OMPSectionDirective> |
| 363 | ompSectionDirective; |
| 364 | |
| 365 | StatementMatcher OMPSectionsDirectiveMatcher() { |
| 366 | return stmt( |
| 367 | isOMPStructuredBlock(), |
| 368 | hasAncestor(ompExecutableDirective(ompSectionsDirective())), |
| 369 | unless(hasAncestor(ompExecutableDirective(ompSectionDirective())))) |
| 370 | .bind("id"); |
| 371 | } |
| 372 | |
| 373 | TEST(OMPStructuredBlock, TestSectionDirective) { |
| 374 | const char *Source = |
| 375 | R"( |
| 376 | void test() { |
| 377 | #pragma omp sections |
| 378 | { |
| 379 | #pragma omp section |
| 380 | ; |
| 381 | } |
| 382 | })"; |
| 383 | ASSERT_TRUE(PrintedOMPStmtMatches(Source, OMPSectionsDirectiveMatcher(), |
| 384 | "{\n" |
| 385 | " #pragma omp section\n" |
| 386 | " ;\n" |
| 387 | "}\n")); |
| 388 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 389 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 390 | } |
| 391 | |
| 392 | TEST(OMPStructuredBlock, TestSections) { |
| 393 | const char *Source = |
| 394 | R"( |
| 395 | void test() { |
| 396 | #pragma omp sections |
| 397 | { ; } |
| 398 | })"; |
| 399 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 400 | Source, OMPInnermostStructuredBlockMatcher(), "{\n ;\n}\n")); |
| 401 | } |
| 402 | |
| 403 | TEST(OMPStructuredBlock, TestSingleDirective) { |
| 404 | const char *Source = |
| 405 | R"( |
| 406 | void test() { |
| 407 | #pragma omp single |
| 408 | ; |
| 409 | })"; |
| 410 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 411 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 412 | } |
| 413 | |
| 414 | TEST(OMPStructuredBlock, TesTargetDataDirective) { |
| 415 | const char *Source = |
| 416 | R"( |
| 417 | void test(int x) { |
| 418 | #pragma omp target data map(x) |
| 419 | ; |
| 420 | })"; |
| 421 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 422 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 423 | } |
| 424 | |
| 425 | TEST(OMPStructuredBlock, TesTargetEnterDataDirective) { |
| 426 | const char *Source = |
| 427 | R"( |
| 428 | void test(int x) { |
| 429 | #pragma omp target enter data map(to : x) |
| 430 | })"; |
| 431 | ASSERT_TRUE( |
| 432 | PrintedOMPStmtMatches(Source, OMPStandaloneDirectiveMatcher(), |
| 433 | "#pragma omp target enter data map(to: x)\n")); |
| 434 | ASSERT_TRUE(NoMatches(Source, OMPInnermostStructuredBlockMatcher())); |
| 435 | } |
| 436 | |
| 437 | TEST(OMPStructuredBlock, TesTargetExitDataDirective) { |
| 438 | const char *Source = |
| 439 | R"( |
| 440 | void test(int x) { |
| 441 | #pragma omp target exit data map(from : x) |
| 442 | })"; |
| 443 | ASSERT_TRUE( |
| 444 | PrintedOMPStmtMatches(Source, OMPStandaloneDirectiveMatcher(), |
| 445 | "#pragma omp target exit data map(from: x)\n")); |
| 446 | ASSERT_TRUE(NoMatches(Source, OMPInnermostStructuredBlockMatcher())); |
| 447 | } |
| 448 | |
| 449 | TEST(OMPStructuredBlock, TestTargetParallelDirective) { |
| 450 | const char *Source = |
| 451 | R"( |
| 452 | void test() { |
| 453 | #pragma omp target parallel |
| 454 | ; |
| 455 | })"; |
| 456 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 457 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 458 | } |
| 459 | |
| 460 | TEST(OMPStructuredBlock, TestTargetTeams) { |
| 461 | const char *Source = |
| 462 | R"( |
| 463 | void test() { |
| 464 | #pragma omp target teams |
| 465 | ; |
| 466 | })"; |
| 467 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 468 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 469 | } |
| 470 | |
| 471 | TEST(OMPStructuredBlock, TestTargetUpdateDirective) { |
| 472 | const char *Source = |
| 473 | R"( |
| 474 | void test(int x) { |
| 475 | #pragma omp target update to(x) |
| 476 | })"; |
| 477 | ASSERT_TRUE(PrintedOMPStmtMatches(Source, OMPStandaloneDirectiveMatcher(), |
| 478 | "#pragma omp target update to(x)\n")); |
| 479 | ASSERT_TRUE(NoMatches(Source, OMPInnermostStructuredBlockMatcher())); |
| 480 | } |
| 481 | |
| 482 | TEST(OMPStructuredBlock, TestTarget) { |
| 483 | const char *Source = |
| 484 | R"( |
| 485 | void test() { |
| 486 | #pragma omp target |
| 487 | ; |
| 488 | })"; |
| 489 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 490 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 491 | } |
| 492 | |
| 493 | TEST(OMPStructuredBlock, TestTask) { |
| 494 | const char *Source = |
| 495 | R"( |
| 496 | void test() { |
| 497 | #pragma omp task |
| 498 | ; |
| 499 | })"; |
| 500 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 501 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 502 | } |
| 503 | |
| 504 | TEST(OMPStructuredBlock, TestTaskgroup) { |
| 505 | const char *Source = |
| 506 | R"( |
| 507 | void test() { |
| 508 | #pragma omp taskgroup |
| 509 | ; |
| 510 | })"; |
| 511 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 512 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 513 | } |
| 514 | |
| 515 | TEST(OMPStructuredBlock, TestTaskwaitDirective) { |
| 516 | const char *Source = |
| 517 | R"( |
| 518 | void test() { |
| 519 | #pragma omp taskwait |
| 520 | })"; |
| 521 | ASSERT_TRUE(PrintedOMPStmtMatches(Source, OMPStandaloneDirectiveMatcher(), |
| 522 | "#pragma omp taskwait\n")); |
| 523 | ASSERT_TRUE(NoMatches(Source, OMPInnermostStructuredBlockMatcher())); |
| 524 | } |
| 525 | |
| 526 | TEST(OMPStructuredBlock, TestTaskyieldDirective) { |
| 527 | const char *Source = |
| 528 | R"( |
| 529 | void test() { |
| 530 | #pragma omp taskyield |
| 531 | })"; |
| 532 | ASSERT_TRUE(PrintedOMPStmtMatches(Source, OMPStandaloneDirectiveMatcher(), |
| 533 | "#pragma omp taskyield\n")); |
| 534 | ASSERT_TRUE(NoMatches(Source, OMPInnermostStructuredBlockMatcher())); |
| 535 | } |
| 536 | |
| 537 | TEST(OMPStructuredBlock, TestTeams) { |
| 538 | const char *Source = |
| 539 | R"( |
| 540 | void test() { |
| 541 | #pragma omp target |
| 542 | #pragma omp teams |
| 543 | ; |
| 544 | })"; |
| 545 | ASSERT_TRUE(PrintedOMPStmtMatches( |
| 546 | Source, OMPInnermostStructuredBlockMatcher(), ";\n")); |
| 547 | } |