Skip to content

Commit 09a54e9

Browse files
author
jeff
committed
Edit ClangRandstruct entry in AttrDocs.td
1 parent 7272914 commit 09a54e9

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

clang/include/clang/Basic/AttrDocs.td

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4102,44 +4102,42 @@ def ClangRandstructDocs : Documentation {
41024102
let Heading = "randomize_layout, no_randomize_layout";
41034103
let Content = [{
41044104
The attributes ``randomize_layout`` and ``no_randomize_layout`` can be applied
4105-
to a C struct or class(???).
4105+
to a record.
41064106

4107-
``randomize_layout`` instructs the compiler to randomize the memory location
4108-
of the member variables of the struct or class(???). Functions will not be
4109-
shuffled, unless in the event that the member is a function pointer, then it
4110-
will be shuffled as a normal member variable.
4107+
``randomize_layout`` instructs the compiler to randomize the memory layout
4108+
of the member variables of the record.
41114109

41124110
Conversely, ``no_randomize_layout`` is used to indicate that if using the
4113-
Automatic Strucuture Selection feature of the Randstruct implementation, the
4114-
compiler should not shuffle the members of the struct.
4111+
automatic strucuture selection feature of the Randstruct implementation, the
4112+
compiler should not shuffle the members of the record.
41154113

4116-
If in the event that a struct or class(???) is labeled with both attributes,
4117-
the compiler will emit a warning indicating that these two cannot be used on
4118-
the same struct of class(???). The default behavior in this case is to not
4119-
randomize the struct, as the attribute ``no_randomize_layout`` takes precedence
4120-
over ``randomize_layout``.
4114+
In the event that a record is labeled with both attributes, the compiler will
4115+
emit a warning indicating that these two cannot be used on the same record.
4116+
The default behavior in this case is to not randomize the struct, as the
4117+
attribute ``no_randomize_layout`` takes precedence over ``randomize_layout``.
4118+
This is implementation defined behavior.
41214119

41224120
.. code-block:: c
41234121

41244122
// Indicates that this struct should be randomized by Randstruct implementation.
4125-
struct __attribute__((randomize_layout)) s {
4123+
struct s {
41264124
char *a;
41274125
char *b;
41284126
char *c;
4129-
};
4127+
}__attribute__((randomize_layout));
41304128

41314129
// Indicates that this struct should NOT be randomized by Randstruct implementation.
4132-
struct __attribute__((no_randomize_layout)) s {
4130+
struct s {
41334131
char *a;
41344132
char *b;
41354133
char *c;
4136-
};
4134+
}__attribute__((no_randomize_layout));
41374135

41384136
// Emits compiler warning. Struct is NOT randomized by Randstruct implementation.
4139-
struct __attribute__((randomize_layout)) __attribute__((no_randomize_layout)) s {
4137+
struct s {
41404138
char *a;
41414139
char *b;
41424140
char *c;
4143-
};
4141+
}__attribute__((randomize_layout)) __attribute__((no_randomize_layout));
41444142
}];
41454143
}

0 commit comments

Comments
 (0)