[clang] 854c273 - [clang][dataflow] Weaken guard to only check for storage location

Eric Li via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 11:58:20 PDT 2022


Author: Eric Li
Date: 2022-05-17T18:58:07Z
New Revision: 854c273cbb7ec6745dc63cfe1951b51e9092e8ee

URL: https://github.com/llvm/llvm-project/commit/854c273cbb7ec6745dc63cfe1951b51e9092e8ee
DIFF: https://github.com/llvm/llvm-project/commit/854c273cbb7ec6745dc63cfe1951b51e9092e8ee.diff

LOG: [clang][dataflow] Weaken guard to only check for storage location

Weaken the guard for whether a sub-expression has been evaluated to
only check for the storage location, instead of checking for the
value. It should be sufficient to check for the storage location, as
we don't necessarily guarantee that a value will be set for the
location (although this is currently true right now).

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

Added: 
    

Modified: 
    clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
index a8d739c155ab..aebc9dd6f6fa 100644
--- a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
+++ b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
@@ -104,7 +104,7 @@ class TerminatorVisitor : public ConstStmtVisitor<TerminatorVisitor> {
 private:
   void extendFlowCondition(const Expr &Cond) {
     // The terminator sub-expression might not be evaluated.
-    if (Env.getValue(Cond, SkipPast::None) == nullptr)
+    if (Env.getStorageLocation(Cond, SkipPast::None) == nullptr)
       transfer(StmtToEnv, Cond, Env);
 
     // FIXME: The flow condition must be an r-value, so `SkipPast::None` should


        


More information about the cfe-commits mailing list