// along with GCC; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+#include "expected.h"
#include "rust-make-unique.h"
#include "rust-macro-builtins-asm.h"
#include "rust-ast-fragment.h"
else
{
rust_error_at (token->get_locus (),
- "expected operand, clobber_abi, options, or "
- "additional template string");
+ "expected operand, %s, options, or "
+ "additional template string",
+ "clobber_abi");
return tl::unexpected<InlineAsmParseError> (COMMITTED);
}
}
- tl::expected<InlineAsmContext, InlineAsmParseError> parsing_operand
- = tl::expected<InlineAsmContext, InlineAsmParseError> (inline_asm_ctx);
-
int slot = inline_asm_ctx.inline_asm.operands.size ();
// Here is all parse_reg_operand functions we're using in a for loop
// we propogate the result.
for (auto &parse_func : parse_funcs)
{
- parsing_operand.emplace (inline_asm_ctx);
+ auto parsing_operand
+ = tl::expected<InlineAsmContext, InlineAsmParseError> (inline_asm_ctx);
parsing_operand.map (parse_func);
// Per rust's asm.rs's structure
}
}
- return parsing_operand;
+ return inline_asm_ctx;
}
tl::expected<InlineAsmContext, InlineAsmParseError>
{
if (!parser.skip_token (UNDERSCORE))
{
- parse_format_string (inline_asm_ctx);
+ auto result = parse_format_string (inline_asm_ctx);
+
+ if (!result.has_value ())
+ rust_unreachable ();
// out_expr = parser.parse_expr();
}
// committed to anything So that the error bubbles up and we recover from
// this error gracefully
rust_error_at (token->get_locus (),
- "expected operand, clobber_abi, options, or additional "
- "template string");
+ "expected operand, %s, options, or additional "
+ "template string",
+ "clobber_abi");
return tl::unexpected<InlineAsmParseError> (COMMITTED);
}
return tl::expected<InlineAsmContext, InlineAsmParseError> (inline_asm_ctx);
#include "system.h"
namespace Rust {
-enum WARN_UNUSED_RESULT InlineAsmParseError
+enum InlineAsmParseError
{
// Enum for InlineAsmParseError
};
// Expected calls
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
validate (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_asm_arg (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_format_strings (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_clobber_abi (InlineAsmContext inline_asm_ctx);
// From rustc
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_reg_operand (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_reg_operand_in (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_reg_operand_out (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_reg_operand_lateout (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_reg_operand_inout (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_reg_operand_inlateout (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_reg_operand_const (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_reg_operand_sym (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_reg_operand_unexpected (InlineAsmContext inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::optional<AST::Fragment>
parse_asm (location_t invoc_locus, AST::MacroInvocData &invoc,
AST::InvocKind semicolon, AST::AsmKind is_global_asm);
+WARN_UNUSED_RESULT
bool
check_identifier (Parser<MacroInvocLexer> &parser, std::string ident);
check_and_set (InlineAsmContext &inline_asm_ctx, AST::InlineAsmOption option);
// From rustc
+WARN_UNUSED_RESULT
tl::expected<InlineAsmContext, InlineAsmParseError>
parse_options (InlineAsmContext &inline_asm_ctx);
// From rustc
+WARN_UNUSED_RESULT
tl::optional<AST::InlineAsmRegOrRegClass>
parse_reg (InlineAsmContext &inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::optional<std::string>
parse_format_string (InlineAsmContext &inline_asm_ctx);
+WARN_UNUSED_RESULT
tl::optional<std::string>
parse_label (Parser<MacroInvocLexer> &parser, TokenId last_token_id,
InlineAsmContext &inline_asm_ctx);