Skip to content

[NFC] [SIL] [Parser] Move SILParserTUState into SILParserState.h #31254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 1 addition & 34 deletions lib/SIL/Parser/ParseSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

#include "SILParserFunctionBuilder.h"
#include "SILParserState.h"
#include "swift/AST/ASTWalker.h"
#include "swift/AST/ExistentialLayout.h"
#include "swift/AST/GenericEnvironment.h"
Expand Down Expand Up @@ -45,40 +46,6 @@ using namespace swift::syntax;
// SILParserState implementation
//===----------------------------------------------------------------------===//

namespace {
class SILParserState : public SILParserStateBase {
public:
explicit SILParserState(SILModule &M) : M(M) {}
~SILParserState();

SILModule &M;

/// This is all of the forward referenced functions with
/// the location for where the reference is.
llvm::DenseMap<Identifier,
Located<SILFunction*>> ForwardRefFns;
/// A list of all functions forward-declared by a sil_scope.
llvm::DenseSet<SILFunction *> PotentialZombieFns;

/// A map from textual .sil scope number to SILDebugScopes.
llvm::DenseMap<unsigned, SILDebugScope *> ScopeSlots;

/// Did we parse a sil_stage for this module?
bool DidParseSILStage = false;

bool parseDeclSIL(Parser &P) override;
bool parseDeclSILStage(Parser &P) override;
bool parseSILVTable(Parser &P) override;
bool parseSILGlobal(Parser &P) override;
bool parseSILWitnessTable(Parser &P) override;
bool parseSILDefaultWitnessTable(Parser &P) override;
bool parseSILDifferentiabilityWitness(Parser &P) override;
bool parseSILCoverageMap(Parser &P) override;
bool parseSILProperty(Parser &P) override;
bool parseSILScope(Parser &P) override;
};
} // end anonymous namespace

SILParserState::~SILParserState() {
if (!ForwardRefFns.empty()) {
for (auto Entry : ForwardRefFns) {
Expand Down
61 changes: 61 additions & 0 deletions lib/SIL/Parser/SILParserState.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//===--- SILParserState.h - SILParserState declaration -------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_SIL_SILPARSERSTATE_H
#define SWIFT_SIL_SILPARSERSTATE_H

#include "swift/Basic/LLVM.h"
#include "swift/Parse/ParseSILSupport.h"

//===----------------------------------------------------------------------===//
// SILParserState
//===----------------------------------------------------------------------===//

namespace swift {

class Parser;
class SILModule;

class SILParserState : public SILParserStateBase {
public:
explicit SILParserState(SILModule &M) : M(M) {}
~SILParserState();

SILModule &M;

/// This is all of the forward referenced functions with
/// the location for where the reference is.
llvm::DenseMap<Identifier, Located<SILFunction *>> ForwardRefFns;
/// A list of all functions forward-declared by a sil_scope.
llvm::DenseSet<SILFunction *> PotentialZombieFns;

/// A map from textual .sil scope number to SILDebugScopes.
llvm::DenseMap<unsigned, SILDebugScope *> ScopeSlots;

/// Did we parse a sil_stage for this module?
bool DidParseSILStage = false;

bool parseDeclSIL(Parser &P) override;
bool parseDeclSILStage(Parser &P) override;
bool parseSILVTable(Parser &P) override;
bool parseSILGlobal(Parser &P) override;
bool parseSILWitnessTable(Parser &P) override;
bool parseSILDefaultWitnessTable(Parser &P) override;
bool parseSILDifferentiabilityWitness(Parser &P) override;
bool parseSILCoverageMap(Parser &P) override;
bool parseSILProperty(Parser &P) override;
bool parseSILScope(Parser &P) override;
};

} // end namespace swift

#endif // SWIFT_SIL_SILPARSERSTATE_H