diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-17 09:13:32 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-17 09:13:32 +0000 |
| commit | e1f41ed9fafaf7eb4f2da6878a3fabcf2f7c021e (patch) | |
| tree | c4cd67b10e8513bb6dfad58e3c3b55033745ed12 /lib/CodeGen/Designator.cc | |
| parent | 59a2bb6acb975d820ab29be63a6f909d6e6ef40f (diff) | |
feat(driver): compile multiple source files with INCLUDE visibility
Reject builds without an entry program and duplicate cross-file definitions.
Preserve source order for each unit's own constants and import visible exports.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/Designator.cc')
| -rw-r--r-- | lib/CodeGen/Designator.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/CodeGen/Designator.cc b/lib/CodeGen/Designator.cc index 5f54a87..b31492b 100644 --- a/lib/CodeGen/Designator.cc +++ b/lib/CodeGen/Designator.cc @@ -11,10 +11,10 @@ using namespace cps; // (TYPE NodePtr = ^Node before TYPE Node — required for linked structures); // by-value record fields still require their record type to be complete, // which pass B's source order enforces. -void CodeGen::runTypePrePass(const std::vector<std::unique_ptr<StmtAST>> &Statements) { +void CodeGen::runTypePrePass(const std::vector<std::unique_ptr<StmtAST>> &Statements, int Phase) { std::string Err; - for (const auto &S : Statements) { + if (Phase == 0) for (const auto &S : Statements) { SaveAndRestore<int> Location(DiagnosticLine, S->getLine()); bool Ok = true; if (auto *C = dynamic_cast<CTypeDeclAST*>(S.get())) @@ -29,7 +29,7 @@ void CodeGen::runTypePrePass(const std::vector<std::unique_ptr<StmtAST>> &Statem if (!Ok) reportError("%s", Err.c_str()); } - for (const auto &S : Statements) { + if (Phase == 1) for (const auto &S : Statements) { SaveAndRestore<int> Location(DiagnosticLine, S->getLine()); bool Ok = true; if (auto *E = dynamic_cast<EnumTypeDeclAST*>(S.get())) { @@ -42,7 +42,7 @@ void CodeGen::runTypePrePass(const std::vector<std::unique_ptr<StmtAST>> &Statem if (!Ok) reportError("%s", Err.c_str()); } - for (const auto &S : Statements) { + if (Phase == 2) for (const auto &S : Statements) { auto *Class = dynamic_cast<ClassTypeDeclAST*>(S.get()); if (!Class) continue; auto &Methods = ClassMethods[Class->getName()]; |
