diff options
author | wheatman <wheatman@users.noreply.github.com> | 2023-12-04 00:49:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-04 06:49:37 +0100 |
commit | 0031efe6be19735402656a76b64a173d17f1f935 (patch) | |
tree | 3f52f904c07c244c1466c151c61341259e563990 /llvm/lib/CodeGen/MachineCSE.cpp | |
parent | f4b1f44cb570a61533a876ca1dfaefd87b902485 (diff) | |
download | llvm-0031efe6be19735402656a76b64a173d17f1f935.zip llvm-0031efe6be19735402656a76b64a173d17f1f935.tar.gz llvm-0031efe6be19735402656a76b64a173d17f1f935.tar.bz2 |
Remove warnings from -Wchar-subscripts for known positive constants (#69061)
Fixes #18763
Remove warnings when using a signed char as an array bound if the char is a known positive constant.
This goes one step farther than gcc does.
For example given the following code
```c++
char upper[300];
int main() {
upper['a'] = 'A';
char b = 'a';
upper[b] = 'A';
const char c = 'a';
upper[c] = 'A';
constexpr char d = 'a';
upper[d] = 'A';
char e = -1;
upper[e] = 'A';
const char f = -1;
upper[f] = 'A';
constexpr char g = -1;
upper[g] = 'A';
return 1;
}
```
clang currently gives warnings for all cases, while gcc gives warnings
for all cases except for 'a' (https://godbolt.org/z/5ahjETTv3)
With the change there is no longer any warning for 'a', 'c', or 'd'.
Diffstat (limited to 'llvm/lib/CodeGen/MachineCSE.cpp')
0 files changed, 0 insertions, 0 deletions