Skip to content

Commit fa71582

Browse files
committed
[IRGen] Assert the SourceFile has been type-checked
1 parent 5f95138 commit fa71582

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ class PrettySynthesizedFileUnitEmission : public llvm::PrettyStackTraceEntry {
443443

444444
/// Emit all the top-level code in the source file.
445445
void IRGenModule::emitSourceFile(SourceFile &SF) {
446+
assert(SF.ASTStage == SourceFile::TypeChecked);
446447
PrettySourceFileEmission StackEntry(SF);
447448

448449
// Emit types and other global decls.

lib/IRGen/IRGen.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -929,8 +929,7 @@ performIRGeneration(const IRGenOptions &Opts, ModuleDecl *M,
929929
} else {
930930
for (auto *File : M->getFiles()) {
931931
if (auto *nextSF = dyn_cast<SourceFile>(File)) {
932-
if (nextSF->ASTStage >= SourceFile::TypeChecked)
933-
IGM.emitSourceFile(*nextSF);
932+
IGM.emitSourceFile(*nextSF);
934933
} else if (auto *nextSFU = dyn_cast<SynthesizedFileUnit>(File)) {
935934
IGM.emitSynthesizedFileUnit(*nextSFU);
936935
} else {
@@ -1138,7 +1137,7 @@ static void performParallelIRGeneration(
11381137
bool DidRunSILCodeGenPreparePasses = false;
11391138
for (auto *File : M->getFiles()) {
11401139
auto nextSF = dyn_cast<SourceFile>(File);
1141-
if (!nextSF || nextSF->ASTStage < SourceFile::TypeChecked)
1140+
if (!nextSF)
11421141
continue;
11431142

11441143
// There must be an output filename for each source file.

0 commit comments

Comments
 (0)