shafik added inline comments.

================
Comment at: clang/include/clang/AST/APValue.h:511-512
   bool hasArrayFiller() const {
+    if (!isArray())
+      return false;
     return getArrayInitializedElts() != getArraySize();
----------------
aaron.ballman wrote:
> I think this makes the interface somewhat self-inconsistent. 
> `hasLValuePath()` asserts on `isLValue()`, and `getArraySize()` was providing 
> a similar assertion (on `isArray()`) when called from `hasArrayFiller()`.
> 
> I take that to mean that the expectation for this interface is that the 
> caller validates the `APValue` in the cases where it doesn't already know the 
> answer.
I agree with Aaron here, the correct place to fix this is in 
`VisitInitListExpr` and check `Result.isArray()`.




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

https://reviews.llvm.org/D128248

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to