Skip to content

Commit 93184a8

Browse files
committed
Remove unused parameter from CXXRecordDecl::forallBases [NFC]
Summary: Apparently all users of the function were fine with short-circuiting and none cared to override the default argument. Reviewers: aaron.ballman, rsmith Reviewed By: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D75319
1 parent 99b86d7 commit 93184a8

File tree

2 files changed

+9
-25
lines changed

2 files changed

+9
-25
lines changed

clang/include/clang/AST/DeclCXX.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,14 +1517,8 @@ class CXXRecordDecl : public RecordDecl {
15171517
/// returns false if the class has non-computable base classes.
15181518
///
15191519
/// \param BaseMatches Callback invoked for each (direct or indirect) base
1520-
/// class of this type, or if \p AllowShortCircuit is true then until a call
1521-
/// returns false.
1522-
///
1523-
/// \param AllowShortCircuit if false, forces the callback to be called
1524-
/// for every base class, even if a dependent or non-matching base was
1525-
/// found.
1526-
bool forallBases(ForallBasesCallback BaseMatches,
1527-
bool AllowShortCircuit = true) const;
1520+
/// class of this type until a call returns false.
1521+
bool forallBases(ForallBasesCallback BaseMatches) const;
15281522

15291523
/// Function type used by lookupInBases() to determine whether a
15301524
/// specific base class subobject matches the lookup criteria.

clang/lib/AST/CXXInheritance.cpp

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -147,45 +147,35 @@ CXXRecordDecl::isCurrentInstantiation(const DeclContext *CurContext) const {
147147
return false;
148148
}
149149

150-
bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches,
151-
bool AllowShortCircuit) const {
150+
bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches) const {
152151
SmallVector<const CXXRecordDecl*, 8> Queue;
153152

154153
const CXXRecordDecl *Record = this;
155-
bool AllMatches = true;
156154
while (true) {
157155
for (const auto &I : Record->bases()) {
158156
const RecordType *Ty = I.getType()->getAs<RecordType>();
159-
if (!Ty) {
160-
if (AllowShortCircuit) return false;
161-
AllMatches = false;
162-
continue;
163-
}
157+
if (!Ty)
158+
return false;
164159

165160
CXXRecordDecl *Base =
166161
cast_or_null<CXXRecordDecl>(Ty->getDecl()->getDefinition());
167162
if (!Base ||
168163
(Base->isDependentContext() &&
169164
!Base->isCurrentInstantiation(Record))) {
170-
if (AllowShortCircuit) return false;
171-
AllMatches = false;
172-
continue;
165+
return false;
173166
}
174167

175168
Queue.push_back(Base);
176-
if (!BaseMatches(Base)) {
177-
if (AllowShortCircuit) return false;
178-
AllMatches = false;
179-
continue;
180-
}
169+
if (!BaseMatches(Base))
170+
return false;
181171
}
182172

183173
if (Queue.empty())
184174
break;
185175
Record = Queue.pop_back_val(); // not actually a queue.
186176
}
187177

188-
return AllMatches;
178+
return true;
189179
}
190180

191181
bool CXXBasePaths::lookupInBases(ASTContext &Context,

0 commit comments

Comments
 (0)