-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Parse] Split ParseSIL out into its own library.
...finally breaking the dependency of Parse on Sema. There are still some unfortunate dependencies here -- Xi's working on getting /AST/ not dependent on Sema -- but this is a step forward. It is a little strange that parseIntoSourceFile is in ParseSIL, and therefore that that's still a dependency for anyone trying to, well, parse. However, nearly all clients that parse want to type-check as well, and that requires Sema, Serialization, and the ClangImporter... and Serialization and SIL currently require each other as well (another circular dependency). So it's not actively causing us trouble right now.
- Loading branch information
1 parent
46d994f
commit b4759bc
Showing
12 changed files
with
145 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//===--- ParseSILSupport.h - Interface with ParseSIL ------------*- C++ -*-===// | ||
// | ||
// This source file is part of the Swift.org open source project | ||
// | ||
// Copyright (c) 2014 - 2017 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_PARSER_PARSESILSUPPORT_H | ||
#define SWIFT_PARSER_PARSESILSUPPORT_H | ||
|
||
#include "llvm/Support/PrettyStackTrace.h" | ||
|
||
namespace swift { | ||
class Parser; | ||
|
||
/// Interface between the Parse and ParseSIL libraries, to avoid circular | ||
/// dependencies. | ||
class SILParserTUStateBase { | ||
virtual void anchor(); | ||
protected: | ||
SILParserTUStateBase() = default; | ||
virtual ~SILParserTUStateBase() = default; | ||
public: | ||
virtual bool parseDeclSIL(Parser &P) = 0; | ||
virtual bool parseDeclSILStage(Parser &P) = 0; | ||
virtual bool parseSILVTable(Parser &P) = 0; | ||
virtual bool parseSILGlobal(Parser &P) = 0; | ||
virtual bool parseSILWitnessTable(Parser &P) = 0; | ||
virtual bool parseSILDefaultWitnessTable(Parser &P) = 0; | ||
virtual bool parseSILCoverageMap(Parser &P) = 0; | ||
virtual bool parseSILScope(Parser &P) = 0; | ||
}; | ||
|
||
/// To assist debugging parser crashes, tell us the location of the | ||
/// current token. | ||
class PrettyStackTraceParser : public llvm::PrettyStackTraceEntry { | ||
Parser &P; | ||
public: | ||
explicit PrettyStackTraceParser(Parser &P) : P(P) {} | ||
void print(llvm::raw_ostream &out) const override { | ||
out << "With parser at source location: "; | ||
P.Tok.getLoc().print(out, P.Context.SourceMgr); | ||
out << '\n'; | ||
} | ||
}; | ||
} // end namespace swift | ||
|
||
#endif // SWIFT_PARSER_PARSESILSUPPORT_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
add_swift_library(swiftParseSIL STATIC | ||
ParseSIL.cpp | ||
LINK_LIBRARIES | ||
swiftParse | ||
swiftSema | ||
swiftSIL | ||
) | ||
|
Oops, something went wrong.