-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pointer value improvements #789
Conversation
Arrays decay to pointer values Handle address-of locals as well as globals
test/cases/ast/_Float16.c
Outdated
@@ -30,7 +30,7 @@ fn_def: 'fn (x: int, ...) void' | |||
builtin_call_expr: 'void' | |||
name: __builtin_va_start | |||
args: | |||
implicit_cast: (array_to_pointer) 'va_list': '*d[1]struct __va_list_tag' | |||
implicit_cast: (array_to_pointer) 'va_list': '*d[1]struct __va_list_tag' (value: ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if pointer values printed the offset (if non-zero).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to ask about this - should I just print the offset (without the name of the variable)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Printing the NodeIndex
probably won't be too useful so I guess just the offset is good for now. Maybe add something to distinguish it from just ints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we change the return type of Value.print
from @TypeOf(w).Error!void
to something like @TypeOf(w).Error!?NestedPrint
where NestedPrint
is
const NestedPrint = union(enum) {
pointer: struct {
node: u32,
offset: Value,
},
};
and then the caller can handle it?
Allow array-to-pointer decay to produce a pointer value
Handle address-of locals as well as globals
Rename "reloc" to pointer for consistency