[PATCH] D120134: [analyzer] refactor makeIntValWithPtrWidth, remove getZeroWithPtrWidth (NFC)

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 22 10:15:55 PDT 2022


NoQ added a comment.

Looks like the API was used incorrectly 50% of the time anyway :)

I have one nit but other than that looks good.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2570
+      State, TotalSize.castAs<DefinedOrUnknownSVal>(),
+      svalBuilder.makeIntValWithPtrWidth(Arg1->getType(), 0));
 
----------------
steakhal wrote:
> We peobably wanted to use a different tspe for this expressuon. 'getArrayIndexType()' is a better fit IMO.
> We shall see.
`TotalSize` is literally `size_t` so `ASTContext.getSizeType()` is the right type. `getArrayIndexType()` is signed so it's different.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120134



More information about the cfe-commits mailing list