Skip to content

Commit 34bfbe2

Browse files
authored
Merge pull request #31254 from zoecarver/sil-parser/sil-parser-state-header
2 parents 36e95ca + dfc5c70 commit 34bfbe2

File tree

2 files changed

+62
-34
lines changed

2 files changed

+62
-34
lines changed

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "SILParserFunctionBuilder.h"
14+
#include "SILParserState.h"
1415
#include "swift/AST/ASTWalker.h"
1516
#include "swift/AST/ExistentialLayout.h"
1617
#include "swift/AST/GenericEnvironment.h"
@@ -45,40 +46,6 @@ using namespace swift::syntax;
4546
// SILParserState implementation
4647
//===----------------------------------------------------------------------===//
4748

48-
namespace {
49-
class SILParserState : public SILParserStateBase {
50-
public:
51-
explicit SILParserState(SILModule &M) : M(M) {}
52-
~SILParserState();
53-
54-
SILModule &M;
55-
56-
/// This is all of the forward referenced functions with
57-
/// the location for where the reference is.
58-
llvm::DenseMap<Identifier,
59-
Located<SILFunction*>> ForwardRefFns;
60-
/// A list of all functions forward-declared by a sil_scope.
61-
llvm::DenseSet<SILFunction *> PotentialZombieFns;
62-
63-
/// A map from textual .sil scope number to SILDebugScopes.
64-
llvm::DenseMap<unsigned, SILDebugScope *> ScopeSlots;
65-
66-
/// Did we parse a sil_stage for this module?
67-
bool DidParseSILStage = false;
68-
69-
bool parseDeclSIL(Parser &P) override;
70-
bool parseDeclSILStage(Parser &P) override;
71-
bool parseSILVTable(Parser &P) override;
72-
bool parseSILGlobal(Parser &P) override;
73-
bool parseSILWitnessTable(Parser &P) override;
74-
bool parseSILDefaultWitnessTable(Parser &P) override;
75-
bool parseSILDifferentiabilityWitness(Parser &P) override;
76-
bool parseSILCoverageMap(Parser &P) override;
77-
bool parseSILProperty(Parser &P) override;
78-
bool parseSILScope(Parser &P) override;
79-
};
80-
} // end anonymous namespace
81-
8249
SILParserState::~SILParserState() {
8350
if (!ForwardRefFns.empty()) {
8451
for (auto Entry : ForwardRefFns) {

lib/SIL/Parser/SILParserState.h

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//===--- SILParserState.h - SILParserState declaration -------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef SWIFT_SIL_SILPARSERSTATE_H
14+
#define SWIFT_SIL_SILPARSERSTATE_H
15+
16+
#include "swift/Basic/LLVM.h"
17+
#include "swift/Parse/ParseSILSupport.h"
18+
19+
//===----------------------------------------------------------------------===//
20+
// SILParserState
21+
//===----------------------------------------------------------------------===//
22+
23+
namespace swift {
24+
25+
class Parser;
26+
class SILModule;
27+
28+
class SILParserState : public SILParserStateBase {
29+
public:
30+
explicit SILParserState(SILModule &M) : M(M) {}
31+
~SILParserState();
32+
33+
SILModule &M;
34+
35+
/// This is all of the forward referenced functions with
36+
/// the location for where the reference is.
37+
llvm::DenseMap<Identifier, Located<SILFunction *>> ForwardRefFns;
38+
/// A list of all functions forward-declared by a sil_scope.
39+
llvm::DenseSet<SILFunction *> PotentialZombieFns;
40+
41+
/// A map from textual .sil scope number to SILDebugScopes.
42+
llvm::DenseMap<unsigned, SILDebugScope *> ScopeSlots;
43+
44+
/// Did we parse a sil_stage for this module?
45+
bool DidParseSILStage = false;
46+
47+
bool parseDeclSIL(Parser &P) override;
48+
bool parseDeclSILStage(Parser &P) override;
49+
bool parseSILVTable(Parser &P) override;
50+
bool parseSILGlobal(Parser &P) override;
51+
bool parseSILWitnessTable(Parser &P) override;
52+
bool parseSILDefaultWitnessTable(Parser &P) override;
53+
bool parseSILDifferentiabilityWitness(Parser &P) override;
54+
bool parseSILCoverageMap(Parser &P) override;
55+
bool parseSILProperty(Parser &P) override;
56+
bool parseSILScope(Parser &P) override;
57+
};
58+
59+
} // end namespace swift
60+
61+
#endif // SWIFT_SIL_SILPARSERSTATE_H

0 commit comments

Comments
 (0)