]> granicus.if.org Git - clang/commitdiff
[NFC] Strenghten preconditions for warning
authorDavid Bolvansky <david.bolvansky@gmail.com>
Tue, 24 Sep 2019 20:10:57 +0000 (20:10 +0000)
committerDavid Bolvansky <david.bolvansky@gmail.com>
Tue, 24 Sep 2019 20:10:57 +0000 (20:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372775 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaChecking.cpp

index 02c0d489ae0d89acdabde17999e939baf65bba34..28f4e06cd7278a0611afe26ebf9afeca8642b243 100644 (file)
@@ -11321,7 +11321,8 @@ static void DiagnoseIntInBoolContext(Sema &S, Expr *E) {
       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);