[clang] a9ad689 - [clang][dataflow] Don't `assert` full LHS coverage in `optional` model

Yitzhak Mandelbaum via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 10 12:11:10 PDT 2022


Author: Sam Estep
Date: 2022-06-10T19:10:20Z
New Revision: a9ad689e352dd1037f947dacc7d01c091b67e00c

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

LOG: [clang][dataflow] Don't `assert` full LHS coverage in `optional` model

Followup to D127434.

Reviewed By: ymandel, sgatev

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

Added: 
    

Modified: 
    clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
index 993d56e44a87d..f837fe31c6cd8 100644
--- a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
@@ -450,7 +450,8 @@ void transferAssignment(const CXXOperatorCallExpr *E, BoolValue &HasValueVal,
 
   auto *OptionalLoc =
       State.Env.getStorageLocation(*E->getArg(0), SkipPast::Reference);
-  assert(OptionalLoc != nullptr);
+  if (OptionalLoc == nullptr)
+    return;
 
   State.Env.setValue(*OptionalLoc, createOptionalValue(State.Env, HasValueVal));
 


        


More information about the cfe-commits mailing list