Skip to content

Commit 27cf1cc

Browse files
committed
RequirementMachine: Merge RequirementMachineImpl.h into RequirementMachine.h
1 parent 212099b commit 27cf1cc

File tree

4 files changed

+36
-74
lines changed

4 files changed

+36
-74
lines changed

lib/AST/RequirementMachine/GenericSignatureQueries.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222
#include <vector>
2323

2424
#include "RequirementMachine.h"
25-
#include "RequirementMachineImpl.h"
26-
#include "PropertyMap.h"
27-
#include "ProtocolGraph.h"
28-
#include "RewriteContext.h"
29-
#include "RewriteSystem.h"
3025

3126
using namespace swift;
3227
using namespace rewriting;

lib/AST/RequirementMachine/RequirementMachine.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@
1818
#include "swift/AST/Requirement.h"
1919
#include <vector>
2020

21-
#include "PropertyMap.h"
22-
#include "ProtocolGraph.h"
2321
#include "RequirementMachine.h"
24-
#include "RequirementMachineImpl.h"
25-
#include "RewriteContext.h"
26-
#include "RewriteSystem.h"
2722

2823
using namespace swift;
2924
using namespace rewriting;

lib/AST/RequirementMachine/RequirementMachine.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
#define SWIFT_REQUIREMENTMACHINE_H
1515

1616
#include "swift/AST/GenericSignature.h"
17+
#include "llvm/ADT/DenseMap.h"
18+
#include <vector>
19+
20+
#include "PropertyMap.h"
21+
#include "ProtocolGraph.h"
22+
#include "RewriteContext.h"
23+
#include "RewriteSystem.h"
1724

1825
namespace llvm {
1926
class raw_ostream;
@@ -81,6 +88,35 @@ class RequirementMachine final {
8188
void dump(llvm::raw_ostream &out) const;
8289
};
8390

91+
/// We use the PIMPL pattern to avoid creeping header dependencies.
92+
struct RequirementMachine::Implementation {
93+
RewriteContext &Context;
94+
RewriteSystem System;
95+
PropertyMap Map;
96+
CanGenericSignature Sig;
97+
bool Complete = false;
98+
99+
/// All conformance access paths computed so far.
100+
llvm::DenseMap<std::pair<CanType, ProtocolDecl *>,
101+
ConformanceAccessPath> ConformanceAccessPaths;
102+
103+
/// Conformance access paths computed during the last round. All elements
104+
/// have the same length. If a conformance access path of greater length
105+
/// is requested, we refill CurrentConformanceAccessPaths with all paths of
106+
/// length N+1, and add them to the ConformanceAccessPaths map.
107+
std::vector<std::pair<CanType, ConformanceAccessPath>>
108+
CurrentConformanceAccessPaths;
109+
110+
explicit Implementation(RewriteContext &ctx)
111+
: Context(ctx),
112+
System(Context),
113+
Map(Context, System.getProtocols()) {}
114+
void verify(const MutableTerm &term);
115+
void dump(llvm::raw_ostream &out);
116+
117+
MutableTerm getLongestValidPrefix(const MutableTerm &term);
118+
};
119+
84120
} // end namespace rewriting
85121

86122
} // end namespace swift

lib/AST/RequirementMachine/RequirementMachineImpl.h

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)