[llvm] 4631e7b - [Frontend][OpenMP] Add unit tests for getLeafConstructsOrSelf, NFC (#90110)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 09:46:33 PDT 2024


Author: Krzysztof Parzyszek
Date: 2024-04-30T11:46:30-05:00
New Revision: 4631e7bad6984beca9f790d01d7e07dd47d407bb

URL: https://github.com/llvm/llvm-project/commit/4631e7bad6984beca9f790d01d7e07dd47d407bb
DIFF: https://github.com/llvm/llvm-project/commit/4631e7bad6984beca9f790d01d7e07dd47d407bb.diff

LOG: [Frontend][OpenMP] Add unit tests for getLeafConstructsOrSelf, NFC (#90110)

Added: 
    

Modified: 
    llvm/unittests/Frontend/OpenMPCompositionTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Frontend/OpenMPCompositionTest.cpp b/llvm/unittests/Frontend/OpenMPCompositionTest.cpp
index 920b445427e7e8..0aed247ff1676b 100644
--- a/llvm/unittests/Frontend/OpenMPCompositionTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPCompositionTest.cpp
@@ -23,6 +23,15 @@ TEST(Composition, GetLeafConstructs) {
   ASSERT_EQ(L3, (ArrayRef<Directive>{OMPD_parallel, OMPD_for, OMPD_simd}));
 }
 
+TEST(Composition, GetLeafConstructsOrSelf) {
+  ArrayRef<Directive> L1 = getLeafConstructsOrSelf(OMPD_loop);
+  ASSERT_EQ(L1, (ArrayRef<Directive>{OMPD_loop}));
+  ArrayRef<Directive> L2 = getLeafConstructsOrSelf(OMPD_parallel_for);
+  ASSERT_EQ(L2, (ArrayRef<Directive>{OMPD_parallel, OMPD_for}));
+  ArrayRef<Directive> L3 = getLeafConstructsOrSelf(OMPD_parallel_for_simd);
+  ASSERT_EQ(L3, (ArrayRef<Directive>{OMPD_parallel, OMPD_for, OMPD_simd}));
+}
+
 TEST(Composition, GetCompoundConstruct) {
   Directive C1 =
       getCompoundConstruct({OMPD_target, OMPD_teams, OMPD_distribute});


        


More information about the llvm-commits mailing list