[PATCH] D123858: [clang][dataflow] Ensure well-formed flow conditions.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 19 11:37:40 PDT 2022


ymandel added a comment.

Thanks for the review!



================
Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:110
 
+    // FIXME: The flow condition must be an r-value, so `SkipPast::None` should
+    // suffice.
----------------
xazax.hun wrote:
> I am still not convinced why would we ever need `SkipPast`, as the AST will always have the necessary LValueToRValue conversions when we need to look past references. But this is unrelated to this patch.
Agreed. But, I tried to pull out the `SkipPast` and it crashed (hence the FIXME). I'll try to track down what's happening, but it may be related to our conflation of `ReferenceValue` for normal lvalues and reference-typed declarations. Regardless, we want to reconsider our treatment of the different value classes.


================
Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:119
+    if (Val == nullptr) {
+      auto *Loc = Env.getStorageLocation(Cond, SkipPast::None);
+      if (Loc == nullptr) {
----------------
xazax.hun wrote:
> I think this get or create pattern is getting more and more widespread. At some point we might want a helper.
agreed. Added fixme.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123858/new/

https://reviews.llvm.org/D123858



More information about the cfe-commits mailing list