diff options
Diffstat (limited to 'lib/CodeGen/CodeGen.cc')
| -rw-r--r-- | lib/CodeGen/CodeGen.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGen.cc b/lib/CodeGen/CodeGen.cc index e7116dd..6aa1558 100644 --- a/lib/CodeGen/CodeGen.cc +++ b/lib/CodeGen/CodeGen.cc @@ -166,8 +166,9 @@ void CodeGen::selectUnit(size_t Unit) { void CodeGen::importSymbols() { Symbols.clear(); for (size_t I = 0; I < Exports.size(); ++I) { - if (I != CurrentUnit && isVisible(I)) - Symbols.insert(Exports[I].begin(), Exports[I].end()); + if (!isVisible(I)) continue; + for (const auto &[Name, Info] : Exports[I]) + if (I != CurrentUnit || Info.IsGlobal) Symbols.emplace(Name, Info); } } @@ -286,6 +287,13 @@ void CodeGen::compile(const std::vector<SourceUnit> &Sources) { } Exports[I] = Symbols; } + for (int Phase = 0; Phase < 2; ++Phase) { + for (size_t I = 0; I < Sources.size(); ++I) { + selectUnit(I); + importSymbols(); + runGlobalPrePass(Sources[I], Phase); + } + } for (size_t I = 0; I < Sources.size(); ++I) { selectUnit(I); importSymbols(); |
