Skip to content

Commit 6197aab

Browse files
committed
[ResultBuilders] NFC: Support -debug-constraints{-on-line=} for declaration transforms
1 parent 80050bb commit 6197aab

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6510,6 +6510,9 @@ bool isResultBuilderMethodReference(ASTContext &, UnresolvedDotExpr *);
65106510
unsigned getNumApplications(bool hasAppliedSelf,
65116511
FunctionRefInfo functionRefInfo);
65126512

6513+
/// Determine whether the debug output is enabled for the given target.
6514+
bool debugConstraintSolverForTarget(ASTContext &C,
6515+
SyntacticElementTarget target);
65136516
} // end namespace constraints
65146517

65156518
template<typename ...Args>

lib/Sema/BuilderTransform.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,9 @@ TypeChecker::applyResultBuilderBodyTransform(FuncDecl *func, Type builderType) {
962962
return nullptr;
963963

964964
ConstraintSystemOptions options = ConstraintSystemFlags::AllowFixes;
965+
if (debugConstraintSolverForTarget(ctx, target))
966+
options |= ConstraintSystemFlags::DebugConstraints;
967+
965968
auto resultInterfaceTy = func->getResultInterfaceType();
966969
auto resultContextType = func->mapTypeIntoContext(resultInterfaceTy);
967970

lib/Sema/CSSolver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,8 +1338,8 @@ void ConstraintSystem::shrink(Expr *expr) {
13381338
}
13391339
}
13401340

1341-
static bool debugConstraintSolverForTarget(ASTContext &C,
1342-
SyntacticElementTarget target) {
1341+
bool constraints::debugConstraintSolverForTarget(
1342+
ASTContext &C, SyntacticElementTarget target) {
13431343
if (C.TypeCheckerOpts.DebugConstraintSolver)
13441344
return true;
13451345

0 commit comments

Comments
 (0)