diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2018-07-25 17:27:45 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-07-25 17:27:45 +0000 |
| commit | a36aec9f831b5b83f7cf6e5e22da67141747ad50 (patch) | |
| tree | 136d2fca2e50152d63b8f9cb991ddd2a17736303 | |
| parent | 45a607e5630379dfa20ecda0297fe3c57f211b4d (diff) | |
| download | bcm5719-llvm-a36aec9f831b5b83f7cf6e5e22da67141747ad50.tar.gz bcm5719-llvm-a36aec9f831b5b83f7cf6e5e22da67141747ad50.zip | |
[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.
llvm-svn: 337941
| -rw-r--r-- | clang/include/clang/AST/StmtOpenMP.h | 4 | ||||
| -rw-r--r-- | clang/test/OpenMP/dump.cpp | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h index 963c3f5fefe..84a35db938b 100644 --- a/clang/include/clang/AST/StmtOpenMP.h +++ b/clang/include/clang/AST/StmtOpenMP.h @@ -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(); } diff --git a/clang/test/OpenMP/dump.cpp b/clang/test/OpenMP/dump.cpp index 28da82b3b81..812afb72f68 100644 --- a/clang/test/OpenMP/dump.cpp +++ b/clang/test/OpenMP/dump.cpp @@ -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 |

