RequirementMachine: Rename -debug-requirement-machine flag to -dump-requirement-machine

This commit is contained in:
Slava Pestov
2021-08-19 14:14:10 -04:00
parent 0935952038
commit fe2f42bc72
18 changed files with 31 additions and 31 deletions

View File

@@ -459,8 +459,8 @@ namespace swift {
RequirementMachineMode EnableRequirementMachine =
RequirementMachineMode::Disabled;
/// Enables debugging output from the requirement machine.
bool DebugRequirementMachine = false;
/// Enables dumping rewrite systems from the requirement machine.
bool DumpRequirementMachine = false;
/// Enables statistics output from the requirement machine.
bool AnalyzeRequirementMachine = false;

View File

@@ -273,8 +273,8 @@ def debug_constraints_on_line_EQ : Joined<["-"], "debug-constraints-on-line=">,
def disable_named_lazy_member_loading : Flag<["-"], "disable-named-lazy-member-loading">,
HelpText<"Disable per-name lazy member loading">;
def debug_requirement_machine : Flag<["-"], "debug-requirement-machine">,
HelpText<"Enables debugging output from the generics implementation">;
def dump_requirement_machine : Flag<["-"], "dump-requirement-machine">,
HelpText<"Enables dumping rewrite systems from the generics implementation">;
def analyze_requirement_machine : Flag<["-"], "analyze-requirement-machine">,
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,

View File

@@ -30,7 +30,7 @@ namespace {
/// transitively-referenced protocols.
struct RewriteSystemBuilder {
RewriteContext &Context;
bool Debug;
bool Dump;
ProtocolGraph Protocols;
std::vector<std::pair<MutableTerm, MutableTerm>> Rules;
@@ -39,8 +39,8 @@ struct RewriteSystemBuilder {
const ProtocolDecl *proto,
SmallVectorImpl<Term> &result);
RewriteSystemBuilder(RewriteContext &ctx, bool debug)
: Context(ctx), Debug(debug) {}
RewriteSystemBuilder(RewriteContext &ctx, bool dump)
: Context(ctx), Dump(dump) {}
void addGenericSignature(CanGenericSignature sig);
void addAssociatedType(const AssociatedTypeDecl *type,
const ProtocolDecl *proto);
@@ -86,7 +86,7 @@ void RewriteSystemBuilder::addGenericSignature(CanGenericSignature sig) {
// Add rewrite rules for each protocol.
for (auto *proto : Protocols.getProtocols()) {
if (Debug) {
if (Dump) {
llvm::dbgs() << "protocol " << proto->getName() << " {\n";
}
@@ -101,7 +101,7 @@ void RewriteSystemBuilder::addGenericSignature(CanGenericSignature sig) {
for (auto req : info.Requirements)
addRequirement(req.getCanonical(), proto);
if (Debug) {
if (Dump) {
llvm::dbgs() << "}\n";
}
}
@@ -140,7 +140,7 @@ void RewriteSystemBuilder::addAssociatedType(const AssociatedTypeDecl *type,
/// protocol symbol.
void RewriteSystemBuilder::addRequirement(const Requirement &req,
const ProtocolDecl *proto) {
if (Debug) {
if (Dump) {
llvm::dbgs() << "+ ";
req.dump(llvm::dbgs());
llvm::dbgs() << "\n";
@@ -310,7 +310,7 @@ void RequirementMachine::dump(llvm::raw_ostream &out) const {
RequirementMachine::RequirementMachine(RewriteContext &ctx)
: Context(ctx), System(ctx), Map(ctx, System.getProtocols()) {
auto &langOpts = ctx.getASTContext().LangOpts;
Debug = langOpts.DebugRequirementMachine;
Dump = langOpts.DumpRequirementMachine;
RequirementMachineStepLimit = langOpts.RequirementMachineStepLimit;
RequirementMachineDepthLimit = langOpts.RequirementMachineDepthLimit;
Stats = ctx.getASTContext().Stats;
@@ -331,14 +331,14 @@ void RequirementMachine::addGenericSignature(CanGenericSignature sig) {
FrontendStatsTracer tracer(Stats, "build-rewrite-system");
if (Debug) {
if (Dump) {
llvm::dbgs() << "Adding generic signature " << sig << " {\n";
}
// Collect the top-level requirements, and all transtively-referenced
// protocol requirement signatures.
RewriteSystemBuilder builder(Context, Debug);
RewriteSystemBuilder builder(Context, Dump);
builder.addGenericSignature(sig);
// Add the initial set of rewrite rules to the rewrite system, also
@@ -348,7 +348,7 @@ void RequirementMachine::addGenericSignature(CanGenericSignature sig) {
computeCompletion();
if (Debug) {
if (Dump) {
llvm::dbgs() << "}\n";
}
}
@@ -413,7 +413,7 @@ void RequirementMachine::computeCompletion() {
break;
}
if (Debug) {
if (Dump) {
dump(llvm::dbgs());
}

View File

@@ -52,7 +52,7 @@ class RequirementMachine final {
RewriteSystem System;
PropertyMap Map;
bool Debug = false;
bool Dump = false;
bool Complete = false;
unsigned RequirementMachineStepLimit;
unsigned RequirementMachineDepthLimit;

View File

@@ -829,8 +829,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
A->getAsString(Args), A->getValue());
}
Opts.DebugRequirementMachine = Args.hasArg(
OPT_debug_requirement_machine);
Opts.DumpRequirementMachine = Args.hasArg(
OPT_dump_requirement_machine);
Opts.AnalyzeRequirementMachine = Args.hasArg(
OPT_analyze_requirement_machine);

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift %clang-importer-sdk -requirement-machine=verify -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift %clang-importer-sdk -requirement-machine=verify -dump-requirement-machine 2>&1 | %FileCheck %s
// REQUIRES: objc_interop

View File

@@ -1,5 +1,5 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module %S/Inputs/rdar79564324_other.swift -emit-module-path %t/rdar79564324_other.swiftmodule -requirement-machine=on -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-swift-frontend -emit-module %S/Inputs/rdar79564324_other.swift -emit-module-path %t/rdar79564324_other.swiftmodule -requirement-machine=on -dump-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-swift-frontend -emit-silgen %s -I %t -requirement-machine=on
import rdar79564324_other

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -dump-requirement-machine 2>&1 | %FileCheck %s
struct Foo<A, B> {}

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -dump-requirement-machine 2>&1 | %FileCheck %s
struct Foo<A, B> {}

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -dump-requirement-machine 2>&1 | %FileCheck %s
struct Foo<A, B> {}

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -dump-requirement-machine 2>&1 | %FileCheck %s
protocol P1 {
associatedtype T : P1

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -dump-requirement-machine 2>&1 | %FileCheck %s
protocol P1 {
associatedtype T : P1

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -dump-requirement-machine 2>&1 | %FileCheck %s
protocol P1 {
associatedtype T : P1

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -dump-requirement-machine 2>&1 | %FileCheck %s
protocol P1 {
associatedtype A : P1

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift -requirement-machine=verify -dump-requirement-machine 2>&1 | %FileCheck %s
class Base {}
class Derived : Base {

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -requirement-machine=on -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift -requirement-machine=on -dump-requirement-machine 2>&1 | %FileCheck %s
// Note: The GSB fails this test, because it doesn't implement unification of
// superclass type constructor arguments.

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -requirement-machine=on -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift -requirement-machine=on -dump-requirement-machine 2>&1 | %FileCheck %s
// Note: The GSB fails this test, because it doesn't implement unification of
// superclass type constructor arguments.

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -requirement-machine=on -debug-requirement-machine 2>&1 | %FileCheck %s
// RUN: %target-typecheck-verify-swift -requirement-machine=on -dump-requirement-machine 2>&1 | %FileCheck %s
// Note: The GSB fails this test, because it doesn't implement unification of
// superclass type constructor arguments.