From: Alexey Bataev Date: Wed, 25 Jul 2018 17:27:45 +0000 (+0000) Subject: [OPENMP] Exclude service expressions/statements from the list of X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9280a04746a98ebc1d45917ae030be9c06fa4f15;p=clang [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 --- diff --git a/include/clang/AST/StmtOpenMP.h b/include/clang/AST/StmtOpenMP.h index 963c3f5fef..84a35db938 100644 --- a/include/clang/AST/StmtOpenMP.h +++ b/include/clang/AST/StmtOpenMP.h @@ -252,7 +252,9 @@ public: if (!hasAssociatedStmt()) return child_range(child_iterator(), child_iterator()); Stmt **ChildStorage = reinterpret_cast(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 clauses() { return getClauses(); } diff --git a/test/OpenMP/dump.cpp b/test/OpenMP/dump.cpp index 28da82b3b8..812afb72f6 100644 --- a/test/OpenMP/dump.cpp +++ b/test/OpenMP/dump.cpp @@ -53,11 +53,11 @@ struct S { // CHECK-NEXT: | |-OMPScheduleClause {{.+}} // CHECK-NEXT: | | `-ImplicitCastExpr {{.+}} 'int' // CHECK-NEXT: | | `-DeclRefExpr {{.+}} 'int' lvalue OMPCapturedExpr {{.+}} '.capture_expr.' 'int' -// CHECK-NEXT: | |-CapturedStmt {{.+}} -// CHECK-NEXT: | | |-CapturedDecl {{.+}} <> -// CHECK-NEXT: | | | |-ForStmt {{.+}} -// CHECK: | | | | `-UnaryOperator {{.+}} 'int' lvalue prefix '++' -// CHECK-NEXT: | | | | `-DeclRefExpr {{.+}} 'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &' +// CHECK-NEXT: | `-CapturedStmt {{.+}} +// CHECK-NEXT: | |-CapturedDecl {{.+}} <> +// CHECK-NEXT: | | |-ForStmt {{.+}} +// CHECK: | | | `-UnaryOperator {{.+}} 'int' lvalue prefix '++' +// CHECK-NEXT: | | | `-DeclRefExpr {{.+}} 'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &' #pragma omp declare simd #pragma omp declare simd inbranch