Szelethus added a comment.

It would be great to see a test about properly setting the arrays extent. 
Otherwise LGTM.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp:61
+  // warned about that already.
+  // FIXME: report bug?
+  if (SizeV.isUnknown())
----------------
Hmm, why would we? The size is most probably unknown to us.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp:162-172
+  const VariableArrayType *VLALast = nullptr;
+  while (VLA) {
+    const Expr *SizeE = VLA->getSizeExpr();
+    State = checkVLASize(C, State, SizeE);
+    if (!State)
+      return;
+    SizeExpr.push_back(SizeE);
----------------
Ahaa, so if we have a `vla[x][y][a][b]` variable, `VLALast` would be `vla[x]`, 
which allows you to get the actual element type. Could you explain that (maybe 
even with a small example like this) in the code?


================
Comment at: clang/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp:194-196
+      // Binary operation not created, return with the current state set.
+      C.addTransition(State);
       return;
----------------
How about 
```
We were not able to determine extent of the array, return with the original 
state.
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77305



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

Reply via email to