[clang] 90a6e35 - [analyzer][NFC] Merge similar conditional paths

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 7 08:35:35 PST 2022


Author: phyBrackets
Date: 2022-03-07T22:05:27+05:30
New Revision: 90a6e3547863922ede7e2df1a1a650d1ef7d040a

URL: https://github.com/llvm/llvm-project/commit/90a6e3547863922ede7e2df1a1a650d1ef7d040a
DIFF: https://github.com/llvm/llvm-project/commit/90a6e3547863922ede7e2df1a1a650d1ef7d040a.diff

LOG: [analyzer][NFC] Merge similar conditional paths

Reviewed By: aaron.ballman, steakhal

Differential Revision: https://reviews.llvm.org/D121045

Added: 
    

Modified: 
    clang/docs/DataFlowAnalysisIntro.md
    clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp

Removed: 
    


################################################################################
diff  --git a/clang/docs/DataFlowAnalysisIntro.md b/clang/docs/DataFlowAnalysisIntro.md
index 9aee197d5746a..8bfecd24906cb 100644
--- a/clang/docs/DataFlowAnalysisIntro.md
+++ b/clang/docs/DataFlowAnalysisIntro.md
@@ -287,7 +287,7 @@ out = transfer(basic_block, join(in_1, in_2, ..., in_n))
 
 (Note that there are other ways to write this equation that produce higher
 precision analysis results. The trick is to keep exploring the execution paths
-separately and delay joining until later. Hoowever, we won't discuss those
+separately and delay joining until later. However, we won't discuss those
 variations here.)
 
 To make a conclusion about all paths through the program, we repeat this

diff  --git a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
index 8070d869f6785..2102f9233bc10 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
@@ -107,11 +107,8 @@ LookThroughTransitiveAssignmentsAndCommaOperators(const Expr *Ex) {
       dyn_cast<BinaryOperator>(Ex->IgnoreParenCasts());
     if (!BO)
       break;
-    if (BO->getOpcode() == BO_Assign) {
-      Ex = BO->getRHS();
-      continue;
-    }
-    if (BO->getOpcode() == BO_Comma) {
+    BinaryOperatorKind Op = BO->getOpcode();
+    if (Op == BO_Assign || Op == BO_Comma) {
       Ex = BO->getRHS();
       continue;
     }


        


More information about the cfe-commits mailing list