r337941 - [OPENMP] Exclude service expressions/statements from the list of

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 25 10:27:45 PDT 2018


Author: abataev
Date: Wed Jul 25 10:27:45 2018
New Revision: 337941

URL: http://llvm.org/viewvc/llvm-project?rev=337941&view=rev
Log:
[OPENMP] Exclude service expressions/statements from the list of
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.

Modified:
    cfe/trunk/include/clang/AST/StmtOpenMP.h
    cfe/trunk/test/OpenMP/dump.cpp

Modified: cfe/trunk/include/clang/AST/StmtOpenMP.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=337941&r1=337940&r2=337941&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/StmtOpenMP.h (original)
+++ cfe/trunk/include/clang/AST/StmtOpenMP.h Wed Jul 25 10:27:45 2018
@@ -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(); }

Modified: cfe/trunk/test/OpenMP/dump.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/dump.cpp?rev=337941&r1=337940&r2=337941&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/dump.cpp (original)
+++ cfe/trunk/test/OpenMP/dump.cpp Wed Jul 25 10:27:45 2018
@@ -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




More information about the cfe-commits mailing list