mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #3833 from bitjammer/dsohandle-multi-file-26565092
[SILGen] Directly silgen access of #dsohandle
This commit is contained in:
@@ -367,28 +367,6 @@ void Module::removeFile(FileUnit &existingFile) {
|
||||
Files.erase(I.base());
|
||||
}
|
||||
|
||||
VarDecl *Module::getDSOHandle() {
|
||||
if (DSOHandle)
|
||||
return DSOHandle;
|
||||
|
||||
auto unsafeMutableRawPtr = getASTContext().getUnsafeMutableRawPointerDecl();
|
||||
if (!unsafeMutableRawPtr)
|
||||
return nullptr;
|
||||
|
||||
auto &ctx = getASTContext();
|
||||
auto handleVar = new (ctx) VarDecl(/*IsStatic=*/false, /*IsLet=*/false,
|
||||
SourceLoc(),
|
||||
ctx.getIdentifier("__dso_handle"),
|
||||
unsafeMutableRawPtr->getDeclaredType(),
|
||||
Files[0]);
|
||||
handleVar->setImplicit(true);
|
||||
handleVar->getAttrs().add(
|
||||
new (ctx) SILGenNameAttr("__dso_handle", /*Implicit=*/true));
|
||||
handleVar->setAccessibility(Accessibility::Internal);
|
||||
DSOHandle = handleVar;
|
||||
return handleVar;
|
||||
}
|
||||
|
||||
#define FORWARD(name, args) \
|
||||
for (const FileUnit *file : getFiles()) \
|
||||
file->name args;
|
||||
|
||||
Reference in New Issue
Block a user