diff options
| author | Yong He <yonghe@outlook.com> | 2019-02-05 18:18:16 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-05 18:18:16 -0800 |
| commit | a39fd3d3f67df28b9206c9f08bc7d046f9b0db59 (patch) | |
| tree | a3971c4c6217914e9dc4c12917f26a7eb6ac28b2 /source/slang/lower-to-ir.cpp | |
| parent | c198eaba351850fcb3d82c2f5117efc0e2e2bf1e (diff) | |
| parent | 60cc9f24c4bec54561bea873ee943aa3d0973dc2 (diff) | |
Merge branch 'master' into gencloser
Diffstat (limited to 'source/slang/lower-to-ir.cpp')
| -rw-r--r-- | source/slang/lower-to-ir.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp index 3a5e0cd2e..665904969 100644 --- a/source/slang/lower-to-ir.cpp +++ b/source/slang/lower-to-ir.cpp @@ -6113,25 +6113,31 @@ static void lowerEntryPointToIR( EntryPointRequest* entryPointRequest) { // First, lower the entry point like an ordinary function - auto entryPointFuncDecl = entryPointRequest->decl; - if (!entryPointFuncDecl) - { - // Something must have gone wrong earlier, if we - // weren't able to associate a declaration with - // the entry point request. - return; - } - auto loweredEntryPointFunc = ensureDecl(context, entryPointFuncDecl); + + auto session = context->getSession(); + auto entryPointFuncDeclRef = entryPointRequest->getFuncDeclRef(); + auto entryPointFuncType = lowerType(context, getFuncType(session, entryPointFuncDeclRef)); + + auto builder = context->irBuilder; + builder->setInsertInto(builder->getModule()->getModuleInst()); + + auto loweredEntryPointFunc = getSimpleVal(context, + emitDeclRef(context, entryPointFuncDeclRef, entryPointFuncType)); // Attach a marker decoration so that we recognize // this as an entry point. - auto builder = context->irBuilder; - builder->addEntryPointDecoration(getSimpleVal(context, loweredEntryPointFunc)); + // + builder->addEntryPointDecoration(loweredEntryPointFunc); + + // + if(!loweredEntryPointFunc->findDecoration<IRLinkageDecoration>()) + { + builder->addExportDecoration(loweredEntryPointFunc, getMangledName(entryPointFuncDeclRef).getUnownedSlice()); + } // Now lower all the arguments supplied for global generic // type parameters. // - builder->setInsertInto(builder->getModule()->getModuleInst()); for (RefPtr<Substitutions> subst = entryPointRequest->globalGenericSubst; subst; subst = subst->outer) { auto gSubst = subst.as<GlobalGenericParamSubstitution>(); |
