[clang] 93184a8 - Remove unused parameter from CXXRecordDecl::forallBases [NFC]
Aaron Puchert via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 29 05:24:32 PST 2020
Author: Aaron Puchert
Date: 2020-02-29T14:23:44+01:00
New Revision: 93184a8eda272c65308906836b47cbf209de779e
URL: https://github.com/llvm/llvm-project/commit/93184a8eda272c65308906836b47cbf209de779e
DIFF: https://github.com/llvm/llvm-project/commit/93184a8eda272c65308906836b47cbf209de779e.diff
LOG: 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
Added:
Modified:
clang/include/clang/AST/DeclCXX.h
clang/lib/AST/CXXInheritance.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h
index 6d3a833b5037..23b1adb26603 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -1517,14 +1517,8 @@ class CXXRecordDecl : public RecordDecl {
/// returns false if the class has non-computable base classes.
///
/// \param BaseMatches Callback invoked for each (direct or indirect) base
- /// class of this type, or if \p AllowShortCircuit is true then until a call
- /// returns false.
- ///
- /// \param AllowShortCircuit if false, forces the callback to be called
- /// for every base class, even if a dependent or non-matching base was
- /// found.
- bool forallBases(ForallBasesCallback BaseMatches,
- bool AllowShortCircuit = true) const;
+ /// class of this type until a call returns false.
+ bool forallBases(ForallBasesCallback BaseMatches) const;
/// Function type used by lookupInBases() to determine whether a
/// specific base class subobject matches the lookup criteria.
diff --git a/clang/lib/AST/CXXInheritance.cpp b/clang/lib/AST/CXXInheritance.cpp
index 0377bd324cb6..8af97119e3cf 100644
--- a/clang/lib/AST/CXXInheritance.cpp
+++ b/clang/lib/AST/CXXInheritance.cpp
@@ -147,37 +147,27 @@ CXXRecordDecl::isCurrentInstantiation(const DeclContext *CurContext) const {
return false;
}
-bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches,
- bool AllowShortCircuit) const {
+bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches) const {
SmallVector<const CXXRecordDecl*, 8> Queue;
const CXXRecordDecl *Record = this;
- bool AllMatches = true;
while (true) {
for (const auto &I : Record->bases()) {
const RecordType *Ty = I.getType()->getAs<RecordType>();
- if (!Ty) {
- if (AllowShortCircuit) return false;
- AllMatches = false;
- continue;
- }
+ if (!Ty)
+ return false;
CXXRecordDecl *Base =
cast_or_null<CXXRecordDecl>(Ty->getDecl()->getDefinition());
if (!Base ||
(Base->isDependentContext() &&
!Base->isCurrentInstantiation(Record))) {
- if (AllowShortCircuit) return false;
- AllMatches = false;
- continue;
+ return false;
}
Queue.push_back(Base);
- if (!BaseMatches(Base)) {
- if (AllowShortCircuit) return false;
- AllMatches = false;
- continue;
- }
+ if (!BaseMatches(Base))
+ return false;
}
if (Queue.empty())
@@ -185,7 +175,7 @@ bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches,
Record = Queue.pop_back_val(); // not actually a queue.
}
- return AllMatches;
+ return true;
}
bool CXXBasePaths::lookupInBases(ASTContext &Context,
More information about the cfe-commits
mailing list