]> granicus.if.org Git - clang/commitdiff
[OPENMP] Exclude service expressions/statements from the list of
authorAlexey Bataev <a.bataev@hotmail.com>
Wed, 25 Jul 2018 17:27:45 +0000 (17:27 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Wed, 25 Jul 2018 17:27:45 +0000 (17:27 +0000)
the children.

Special internal helper expressions/statements for the OpenMP directives
should not be exposed as children, only the main substatement must be
represented as the child.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337941 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/StmtOpenMP.h
test/OpenMP/dump.cpp

index 963c3f5fefe3078ca64442c9546fa666ae4deb74..84a35db938b06b0ad8afab0856694d35ba198cc4 100644 (file)
@@ -252,7 +252,9 @@ public:
     if (!hasAssociatedStmt())
       return child_range(child_iterator(), child_iterator());
     Stmt **ChildStorage = reinterpret_cast<Stmt **>(getClauses().end());
-    return child_range(ChildStorage, ChildStorage + NumChildren);
+    /// Do not mark all the special expression/statements as children, except
+    /// for the associated statement.
+    return child_range(ChildStorage, ChildStorage + 1);
   }
 
   ArrayRef<OMPClause *> clauses() { return getClauses(); }
index 28da82b3b811b6c5668d397611f75dfedf264c1c..812afb72f6801a3c21e85392e8c8e74e9387eec5 100644 (file)
@@ -53,11 +53,11 @@ struct S {
 // CHECK-NEXT: |       |-OMPScheduleClause {{.+}} <col:61, col:79>
 // CHECK-NEXT: |       | `-ImplicitCastExpr {{.+}} <col:78> 'int' <LValueToRValue>
 // CHECK-NEXT: |       |   `-DeclRefExpr {{.+}} <col:78> 'int' lvalue OMPCapturedExpr {{.+}} '.capture_expr.' 'int'
-// CHECK-NEXT: |       |-CapturedStmt {{.+}} <line:41:5, line:42:9>
-// CHECK-NEXT: |       | |-CapturedDecl {{.+}} <<invalid sloc>> <invalid sloc>
-// CHECK-NEXT: |       | | |-ForStmt {{.+}} <line:41:5, line:42:9>
-// CHECK:      |       | | | `-UnaryOperator {{.+}} <line:42:7, col:9> 'int' lvalue prefix '++'
-// CHECK-NEXT: |       | | |   `-DeclRefExpr {{.+}} <col:9> 'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &'
+// CHECK-NEXT: |       `-CapturedStmt {{.+}} <line:41:5, line:42:9>
+// CHECK-NEXT: |         |-CapturedDecl {{.+}} <<invalid sloc>> <invalid sloc>
+// CHECK-NEXT: |         | |-ForStmt {{.+}} <line:41:5, line:42:9>
+// CHECK:      |         | | `-UnaryOperator {{.+}} <line:42:7, col:9> 'int' lvalue prefix '++'
+// CHECK-NEXT: |         | |   `-DeclRefExpr {{.+}} <col:9> 'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &'
 
 #pragma omp declare simd
 #pragma omp declare simd inbranch