Skip to content

Commit 1f9ce29

Browse files
committed
addressed review comments
1 parent 333f924 commit 1f9ce29

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

clang/include/clang/AST/OpenMPClause.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2332,10 +2332,16 @@ class OMPNowaitClause final : public OMPClause {
23322332
/// Returns condition.
23332333
Expr *getCondition() const { return cast_or_null<Expr>(Condition); }
23342334

2335-
child_range children() { return child_range(&Condition, &Condition + 1); }
2335+
child_range children() {
2336+
if (Condition)
2337+
return child_range(&Condition, &Condition + 1);
2338+
return child_range(child_iterator(), child_iterator());
2339+
}
23362340

23372341
const_child_range children() const {
2338-
return const_child_range(&Condition, &Condition + 1);
2342+
if (Condition)
2343+
return const_child_range(&Condition, &Condition + 1);
2344+
return const_child_range(const_child_iterator(), const_child_iterator());
23392345
}
23402346

23412347
child_range used_children();

clang/lib/AST/OpenMPClause.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,7 @@ OMPClause::child_range OMPIfClause::used_children() {
312312
OMPClause::child_range OMPNowaitClause::used_children() {
313313
if (Condition)
314314
return child_range(&Condition, &Condition + 1);
315-
Stmt *Null = nullptr;
316-
return child_range(&Null, &Null);
315+
return children();
317316
}
318317

319318
OMPClause::child_range OMPGrainsizeClause::used_children() {

clang/test/OpenMP/nowait_ast_print.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ void nowait() {
1919

2020
// DUMP: OMPTargetDirective
2121
// DUMP-NEXT: OMPNowaitClause
22-
// DUMP-NEXT: <<<NULL>>>
2322
// PRINT: #pragma omp target nowait
2423
#pragma omp target nowait
2524
{

0 commit comments

Comments
 (0)