[PATCH] D131704: [Clang] Tighten restrictions on enum out of range diagnostic

2022-08-12 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment. In D131704#3719954 , @thakis wrote: >> This is constant initialization, so this is indeed expected. > > Do we have a test for this in clang? It seems that the diag appeared for that > case after the change that turned this diag in

[PATCH] D131704: [Clang] Tighten restrictions on enum out of range diagnostic

2022-08-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment. In D131704#3717950 , @shafik wrote: > In D131704#3717774 , @akhuang wrote: > >> We're seeing this warning in code with global constants, e.g. >> >> const Enum x = static_cast(-1); >> >> i

[PATCH] D131704: [Clang] Tighten restrictions on enum out of range diagnostic

2022-08-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment. > This is constant initialization, so this is indeed expected. Do we have a test for this in clang? It seems that the diag appeared for that case after the change that turned this diag into a disable-able warning. Given it's intentional, we should make sure we test that

[PATCH] D131704: [Clang] Tighten restrictions on enum out of range diagnostic

2022-08-11 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment. In D131704#3717774 , @akhuang wrote: > We're seeing this warning in code with global constants, e.g. > > const Enum x = static_cast(-1); > > is this intended? This is constant initialization, so this is indeed expected. Dependi

[PATCH] D131704: [Clang] Tighten restrictions on enum out of range diagnostic

2022-08-11 Thread Amy Huang via Phabricator via cfe-commits
akhuang added a comment. We're seeing this warning in code with global constants, e.g. const Enum x = static_cast(-1); is this intended? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131704/new/ https://reviews.llvm.org/D131704 ___

[PATCH] D131704: [Clang] Tighten restrictions on enum out of range diagnostic

2022-08-11 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment. Ok it looks like this is a bit more subtle, I broke the llvm-test-suite file `paq8p.cpp` again. We need both conditions to be true `Info.EvalMode == EvalInfo::EM_ConstantExpression && Info.InConstantContext`. We need to be in a context that requires a constant value but

[PATCH] D131704: [Clang] Tighten restrictions on enum out of range diagnostic

2022-08-11 Thread Shafik Yaghmour via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG2608f553b8fd: [Clang] Tighten restrictions on enum out of range diagnostic (authored by shafik). Herald added a project: clang. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://r

[PATCH] D131704: [Clang] Tighten restrictions on enum out of range diagnostic

2022-08-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM presuming precommit CI comes back clean. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131704/new/ https://reviews.llvm.org/D131704 ___

[PATCH] D131704: [Clang] Tighten restrictions on enum out of range diagnostic

2022-08-11 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik created this revision. shafik added reviewers: erichkeane, aaron.ballman, thakis. Herald added a project: All. shafik requested review of this revision. In D131528 using `Info.EvalMode == EvalInfo::EM_ConstantExpression` is not strict enough to restrict t