aboutsummaryrefslogtreecommitdiff
path: root/src/ast_render.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-03-20 19:00:23 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-03-20 19:00:23 -0400
commit15c316b0d8152c0a1ad5b4b26efdf3fdc8cfb4c0 (patch)
tree0bd91c0ba2a63ed3495e94385fbedaa1e3a6fde0 /src/ast_render.cpp
parent3c7555cb679492f3f1c0ce320cbdf4a3769e56db (diff)
downloadzig-15c316b0d8152c0a1ad5b4b26efdf3fdc8cfb4c0.tar.gz
zig-15c316b0d8152c0a1ad5b4b26efdf3fdc8cfb4c0.zip
add docs for assembly and fix global assembly parsing
Previously, global assembly was parsed expecting it to have the template syntax. However global assembly has no inputs, outputs, or clobbers, and thus does not have template syntax. This is now fixed. This commit also adds a compile error for using volatile on global assembly, since it is meaningless. closes #1515
Diffstat (limited to 'src/ast_render.cpp')
-rw-r--r--src/ast_render.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ast_render.cpp b/src/ast_render.cpp
index 84a952fa99..eb4b4e56c4 100644
--- a/src/ast_render.cpp
+++ b/src/ast_render.cpp
@@ -862,8 +862,8 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) {
case NodeTypeAsmExpr:
{
AstNodeAsmExpr *asm_expr = &node->data.asm_expr;
- const char *volatile_str = asm_expr->is_volatile ? " volatile" : "";
- fprintf(ar->f, "asm%s (\"%s\"\n", volatile_str, buf_ptr(asm_expr->asm_template));
+ const char *volatile_str = (asm_expr->volatile_token != nullptr) ? " volatile" : "";
+ fprintf(ar->f, "asm%s (\"%s\"\n", volatile_str, buf_ptr(&asm_expr->asm_template->data.str_lit.str));
print_indent(ar);
fprintf(ar->f, ": ");
for (size_t i = 0; i < asm_expr->output_list.length; i += 1) {