[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337941 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Bataev 2018-07-25 17:27:45 +00:00
parent 3334e9178a
commit 9280a04746
2 changed files with 8 additions and 6 deletions

View 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(); }

View 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