r372775 - [NFC] Strenghten preconditions for warning
David Bolvansky via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 24 13:10:57 PDT 2019
Author: xbolva00
Date: Tue Sep 24 13:10:57 2019
New Revision: 372775
URL: http://llvm.org/viewvc/llvm-project?rev=372775&view=rev
Log:
[NFC] Strenghten preconditions for warning
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=372775&r1=372774&r2=372775&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue Sep 24 13:10:57 2019
@@ -11321,7 +11321,8 @@ static void DiagnoseIntInBoolContext(Sem
const auto *RHS = getIntegerLiteral(BO->getRHS());
if (LHS && LHS->getValue() == 0)
S.Diag(ExprLoc, diag::warn_left_shift_always) << 0;
- else if (RHS && RHS->getValue().isNonNegative() &&
+ else if (!E->isValueDependent() && LHS && RHS &&
+ RHS->getValue().isNonNegative() &&
E->EvaluateAsInt(Result, S.Context, Expr::SE_AllowSideEffects))
S.Diag(ExprLoc, diag::warn_left_shift_always)
<< (Result.Val.getInt() != 0);
More information about the cfe-commits
mailing list