Merge pull request #3833 from bitjammer/dsohandle-multi-file-26565092

[SILGen] Directly silgen access of #dsohandle
This commit is contained in:
David Farler
2016-07-29 15:55:31 -07:00
committed by GitHub
9 changed files with 68 additions and 39 deletions

View File

@@ -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;