[PATCH] D45774: [analyzer] cover more cases where a Loc can be bound to constants

Rafael Stahl via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 4 00:26:30 PDT 2018


r.stahl added inline comments.


================
Comment at: lib/StaticAnalyzer/Core/RegionStore.cpp:1723
+        if (const InitListExpr *InitList = dyn_cast<InitListExpr>(Init)) {
+          if (const Expr *FieldInit = InitList->getInit(FD->getFieldIndex())) {
+            if (Optional<SVal> V = svalBuilder.getConstantVal(FieldInit))
----------------
NoQ wrote:
> This method crashes when the index is out of range. Not sure - is it possible to skip a few fields in the list? Would the list's AST automatically contain any placeholders in this case?
Good catch, but I don't think this is an issue. When testing InitListExpr with missing inits, they get filled with ImplicitValueInitExpr.


https://reviews.llvm.org/D45774





More information about the cfe-commits mailing list