Author: Piotr Zegar
Date: 2023-08-27T11:59:03Z
New Revision: 9f8220969cc8c52565d6f9b932e1934513e0c1bb

URL: 
https://github.com/llvm/llvm-project/commit/9f8220969cc8c52565d6f9b932e1934513e0c1bb
DIFF: 
https://github.com/llvm/llvm-project/commit/9f8220969cc8c52565d6f9b932e1934513e0c1bb.diff

LOG: [clang-tidy][NFC] Fix clang-analyzer-core.UndefinedBinaryOperatorResult 
findings

Fix issues found by clang-tidy in clang-tidy source directory.

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp 
b/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp
index e25708d4c05554..197fa812501601 100644
--- a/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp
@@ -171,7 +171,7 @@ bool UnrollLoopsCheck::hasLargeNumIterations(const Stmt 
*Statement,
   const Stmt *Initializer = ForLoop->getInit();
   const Expr *Conditional = ForLoop->getCond();
   const Expr *Increment = ForLoop->getInc();
-  int InitValue;
+  int InitValue = 0;
   // If the loop variable value isn't known, we can't know the loop bounds.
   if (const auto *InitDeclStatement = dyn_cast<DeclStmt>(Initializer)) {
     if (const auto *VariableDecl =
@@ -183,12 +183,12 @@ bool UnrollLoopsCheck::hasLargeNumIterations(const Stmt 
*Statement,
     }
   }
 
-  int EndValue;
+  int EndValue = 0;
   const auto *BinaryOp = cast<BinaryOperator>(Conditional);
   if (!extractValue(EndValue, BinaryOp, Context))
     return true;
 
-  double Iterations;
+  double Iterations = 0.0;
 
   // If increment is unary and not one of ++, --, we can't know the loop 
bounds.
   if (const auto *Op = dyn_cast<UnaryOperator>(Increment)) {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to