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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 20 14:02:42 PST 2020


NoQ added a comment.
Herald added subscribers: martong, steakhal.

Hmm, has this patch not landed yet? I was so excited to finally have https://bugs.llvm.org/show_bug.cgi?id=28450 fixed :)



================
Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:767
+      DefinedOrUnknownSVal Size = UnknownVal();
+      if (const Expr *SizeExpr = CNE->getArraySize().getValueOr(nullptr))
+        Size = State->getSVal(SizeExpr, LCtx).castAs<DefinedOrUnknownSVal>();
----------------
This looks like an object count, we'll need to convert it to size in bytes because that's what extent is.


================
Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:698
+      DefinedOrUnknownSVal Size = UnknownVal();
+      if (const Expr *SizeExpr = CNE->getArraySize().getValueOr(nullptr))
+        Size = State->getSVal(SizeExpr, LCtx).castAs<DefinedOrUnknownSVal>();
----------------
Same. I guess we should add a test for both cases, given that nothing failed when we screwed up the extent.


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

https://reviews.llvm.org/D69726





More information about the cfe-commits mailing list