-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Add the 'initializes' attribute langref and support #84803
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
Changes from 1 commit
2554c82
a9256bf
9150ece
206b707
eaf5ca0
52cc649
f7fddb0
3b5955a
6a1df7a
fe2e0a5
f73df04
63c45f6
dcc2b38
9723322
e70988d
9782c31
a924dd3
45cdc34
4eeba08
502e062
fac03b8
ea3e7c5
7630510
a604b4f
f941b24
e52fd9d
8e64fa9
9ae0fca
d4809ab
99d36cc
96191cd
645f577
2a8ea9a
37edecd
80306d7
67445fe
68643a5
46e8d87
714d02f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1621,6 +1621,28 @@ Currently, only the following parameter attributes are defined: | |
``readonly`` or a ``memory`` attribute that does not contain | ||
``argmem: write``. | ||
|
||
``initialized((Lo1,Hi1),...)`` | ||
This attribute is a list of const ranges in ascending order with no | ||
overlapping or continuous. It indicates that the function initializes the | ||
memory through the pointer argument, [%p+LoN, %p+HiN): there are no reads, | ||
and no special accesses (such as volatile access or untrackable capture) | ||
before the initialization in the function. LoN/HiN are 64-bit ints; | ||
negative values are allowed in case a pointer to partway through the | ||
allocation is passed to. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: "in case the argument points partway into an allocation." ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
|
||
This attribute implies that the function initializes and does not read | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't use `This attribute only holds for the memory accessed via this pointer parameter. Other arbitrary accesses to the same memory via other pointers are allowed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
before initialization through this pointer argument, even though it may | ||
read the memory before initialization that the pointer points to, such | ||
as through other arguments. | ||
|
||
The ``writable`` or ``dereferenceable`` attribute does not imply | ||
``initialized`` attribute, and ``initialized`` does not imply ``writeonly`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: "does not imply [the] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd separate this into two sentences. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
since cases that read from the pointer after write, can be ``initialized`` | ||
but not ``writeonly``. | ||
|
||
Note that this attribute does not apply to the unwind edge: the memory may | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as mentioned in the RFC, we should be more accurate here. the part of the attribute where the memory is read from before a write still must apply on the unwind edge. Also, I'd move this up since this is important to the semantics There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, I meant that the memory is not read from before a write There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
not actually be written to when unwinding happens. | ||
|
||
``dead_on_unwind`` | ||
At a high level, this attribute indicates that the pointer argument is dead | ||
if the call unwinds, in the sense that the caller will not depend on the | ||
|
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.
nit: "with no overlapping or adjoining list elements"? or something like that (felt like it was missing a word at the end at least)
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.
We should start this off with a one sentence overview of the attribute. So starting with something like "This indicates that the function initializes the ranges of the pointer parameter's memory." Then describe what "initialize" means. Then the random details like non-overlapping/continuous ranges at the end.
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.
Done!