[PATCH] D35216: [analyzer] Escape symbols when creating std::initializer_list.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 4 11:00:13 PDT 2017


NoQ added a comment.

In https://reviews.llvm.org/D35216#886212, @rsmith wrote:

> This is precisely how the rest of the compiler handles `CXXStdInitializerListExpr`


Wow. Cool. I'd see what I can do. Yeah, it seems that this is a great case for us to pattern-match the implementations as well (the problems are still there for other STL stuff).

Do you think this patch should be blocked? Or i can land that and follow up with complete modeling later; it'd be larger.



================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:1132
+          for (auto Child : Ex->children()) {
+            if (!Child)
+              continue;
----------------
dcoughlin wrote:
> Is this 'if' needed?
Not sure, wanted to be defensive. It seems that `CXXStdInitializerList` always contains a single child (`InitListExpr`) so it's irrelevant if the list is empty, while boxed expressions contain no children when empty, and hanging commas are ignored. Replaced with an assertion just in case.


https://reviews.llvm.org/D35216





More information about the cfe-commits mailing list