[PATCH] D75319: Remove unused parameter from CXXRecordDecl::forallBases [NFC]

2020-02-29 Thread Aaron Puchert via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG93184a8eda27: Remove unused parameter from 
CXXRecordDecl::forallBases [NFC] (authored by aaronpuchert).

Changed prior to commit:
  https://reviews.llvm.org/D75319?vs=247136=247442#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75319/new/

https://reviews.llvm.org/D75319

Files:
  clang/include/clang/AST/DeclCXX.h
  clang/lib/AST/CXXInheritance.cpp


Index: clang/lib/AST/CXXInheritance.cpp
===
--- clang/lib/AST/CXXInheritance.cpp
+++ clang/lib/AST/CXXInheritance.cpp
@@ -147,37 +147,27 @@
   return false;
 }
 
-bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches,
-bool AllowShortCircuit) const {
+bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches) const {
   SmallVector Queue;
 
   const CXXRecordDecl *Record = this;
-  bool AllMatches = true;
   while (true) {
 for (const auto  : Record->bases()) {
   const RecordType *Ty = I.getType()->getAs();
-  if (!Ty) {
-if (AllowShortCircuit) return false;
-AllMatches = false;
-continue;
-  }
+  if (!Ty)
+return false;
 
   CXXRecordDecl *Base =
 cast_or_null(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 @@
 Record = Queue.pop_back_val(); // not actually a queue.
   }
 
-  return AllMatches;
+  return true;
 }
 
 bool CXXBasePaths::lookupInBases(ASTContext ,
Index: clang/include/clang/AST/DeclCXX.h
===
--- clang/include/clang/AST/DeclCXX.h
+++ clang/include/clang/AST/DeclCXX.h
@@ -1517,14 +1517,8 @@
   /// 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.


Index: clang/lib/AST/CXXInheritance.cpp
===
--- clang/lib/AST/CXXInheritance.cpp
+++ clang/lib/AST/CXXInheritance.cpp
@@ -147,37 +147,27 @@
   return false;
 }
 
-bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches,
-bool AllowShortCircuit) const {
+bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches) const {
   SmallVector Queue;
 
   const CXXRecordDecl *Record = this;
-  bool AllMatches = true;
   while (true) {
 for (const auto  : Record->bases()) {
   const RecordType *Ty = I.getType()->getAs();
-  if (!Ty) {
-if (AllowShortCircuit) return false;
-AllMatches = false;
-continue;
-  }
+  if (!Ty)
+return false;
 
   CXXRecordDecl *Base =
 cast_or_null(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 @@
 Record = Queue.pop_back_val(); // not actually a queue.
   }
 
-  return AllMatches;
+  return true;
 }
 
 bool CXXBasePaths::lookupInBases(ASTContext ,
Index: clang/include/clang/AST/DeclCXX.h
===
--- clang/include/clang/AST/DeclCXX.h
+++ clang/include/clang/AST/DeclCXX.h
@@ -1517,14 +1517,8 @@
   /// returns false if the class has non-computable base classes.
   ///
   /// \param BaseMatches Callback invoked for each (direct or indirect) base
-  /// class of this type, 

[PATCH] D75319: Remove unused parameter from CXXRecordDecl::forallBases [NFC]

2020-02-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75319/new/

https://reviews.llvm.org/D75319



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D75319: Remove unused parameter from CXXRecordDecl::forallBases

2020-02-27 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert created this revision.
aaronpuchert added reviewers: aaron.ballman, rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Apparently all users of the function were fine with short-circuiting
and none cared to override the default argument.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75319

Files:
  clang/include/clang/AST/DeclCXX.h
  clang/lib/AST/CXXInheritance.cpp


Index: clang/lib/AST/CXXInheritance.cpp
===
--- clang/lib/AST/CXXInheritance.cpp
+++ clang/lib/AST/CXXInheritance.cpp
@@ -147,37 +147,27 @@
   return false;
 }
 
-bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches,
-bool AllowShortCircuit) const {
+bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches) const {
   SmallVector Queue;
 
   const CXXRecordDecl *Record = this;
-  bool AllMatches = true;
   while (true) {
 for (const auto  : Record->bases()) {
   const RecordType *Ty = I.getType()->getAs();
-  if (!Ty) {
-if (AllowShortCircuit) return false;
-AllMatches = false;
-continue;
-  }
+  if (!Ty)
+return false;
 
   CXXRecordDecl *Base =
 cast_or_null(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 @@
 Record = Queue.pop_back_val(); // not actually a queue.
   }
 
-  return AllMatches;
+  return true;
 }
 
 bool CXXBasePaths::lookupInBases(ASTContext ,
Index: clang/include/clang/AST/DeclCXX.h
===
--- clang/include/clang/AST/DeclCXX.h
+++ clang/include/clang/AST/DeclCXX.h
@@ -1519,12 +1519,7 @@
   /// \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;
+  bool forallBases(ForallBasesCallback BaseMatches) const;
 
   /// Function type used by lookupInBases() to determine whether a
   /// specific base class subobject matches the lookup criteria.


Index: clang/lib/AST/CXXInheritance.cpp
===
--- clang/lib/AST/CXXInheritance.cpp
+++ clang/lib/AST/CXXInheritance.cpp
@@ -147,37 +147,27 @@
   return false;
 }
 
-bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches,
-bool AllowShortCircuit) const {
+bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches) const {
   SmallVector Queue;
 
   const CXXRecordDecl *Record = this;
-  bool AllMatches = true;
   while (true) {
 for (const auto  : Record->bases()) {
   const RecordType *Ty = I.getType()->getAs();
-  if (!Ty) {
-if (AllowShortCircuit) return false;
-AllMatches = false;
-continue;
-  }
+  if (!Ty)
+return false;
 
   CXXRecordDecl *Base =
 cast_or_null(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 @@
 Record = Queue.pop_back_val(); // not actually a queue.
   }
 
-  return AllMatches;
+  return true;
 }
 
 bool CXXBasePaths::lookupInBases(ASTContext ,
Index: clang/include/clang/AST/DeclCXX.h
===
--- clang/include/clang/AST/DeclCXX.h
+++ clang/include/clang/AST/DeclCXX.h
@@ -1519,12 +1519,7 @@
   /// \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