[PATCH] D71791: [CFG] Fix an assertion failure with static initializers

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 21 15:41:10 PST 2019


Szelethus added a comment.

> I am not sure what would be the best way to test this change here.

I'll admit, I'm a bit out of touch with Clang and will unfortunately be for a while, but the short answer is that the unit tests we have for the CFG are kinda bad. The constructed CFG has a longer lifetime than the AST its based on (see: D63538 <https://reviews.llvm.org/D63538>), so we would need to rewrite the `BuildCFG()` function that creates it. I have some memories digging into it but always got distracted :)

Until then, could you please include the crash you mentioned through a regular lit test?



================
Comment at: clang/lib/Analysis/CFG.cpp:5925-5926
 
   // Only ObjCForCollectionStmt is known not to be a non-Expr terminator, hence
   // the cast<>.
   return cast<Expr>(Cond)->IgnoreParens();
----------------
I guess its time to update and/or move this comment a few lines up, maybe even add a descriptive assert.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71791





More information about the cfe-commits mailing list