-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[AST] Construct iterator_range with the conversion constructor (NFC) #169004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_20251120_iterator_range_container
Nov 21, 2025
Merged
[AST] Construct iterator_range with the conversion constructor (NFC) #169004
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_20251120_iterator_range_container
Nov 21, 2025
+58
−117
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This patch simplifies iterator_range construction with the conversion constructor.
Member
|
@llvm/pr-subscribers-clang Author: Kazu Hirata (kazutakahirata) ChangesThis patch simplifies iterator_range construction with the conversion Patch is 21.81 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/169004.diff 6 Files Affected:
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index d78c7b6363b5d..9435ab069a520 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -978,8 +978,7 @@ class MSPropertyRefExpr : public Expr {
}
const_child_range children() const {
- auto Children = const_cast<MSPropertyRefExpr *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<MSPropertyRefExpr *>(this)->children();
}
static bool classof(const Stmt *T) {
@@ -1741,8 +1740,7 @@ class CXXConstructExpr : public Expr {
}
const_child_range children() const {
- auto Children = const_cast<CXXConstructExpr *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<CXXConstructExpr *>(this)->children();
}
};
diff --git a/clang/include/clang/AST/ExprObjC.h b/clang/include/clang/AST/ExprObjC.h
index b9232305f036a..807061898384e 100644
--- a/clang/include/clang/AST/ExprObjC.h
+++ b/clang/include/clang/AST/ExprObjC.h
@@ -247,8 +247,7 @@ class ObjCArrayLiteral final
}
const_child_range children() const {
- auto Children = const_cast<ObjCArrayLiteral *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<ObjCArrayLiteral *>(this)->children();
}
static bool classof(const Stmt *T) {
@@ -394,8 +393,7 @@ class ObjCDictionaryLiteral final
}
const_child_range children() const {
- auto Children = const_cast<ObjCDictionaryLiteral *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<ObjCDictionaryLiteral *>(this)->children();
}
static bool classof(const Stmt *T) {
@@ -790,8 +788,7 @@ class ObjCPropertyRefExpr : public Expr {
}
const_child_range children() const {
- auto Children = const_cast<ObjCPropertyRefExpr *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<ObjCPropertyRefExpr *>(this)->children();
}
static bool classof(const Stmt *T) {
diff --git a/clang/include/clang/AST/OpenACCClause.h b/clang/include/clang/AST/OpenACCClause.h
index 83f2b18435633..0b4226d5c0c24 100644
--- a/clang/include/clang/AST/OpenACCClause.h
+++ b/clang/include/clang/AST/OpenACCClause.h
@@ -51,8 +51,7 @@ class OpenACCClause {
child_range children();
const_child_range children() const {
- auto Children = const_cast<OpenACCClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OpenACCClause *>(this)->children();
}
virtual ~OpenACCClause() = default;
@@ -474,8 +473,7 @@ class OpenACCSelfClause final
}
const_child_range children() const {
- child_range Children = const_cast<OpenACCSelfClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OpenACCSelfClause *>(this)->children();
}
static OpenACCSelfClause *Create(const ASTContext &C, SourceLocation BeginLoc,
@@ -523,9 +521,7 @@ class OpenACCClauseWithExprs : public OpenACCClauseWithParams {
}
const_child_range children() const {
- child_range Children =
- const_cast<OpenACCClauseWithExprs *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OpenACCClauseWithExprs *>(this)->children();
}
};
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index 3296fbf409552..7972d05bedbf7 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -91,8 +91,7 @@ class OMPClause {
child_range children();
const_child_range children() const {
- auto Children = const_cast<OMPClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPClause *>(this)->children();
}
/// Get the iterator range for the expressions used in the clauses. Used
@@ -100,8 +99,7 @@ class OMPClause {
/// runtime before entering the construct.
child_range used_children();
const_child_range used_children() const {
- auto Children = const_cast<OMPClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPClause *>(this)->children();
}
static bool classof(const OMPClause *) { return true; }
@@ -650,8 +648,7 @@ class OMPAllocateClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPAllocateClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPAllocateClause *>(this)->children();
}
child_range used_children() {
@@ -758,8 +755,7 @@ class OMPIfClause : public OMPClause, public OMPClauseWithPreInit {
child_range used_children();
const_child_range used_children() const {
- auto Children = const_cast<OMPIfClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPIfClause *>(this)->used_children();
}
static bool classof(const OMPClause *T) {
@@ -808,8 +804,7 @@ class OMPFinalClause final
child_range used_children();
const_child_range used_children() const {
- auto Children = const_cast<OMPFinalClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPFinalClause *>(this)->used_children();
}
};
/// This represents 'num_threads' clause in the '#pragma omp ...'
@@ -2256,8 +2251,7 @@ class OMPScheduleClause : public OMPClause, public OMPClauseWithPreInit {
}
const_child_range children() const {
- auto Children = const_cast<OMPScheduleClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPScheduleClause *>(this)->children();
}
child_range used_children() {
@@ -2426,8 +2420,7 @@ class OMPNowaitClause final : public OMPClause {
child_range used_children();
const_child_range used_children() const {
- auto Children = const_cast<OMPNowaitClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPNowaitClause *>(this)->used_children();
}
static bool classof(const OMPClause *T) {
@@ -3427,8 +3420,7 @@ class OMPPrivateClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPPrivateClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPPrivateClause *>(this)->children();
}
child_range used_children() {
@@ -3566,8 +3558,7 @@ class OMPFirstprivateClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPFirstprivateClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPFirstprivateClause *>(this)->children();
}
child_range used_children() {
@@ -3575,8 +3566,7 @@ class OMPFirstprivateClause final
reinterpret_cast<Stmt **>(varlist_end()));
}
const_child_range used_children() const {
- auto Children = const_cast<OMPFirstprivateClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPFirstprivateClause *>(this)->used_children();
}
static bool classof(const OMPClause *T) {
@@ -3807,8 +3797,7 @@ class OMPLastprivateClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPLastprivateClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPLastprivateClause *>(this)->children();
}
child_range used_children() {
@@ -3879,8 +3868,7 @@ class OMPSharedClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPSharedClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPSharedClause *>(this)->children();
}
child_range used_children() {
@@ -4270,8 +4258,7 @@ class OMPReductionClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPReductionClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPReductionClause *>(this)->children();
}
child_range used_children() {
@@ -4279,8 +4266,7 @@ class OMPReductionClause final
reinterpret_cast<Stmt **>(varlist_end()));
}
const_child_range used_children() const {
- auto Children = const_cast<OMPReductionClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPReductionClause *>(this)->used_children();
}
static bool classof(const OMPClause *T) {
@@ -4504,8 +4490,7 @@ class OMPTaskReductionClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPTaskReductionClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPTaskReductionClause *>(this)->children();
}
child_range used_children() {
@@ -4759,8 +4744,7 @@ class OMPInReductionClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPInReductionClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPInReductionClause *>(this)->children();
}
child_range used_children() {
@@ -5049,15 +5033,13 @@ class OMPLinearClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPLinearClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPLinearClause *>(this)->children();
}
child_range used_children();
const_child_range used_children() const {
- auto Children = const_cast<OMPLinearClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPLinearClause *>(this)->used_children();
}
static bool classof(const OMPClause *T) {
@@ -5148,8 +5130,7 @@ class OMPAlignedClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPAlignedClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPAlignedClause *>(this)->children();
}
child_range used_children() {
@@ -5324,8 +5305,7 @@ class OMPCopyinClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPCopyinClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPCopyinClause *>(this)->children();
}
child_range used_children() {
@@ -5488,8 +5468,7 @@ class OMPCopyprivateClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPCopyprivateClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPCopyprivateClause *>(this)->children();
}
child_range used_children() {
@@ -5565,8 +5544,7 @@ class OMPFlushClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPFlushClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPFlushClause *>(this)->children();
}
child_range used_children() {
@@ -5652,8 +5630,7 @@ class OMPDepobjClause final : public OMPClause {
}
const_child_range children() const {
- auto Children = const_cast<OMPDepobjClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPDepobjClause *>(this)->children();
}
child_range used_children() {
@@ -5806,8 +5783,7 @@ class OMPDependClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPDependClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPDependClause *>(this)->children();
}
child_range used_children() {
@@ -6954,8 +6930,7 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
}
const_child_range children() const {
- auto Children = const_cast<OMPMapClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPMapClause *>(this)->children();
}
child_range used_children() {
@@ -6965,8 +6940,7 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
return child_range(child_iterator(), child_iterator());
}
const_child_range used_children() const {
- auto Children = const_cast<OMPMapClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPMapClause *>(this)->used_children();
}
@@ -7052,8 +7026,7 @@ class OMPNumTeamsClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPNumTeamsClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPNumTeamsClause *>(this)->children();
}
child_range used_children() {
@@ -7146,8 +7119,7 @@ class OMPThreadLimitClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPThreadLimitClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPThreadLimitClause *>(this)->children();
}
child_range used_children() {
@@ -7227,8 +7199,7 @@ class OMPPriorityClause : public OMPClause, public OMPClauseWithPreInit {
child_range used_children();
const_child_range used_children() const {
- auto Children = const_cast<OMPPriorityClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPPriorityClause *>(this)->used_children();
}
static bool classof(const OMPClause *T) {
@@ -7319,8 +7290,7 @@ class OMPGrainsizeClause : public OMPClause, public OMPClauseWithPreInit {
child_range used_children();
const_child_range used_children() const {
- auto Children = const_cast<OMPGrainsizeClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPGrainsizeClause *>(this)->used_children();
}
static bool classof(const OMPClause *T) {
@@ -7451,8 +7421,7 @@ class OMPNumTasksClause : public OMPClause, public OMPClauseWithPreInit {
child_range used_children();
const_child_range used_children() const {
- auto Children = const_cast<OMPNumTasksClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPNumTasksClause *>(this)->used_children();
}
static bool classof(const OMPClause *T) {
@@ -7626,8 +7595,7 @@ class OMPDistScheduleClause : public OMPClause, public OMPClauseWithPreInit {
}
const_child_range children() const {
- auto Children = const_cast<OMPDistScheduleClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPDistScheduleClause *>(this)->children();
}
child_range used_children() {
@@ -7940,8 +7908,7 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
}
const_child_range children() const {
- auto Children = const_cast<OMPToClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPToClause *>(this)->children();
}
child_range used_children() {
@@ -8140,8 +8107,7 @@ class OMPFromClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPFromClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPFromClause *>(this)->children();
}
child_range used_children() {
@@ -8304,8 +8270,7 @@ class OMPUseDevicePtrClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPUseDevicePtrClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPUseDevicePtrClause *>(this)->children();
}
child_range used_children() {
@@ -8408,8 +8373,7 @@ class OMPUseDeviceAddrClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPUseDeviceAddrClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPUseDeviceAddrClause *>(this)->children();
}
child_range used_children() {
@@ -8511,8 +8475,7 @@ class OMPIsDevicePtrClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPIsDevicePtrClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPIsDevicePtrClause *>(this)->children();
}
child_range used_children() {
@@ -8615,8 +8578,7 @@ class OMPHasDeviceAddrClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPHasDeviceAddrClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPHasDeviceAddrClause *>(this)->children();
}
child_range used_children() {
@@ -8702,8 +8664,7 @@ class OMPNontemporalClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPNontemporalClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPNontemporalClause *>(this)->children();
}
child_range private_refs() {
@@ -8712,8 +8673,7 @@ class OMPNontemporalClause final
}
const_child_range private_refs() const {
- auto Children = const_cast<OMPNontemporalClause *>(this)->private_refs();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPNontemporalClause *>(this)->private_refs();
}
child_range used_children() {
@@ -8923,8 +8883,7 @@ class OMPInitClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPInitClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPInitClause *>(this)->children();
}
child_range used_children() {
@@ -9156,8 +9115,7 @@ class OMPNovariantsClause final
child_range used_children();
const_child_range used_children() const {
- auto Children = const_cast<OMPNovariantsClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPNovariantsClause *>(this)->used_children();
}
};
@@ -9202,8 +9160,7 @@ class OMPNocontextClause final
child_range used_children();
const_child_range used_children() const {
- auto Children = const_cast<OMPNocontextClause *>(this)->used_children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPNocontextClause *>(this)->used_children();
}
};
@@ -9297,8 +9254,7 @@ class OMPInclusiveClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPInclusiveClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPInclusiveClause *>(this)->children();
}
child_range used_children() {
@@ -9371,8 +9327,7 @@ class OMPExclusiveClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPExclusiveClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPExclusiveClause *>(this)->children();
}
child_range used_children() {
@@ -9593,8 +9548,7 @@ class OMPAffinityClause final
}
const_child_range children() const {
- auto Children = const_cast<OMPAffinityClause *>(this)->children();
- return const_child_range(Children.begin(), Children.end());
+ return const_cast<OMPAffinityClause *>(this)->children();
}
child_range used_children() {
@@ -10198,8 +10152,7...
[truncated]
|
🐧 Linux x64 Test Results
|
tgymnich
approved these changes
Nov 21, 2025
kuhar
approved these changes
Nov 21, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
clang:openmp
OpenMP related changes to Clang
clang
Clang issues not falling into any other category
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch simplifies iterator_range construction with the conversion
constructor.