aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/FunctionGen.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 09:13:32 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 09:13:32 +0000
commite1f41ed9fafaf7eb4f2da6878a3fabcf2f7c021e (patch)
treec4cd67b10e8513bb6dfad58e3c3b55033745ed12 /lib/CodeGen/FunctionGen.cc
parent59a2bb6acb975d820ab29be63a6f909d6e6ef40f (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/FunctionGen.cc')
-rw-r--r--lib/CodeGen/FunctionGen.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/CodeGen/FunctionGen.cc b/lib/CodeGen/FunctionGen.cc
index b66b55a..cc88a78 100644
--- a/lib/CodeGen/FunctionGen.cc
+++ b/lib/CodeGen/FunctionGen.cc
@@ -106,7 +106,8 @@ void FunctionGen::createArgumentAllocas(Function *F, const std::vector<ParamDecl
const FuncSig *FunctionGen::getSignature(const std::string &Name) const {
auto It = Signatures.find(Name);
- return It == Signatures.end() ? nullptr : &It->second;
+ return It == Signatures.end() || (Visible && !Visible(It->second.OwnerUnit))
+ ? nullptr : &It->second;
}
Function *FunctionGen::emitPrototype(PrototypeAST *Proto) {
@@ -134,6 +135,7 @@ Function *FunctionGen::emitPrototype(PrototypeAST *Proto) {
}
FuncSig Sig;
+ Sig.OwnerUnit = CurrentUnit;
Sig.Name = Proto->getLinkName();
Sig.ReturnTypeName = Proto->getReturnType();