Skip to content

Commit 69ba5bc

Browse files
committed
Remove shouldDiscardFailures() from ConstraintLocator,
remove shouldRecordFailures() from ConstraintSystem. NFC.
1 parent a1112b3 commit 69ba5bc

File tree

3 files changed

+6
-32
lines changed

3 files changed

+6
-32
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4997,13 +4997,14 @@ bool ConstraintSystem::salvage(SmallVectorImpl<Solution> &viable, Expr *expr) {
49974997
// Attempt to solve again, capturing all states that come from our attempts to
49984998
// select overloads or bind type variables.
49994999
//
5000-
// FIXME: can this be removed??
5000+
// FIXME: can this be removed? We need to arrange for recordFixes to be
5001+
// eliminated.
50015002
viable.clear();
50025003

50035004
{
50045005
// Set up solver state.
50055006
SolverState state(*this);
5006-
state.recordFailures = true;
5007+
state.recordFixes = true;
50075008
this->solverState = &state;
50085009

50095010
// Solve the system.

lib/Sema/ConstraintLocator.h

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -449,17 +449,6 @@ class ConstraintLocator : public llvm::FoldingSetNode {
449449
Profile(id, anchor, getPath());
450450
}
451451

452-
/// \brief Determine whether or not constraint failures associated with this
453-
/// locator should be discarded.
454-
bool shouldDiscardFailures() {
455-
return discardFailures;
456-
}
457-
458-
/// \brief Toggle option to discard constraint failures.
459-
void setDiscardFailures(bool shouldDiscard = true) {
460-
discardFailures = shouldDiscard;
461-
}
462-
463452
/// \brief Produce a debugging dump of this locator.
464453
LLVM_ATTRIBUTE_DEPRECATED(
465454
void dump(SourceManager *SM) LLVM_ATTRIBUTE_USED,
@@ -474,8 +463,7 @@ class ConstraintLocator : public llvm::FoldingSetNode {
474463
/// \brief Initialize a constraint locator with an anchor and a path.
475464
ConstraintLocator(Expr *anchor, ArrayRef<PathElement> path,
476465
unsigned flags)
477-
: anchor(anchor), numPathElements(path.size()), summaryFlags(flags),
478-
discardFailures(false)
466+
: anchor(anchor), numPathElements(path.size()), summaryFlags(flags)
479467
{
480468
// FIXME: Alignment.
481469
std::copy(path.begin(), path.end(),
@@ -510,11 +498,6 @@ class ConstraintLocator : public llvm::FoldingSetNode {
510498
/// \brief A set of flags summarizing interesting properties of the path.
511499
unsigned summaryFlags : 7;
512500

513-
/// \brief Determines whether or not we should record constraint application
514-
/// failures associated with this locator. This information cannot be
515-
/// inferred from the path itself, so it is not stored as a summary flag.
516-
unsigned discardFailures: 1;
517-
518501
friend class ConstraintSystem;
519502
};
520503

lib/Sema/ConstraintSystem.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ class ConstraintSystem {
998998
unsigned depth = 0;
999999

10001000
/// \brief Whether to record failures or not.
1001-
bool recordFailures = false;
1001+
bool recordFixes = false;
10021002

10031003
/// The list of constraints that have been retired along the
10041004
/// current path.
@@ -1265,23 +1265,13 @@ class ConstraintSystem {
12651265
getConstraintLocator(const ConstraintLocatorBuilder &builder);
12661266

12671267
public:
1268-
/// \brief Whether we should be recording failures.
1269-
bool shouldRecordFailures() {
1270-
// FIXME: It still makes sense to record failures when there are fixes
1271-
// present, but they should be less desirable.
1272-
if (!Fixes.empty())
1273-
return false;
1274-
1275-
return !solverState || solverState->recordFailures ||
1276-
TC.Context.LangOpts.DebugConstraintSolver;
1277-
}
12781268

12791269
/// \brief Whether we should attempt to fix problems.
12801270
bool shouldAttemptFixes() {
12811271
if (!(Options & ConstraintSystemFlags::AllowFixes))
12821272
return false;
12831273

1284-
return !solverState || solverState->recordFailures;
1274+
return !solverState || solverState->recordFixes;
12851275
}
12861276

12871277
/// \brief Log and record the application of the fix. Return true iff any

0 commit comments

Comments
 (0)