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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 21 19:37:08 PST 2019


NoQ added a comment.

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

A unittest, if you're brave :)



================
Comment at: clang/lib/Analysis/CFG.cpp:5923
+  if (isa<ObjCForCollectionStmt>(Cond) || isa<DeclStmt>(Cond))
     return nullptr;
 
----------------
Charusso wrote:
> What about the following?:
> ```lang=c
> if (const auto *E = dyn_cast<Expr>(StmtElem->getStmt()))
>   return E->IgnoreParens();
> return nullptr;
> ```
Not [[ https://llvm.org/docs/CodingStandards.html#assert-liberally | fail-fast ]] enough.


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