Redesign the BuiltinFunctionRefInst to contain an Identifier instead of

a FuncDecl.  This makes it much more straight-forward for SIL passes to
introduce a new one - without doing name lookup in the builtin module!



Swift SVN r10694
This commit is contained in:
Chris Lattner
2013-11-30 01:49:36 +00:00
parent a5cf0fa60a
commit ad05efc481
18 changed files with 98 additions and 93 deletions

View File

@@ -1210,13 +1210,18 @@ bool SILParser::parseSILInstruction(SILBasicBlock *BB) {
break;
case ValueKind::BuiltinFunctionRefInst: {
SILType Ty;
SILDeclRef FuncRef;
if (parseSILDeclRef(FuncRef) ||
P.parseToken(tok::colon, diag::expected_tok_in_sil_instr, ":") ||
if (P.Tok.getKind() != tok::string_literal) {
P.diagnose(P.Tok, diag::expected_tok_in_sil_instr,"builtin_function_ref");
return true;
}
StringRef Str = P.Tok.getText();
Identifier Id = P.Context.getIdentifier(Str.substr(1, Str.size()-2));
P.consumeToken(tok::string_literal);
if (P.parseToken(tok::colon, diag::expected_tok_in_sil_instr, ":") ||
parseSILType(Ty))
return true;
ResultVal = B.createBuiltinFunctionRef(InstLoc,
cast<FuncDecl>(FuncRef.getDecl()), Ty);
ResultVal = B.createBuiltinFunctionRef(InstLoc, Id, Ty);
break;
}
case ValueKind::ProjectExistentialInst: