/// Parse a comma separated list of elements that must have at least one entry
/// in it.
-ParseResult Parser::parseCommaSeparatedList(
- const std::function<ParseResult()> &parseElement) {
+ParseResult
+Parser::parseCommaSeparatedList(function_ref<ParseResult()> parseElement) {
// Non-empty case starts with an element.
if (parseElement())
return failure();
/// abstract-list ::= rightToken // if allowEmptyList == true
/// abstract-list ::= element (',' element)* rightToken
///
-ParseResult Parser::parseCommaSeparatedListUntil(
- Token::Kind rightToken, const std::function<ParseResult()> &parseElement,
- bool allowEmptyList) {
+ParseResult
+Parser::parseCommaSeparatedListUntil(Token::Kind rightToken,
+ function_ref<ParseResult()> parseElement,
+ bool allowEmptyList) {
// Handle the empty case.
if (getToken().is(rightToken)) {
if (!allowEmptyList)
/// returns null on failure.
Value resolveSSAUse(SSAUseInfo useInfo, Type type);
- ParseResult parseSSADefOrUseAndType(
- const std::function<ParseResult(SSAUseInfo, Type)> &action);
+ ParseResult
+ parseSSADefOrUseAndType(function_ref<ParseResult(SSAUseInfo, Type)> action);
ParseResult parseOptionalSSAUseAndTypeList(SmallVectorImpl<Value> &results);
///
/// ssa-use-and-type ::= ssa-use `:` type
ParseResult OperationParser::parseSSADefOrUseAndType(
- const std::function<ParseResult(SSAUseInfo, Type)> &action) {
+ function_ref<ParseResult(SSAUseInfo, Type)> action) {
SSAUseInfo useInfo;
if (parseSSAUse(useInfo) ||
parseToken(Token::colon, "expected ':' and type for SSA operand"))
/// Parse a comma-separated list of elements up until the specified end token.
ParseResult
parseCommaSeparatedListUntil(Token::Kind rightToken,
- const std::function<ParseResult()> &parseElement,
+ function_ref<ParseResult()> parseElement,
bool allowEmptyList = true);
/// Parse a comma separated list of elements that must have at least one entry
/// in it.
- ParseResult
- parseCommaSeparatedList(const std::function<ParseResult()> &parseElement);
+ ParseResult parseCommaSeparatedList(function_ref<ParseResult()> parseElement);
ParseResult parsePrettyDialectSymbolName(StringRef &prettyName);
if (Optional<bool> signedness = getToken().getIntTypeSignedness())
signSemantics = *signedness ? IntegerType::Signed : IntegerType::Unsigned;
- auto loc = getEncodedSourceLocation(getToken().getLoc());
consumeToken(Token::inttype);
- return IntegerType::getChecked(width.getValue(), signSemantics, loc);
+ return IntegerType::get(width.getValue(), signSemantics, getContext());
}
// float-type