[PATCH] D82122: [analyzer][Liveness][RFC][NFC] Propose to turn statement liveness into expression liveness

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 20 04:44:18 PDT 2020


Szelethus marked an inline comment as done.
Szelethus added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/Environment.cpp:193
+
+    assert((isa<Expr>(BlkExpr.getStmt()) || !IsBlkExprLive) &&
+           "Only Exprs can be live, LivenessAnalysis argues about the liveness "
----------------
>>! In D82122#2103638, @NoQ wrote:
> I think you're right, this entire thing only makes sense for expressions. I think `Environment` occasionally carries values of `ReturnStmt`s (by which it means values of their sub-expressions) but even then liveness analysis doesn't need to be aware of that flex.
> 
>> no lit tests crashed on the added asserts
> 
>> the only non-expression statement it queries are `ObjCForCollectionStmt`s
> 
> Wait, how did you figure that out if not through crashing tests?

```lang=c++
if (IsBlkExprLive && !isa<Expr>(BlkExpr.getStmt()) {
  BlkExpr.getStmt()->dump();
  llvm_unreachable("Gotcha!");
}



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82122





More information about the cfe-commits mailing list