[PATCH] D69726: [analyzer] DynamicSize: Store the dynamic size

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 1 13:15:02 PDT 2019


NoQ added inline comments.


================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicSize.h:29-31
+/// \returns The stored dynamic size expression for the region \p MR.
+const Expr *getDynamicSizeExpr(ProgramStateRef State, const MemRegion *MR);
+
----------------
Why do we need this?


================
Comment at: clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp:1073
+
+    setDynamicSize(State, BR, *SizeNL, Size);
 
----------------
Charusso wrote:
> That dual assumption made changes in the test files, and there is no other dual assumption.
Wait, this code should not have been changed. It's not an allocation site, we don't receive any new information about the size of the region here.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp:180
-  // Assume should not fail at this point.
-  assert(state);
 
----------------
This gets rid of the assertion failure in https://bugs.llvm.org/show_bug.cgi?id=28450 by implementing my suggestion (2). Yay.


Repository:
  rC Clang

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

https://reviews.llvm.org/D69726





More information about the cfe-commits mailing list