@@ -880,7 +880,8 @@ parse_asm (location_t invoc_locus, AST::MacroInvocData &invoc,
880
880
// context.
881
881
if (resulting_context)
882
882
{
883
- auto node = (*resulting_context).inline_asm .clone_expr_without_block ();
883
+ auto resulting_ctx = resulting_context.value ();
884
+ auto node = resulting_ctx.inline_asm .clone_expr_without_block ();
884
885
885
886
std::vector<AST::SingleASTNode> single_vec = {};
886
887
@@ -1177,25 +1178,27 @@ parse_llvm_asm (location_t invoc_locus, AST::MacroInvocData &invoc,
1177
1178
1178
1179
auto asm_ctx = LlvmAsmContext (llvm_asm, parser, last_token_id);
1179
1180
1180
- auto resulting_context
1181
+ tl::optional<LlvmAsmContext> resulting_context
1181
1182
= parse_llvm_templates (asm_ctx).and_then (parse_llvm_arguments);
1182
1183
1183
1184
if (resulting_context)
1184
1185
{
1185
- auto node = (*resulting_context).llvm_asm .clone_expr_without_block ();
1186
+ auto resulting_ctx = resulting_context.value ();
1187
+ auto node = resulting_ctx.llvm_asm .clone_expr_without_block ();
1186
1188
1187
1189
std::vector<AST::SingleASTNode> single_vec = {};
1188
1190
1189
1191
// If the macro invocation has a semicolon (`asm!("...");`), then we
1190
1192
// need to make it a statement. This way, it will be expanded
1191
1193
// properly.
1192
1194
if (semicolon == AST::InvocKind::Semicoloned)
1193
- single_vec.emplace_back (AST::SingleASTNode (
1194
- std::make_unique<AST::ExprStmt> (std::move (node), invoc_locus,
1195
- semicolon
1196
- == AST::InvocKind::Semicoloned)));
1195
+ {
1196
+ single_vec.emplace_back (
1197
+ std::make_unique<AST::ExprStmt> (std::move (node), invoc_locus,
1198
+ true /* has semicolon */ ));
1199
+ }
1197
1200
else
1198
- single_vec.emplace_back (AST::SingleASTNode ( std::move (node) ));
1201
+ single_vec.emplace_back (std::move (node));
1199
1202
1200
1203
AST::Fragment fragment_ast
1201
1204
= AST::Fragment (single_vec,
0 commit comments