Don't hardcode the function representation of builtin "once". Make emitLazyGlobalInitializer retrieve the convention from getBuiltinValueDecl.

This commit is contained in:
Kuba Mracek
2018-01-02 23:13:08 -08:00
parent 17fa484f04
commit 0b7bb605cb
8 changed files with 31 additions and 29 deletions

View File

@@ -321,8 +321,8 @@ static SILFunction *getCalleeOfOnceCall(BuiltinInst *BI) {
auto Callee = BI->getOperand(1);
assert(Callee->getType().castTo<SILFunctionType>()->getRepresentation()
== SILFunctionTypeRepresentation::Thin &&
"Expected thin function representation!");
== SILFunctionTypeRepresentation::CFunctionPointer &&
"Expected C function representation!");
if (auto *FR = dyn_cast<FunctionRefInst>(Callee))
return FR->getReferencedFunction();