Skip to content

Commit 4a14d35

Browse files
kazutakahirataaadeshps-mcw
authored andcommitted
[AST] Construct iterator_range with the conversion constructor (NFC) (llvm#169004)
This patch simplifies iterator_range construction with the conversion constructor.
1 parent 62bec98 commit 4a14d35

File tree

6 files changed

+58
-117
lines changed

6 files changed

+58
-117
lines changed

clang/include/clang/AST/ExprCXX.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -978,8 +978,7 @@ class MSPropertyRefExpr : public Expr {
978978
}
979979

980980
const_child_range children() const {
981-
auto Children = const_cast<MSPropertyRefExpr *>(this)->children();
982-
return const_child_range(Children.begin(), Children.end());
981+
return const_cast<MSPropertyRefExpr *>(this)->children();
983982
}
984983

985984
static bool classof(const Stmt *T) {
@@ -1741,8 +1740,7 @@ class CXXConstructExpr : public Expr {
17411740
}
17421741

17431742
const_child_range children() const {
1744-
auto Children = const_cast<CXXConstructExpr *>(this)->children();
1745-
return const_child_range(Children.begin(), Children.end());
1743+
return const_cast<CXXConstructExpr *>(this)->children();
17461744
}
17471745
};
17481746

clang/include/clang/AST/ExprObjC.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ class ObjCArrayLiteral final
247247
}
248248

249249
const_child_range children() const {
250-
auto Children = const_cast<ObjCArrayLiteral *>(this)->children();
251-
return const_child_range(Children.begin(), Children.end());
250+
return const_cast<ObjCArrayLiteral *>(this)->children();
252251
}
253252

254253
static bool classof(const Stmt *T) {
@@ -394,8 +393,7 @@ class ObjCDictionaryLiteral final
394393
}
395394

396395
const_child_range children() const {
397-
auto Children = const_cast<ObjCDictionaryLiteral *>(this)->children();
398-
return const_child_range(Children.begin(), Children.end());
396+
return const_cast<ObjCDictionaryLiteral *>(this)->children();
399397
}
400398

401399
static bool classof(const Stmt *T) {
@@ -790,8 +788,7 @@ class ObjCPropertyRefExpr : public Expr {
790788
}
791789

792790
const_child_range children() const {
793-
auto Children = const_cast<ObjCPropertyRefExpr *>(this)->children();
794-
return const_child_range(Children.begin(), Children.end());
791+
return const_cast<ObjCPropertyRefExpr *>(this)->children();
795792
}
796793

797794
static bool classof(const Stmt *T) {

clang/include/clang/AST/OpenACCClause.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ class OpenACCClause {
5151

5252
child_range children();
5353
const_child_range children() const {
54-
auto Children = const_cast<OpenACCClause *>(this)->children();
55-
return const_child_range(Children.begin(), Children.end());
54+
return const_cast<OpenACCClause *>(this)->children();
5655
}
5756

5857
virtual ~OpenACCClause() = default;
@@ -474,8 +473,7 @@ class OpenACCSelfClause final
474473
}
475474

476475
const_child_range children() const {
477-
child_range Children = const_cast<OpenACCSelfClause *>(this)->children();
478-
return const_child_range(Children.begin(), Children.end());
476+
return const_cast<OpenACCSelfClause *>(this)->children();
479477
}
480478

481479
static OpenACCSelfClause *Create(const ASTContext &C, SourceLocation BeginLoc,
@@ -523,9 +521,7 @@ class OpenACCClauseWithExprs : public OpenACCClauseWithParams {
523521
}
524522

525523
const_child_range children() const {
526-
child_range Children =
527-
const_cast<OpenACCClauseWithExprs *>(this)->children();
528-
return const_child_range(Children.begin(), Children.end());
524+
return const_cast<OpenACCClauseWithExprs *>(this)->children();
529525
}
530526
};
531527

0 commit comments

Comments
 (0)