File tree Expand file tree Collapse file tree 1 file changed +7
-25
lines changed Expand file tree Collapse file tree 1 file changed +7
-25
lines changed Original file line number Diff line number Diff line change @@ -457,34 +457,16 @@ reverse_children::reverse_children(Stmt *S) {
457
457
return ;
458
458
}
459
459
case Stmt::AttributedStmtClass: {
460
- AttributedStmt *attrStmt = cast<AttributedStmt>(S);
461
- assert (attrStmt);
460
+ auto Attrs = cast<AttributedStmt>(S)->getAttrs ();
462
461
463
- {
464
- // for an attributed stmt, the "children()" returns only the NullStmt
465
- // (;) but semantically the "children" are supposed to be the
466
- // expressions _within_ i.e. the two square brackets i.e. [[ HERE ]]
467
- // so we add the subexpressions first, _then_ add the "children"
468
-
469
- for (const Attr *attr : attrStmt->getAttrs ()) {
470
-
471
- // i.e. one `assume()`
472
- CXXAssumeAttr const *assumeAttr = llvm::dyn_cast<CXXAssumeAttr>(attr);
473
- if (!assumeAttr) {
474
- continue ;
475
- }
476
- // Only handles [[ assume(<assumption>) ]] right now
477
- Expr *assumption = assumeAttr->getAssumption ();
478
- childrenBuf.push_back (assumption);
479
- }
480
-
481
- // children() for an AttributedStmt is NullStmt(;)
482
- llvm::append_range (childrenBuf, attrStmt->children ());
483
-
484
- // This needs to be done *after* childrenBuf has been populated.
462
+ // We only handle `[[assume(...)]]` attributes for now.
463
+ if (const auto *A = getSpecificAttr<CXXAssumeAttr>(Attrs)) {
464
+ childrenBuf.push_back (A->getAssumption ());
465
+ llvm::append_range (childrenBuf, S->children ());
485
466
children = childrenBuf;
467
+ return ;
486
468
}
487
- return ;
469
+ break ;
488
470
}
489
471
default :
490
472
break ;
You can’t perform that action at this time.
0 commit comments