Commit e13fcff
Disallow cast from other checked pointer types to nt_array_ptr in
checked scopes because the source pointer might not point to a
NULL_terminated array. Casting from an unchecked pointer to a
nt_array_ptr pointer should also be prohibited; this has already been
handled as no unchecked pointers are allowed in checked scopes.
Also added a new error message in
clang/include/clang/Basic/DiagnosticSemaKinds.td for casting to
nt_array_ptr in checked scopes.
The test file tests/typechecking/checked_scope_basic.c was updated
with a new function test_cast_to_nt_array_ptr to test
casting to nt_array_ptr.
1 parent d22ea7f commit e13fcff
File tree
2 files changed
+17
-0
lines changed- include/clang/Basic
- lib/Sema
2 files changed
+17
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9867 | 9867 | | |
9868 | 9868 | | |
9869 | 9869 | | |
| 9870 | + | |
| 9871 | + | |
| 9872 | + | |
| 9873 | + | |
9870 | 9874 | | |
9871 | 9875 | | |
9872 | 9876 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2700 | 2700 | | |
2701 | 2701 | | |
2702 | 2702 | | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
2703 | 2716 | | |
2704 | 2717 | | |
2705 | 2718 | | |
| |||
0 commit comments