[clang] [clang] Emit bad shift warnings (PR #70307)
Budimir Aranđelović via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 3 06:54:37 PDT 2023
================
@@ -11773,7 +11786,25 @@ QualType Sema::CheckShiftOperands(ExprResult &LHS, ExprResult &RHS,
isScopedEnumerationType(RHSType)) {
return InvalidOperands(Loc, LHS, RHS);
}
- DiagnoseBadShiftValues(*this, LHS, RHS, Loc, Opc, LHSType);
+
+ BadShiftValueKind BSVKind =
+ DiagnoseBadShiftValues(*this, LHS, RHS, Loc, Opc, LHSType);
+ if (ExprEvalContexts.back().isConstantEvaluated()) {
----------------
budimirarandjelovicsyrmia wrote:
This solution originally was posted on [Phabricator](https://reviews.llvm.org/D141192). I reviewed commit and found that it makes more sense to diagnose bad shift values inside function DiagnoseBadShiftValues(...) instead in mentioned IF. If there are no more questions, I will edit this part of code.
https://github.com/llvm/llvm-project/pull/70307
More information about the cfe-commits
mailing list