Skip to content

Commit df34be7

Browse files
committed
[AST] Remove parsing ASTStages
Now that the parsing stage has been requestified, these are no longer meaningful.
1 parent dafa9b9 commit df34be7

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

include/swift/AST/SourceFile.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,8 @@ class SourceFile final : public FileUnit {
306306
const SourceFileKind Kind;
307307

308308
enum ASTStage_t {
309-
/// Parsing is underway.
310-
Parsing,
311-
/// Parsing has completed.
312-
Parsed,
309+
/// The source file is not name bound or type checked.
310+
Unprocessed,
313311
/// Name binding has completed.
314312
NameBound,
315313
/// Type checking has completed.
@@ -321,7 +319,7 @@ class SourceFile final : public FileUnit {
321319
///
322320
/// Only files that have been fully processed (i.e. type-checked) will be
323321
/// forwarded on to IRGen.
324-
ASTStage_t ASTStage = Parsing;
322+
ASTStage_t ASTStage = Unprocessed;
325323

326324
SourceFile(ModuleDecl &M, SourceFileKind K, Optional<unsigned> bufferID,
327325
ImplicitModuleImportKind ModImpKind, bool KeepParsedTokens = false,

lib/AST/Module.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,14 @@ void ModuleDecl::getImportedModules(SmallVectorImpl<ImportedModule> &modules,
11921192
void
11931193
SourceFile::getImportedModules(SmallVectorImpl<ModuleDecl::ImportedModule> &modules,
11941194
ModuleDecl::ImportFilter filter) const {
1195-
assert(ASTStage >= Parsed || Kind == SourceFileKind::SIL);
1195+
// FIXME: Ideally we should assert that the file has been name bound before
1196+
// calling this function. However unfortunately that can cause issues for
1197+
// overlays which can depend on a Clang submodule for the underlying framework
1198+
// they are overlaying, which causes us to attempt to load the overlay again.
1199+
// We need to find a way to ensure that an overlay dependency with the same
1200+
// name as the overlay always loads the underlying Clang module. We currently
1201+
// handle this for a direct import from the overlay, but not when it happens
1202+
// through other imports.
11961203
assert(filter && "no imports requested?");
11971204
for (auto desc : Imports) {
11981205
ModuleDecl::ImportFilter requiredFilter;

lib/Frontend/Frontend.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -759,11 +759,7 @@ void CompilerInstance::performSema() {
759759
}
760760

761761
void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) {
762-
// FIXME: A lot of the logic in `performParseOnly` is a stripped-down version
763-
// of the logic in `performSemaUpTo`. We should try to unify them over time.
764-
if (LimitStage <= SourceFile::Parsed) {
765-
return performParseOnly();
766-
}
762+
assert(LimitStage > SourceFile::Unprocessed);
767763

768764
FrontendStatsTracer tracer(getStatsReporter(), "perform-sema");
769765

lib/Parse/ParseRequests.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ void ParseSourceFileRequest::cacheResult(ArrayRef<Decl *> decls) const {
177177
assert(!SF->Decls);
178178
SF->Decls = decls;
179179

180-
// Note that the source file is fully parsed and verify it.
181-
SF->ASTStage = SourceFile::Parsed;
180+
// Verify the parsed source file.
182181
verify(*SF);
183182
}
184183

0 commit comments

Comments
 (0)