aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Analysis
diff options
context:
space:
mode:
authorMalavikaSamak <malavika2@apple.com>2022-12-15 11:02:46 -0800
committerMalavikaSamak <malavika2@apple.com>2022-12-15 12:09:01 -0800
commit678ded017f21b22da3ab20ffafe2bc2dc4457493 (patch)
treedda6dfda6ac187fe40db8d8ee9356cae3ea1b509 /llvm/unittests/Analysis
parent39fe657b66bde11289efbab60a4d69acc1307999 (diff)
downloadllvm-678ded017f21b22da3ab20ffafe2bc2dc4457493.zip
llvm-678ded017f21b22da3ab20ffafe2bc2dc4457493.tar.gz
llvm-678ded017f21b22da3ab20ffafe2bc2dc4457493.tar.bz2
[clang] Support for read-only types
The main goal of this work is to allow developers to express the need to place instances of a class or structure in the read-only part of the program memory. Such a placement is desirable to prevent any further modifications to the instances of a given structure, by leveraging the read-only run time protection. To achieve this, we are introducing a new attribute that can be attached to any record definition or a declaration. The compiler enforces that every instance of this type can be placed in the read-only segment of the program memory, provided the target triplet supports such a placement. If an instance of a given type bearing this attribute doesn’t satisfy such a placement, the compiler attaches an appropriate warning at suitable program locations. In other words, adding this attribute to a type requires every instance of this type to be a global const, which are placed in the read-only segments for most target triplets. However, this is *not a language feature* and it *need not* be true for *all target triplets*. The current patch emits a warning at global variable declaration sites of types bearing the attribute without const qualification and corresponding note attached to the type definition/declaration. Differential Revision: https://reviews.llvm.org/D135851
Diffstat (limited to 'llvm/unittests/Analysis')
0 files changed, 0 insertions, 0 deletions