[PATCH] D120134: [analyzer] refactor makeIntValWithPtrWidth, remove getZeroWithPtrWidth (NFC)
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 18 13:59:29 PST 2022
steakhal added inline comments.
================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h:335
- NonLoc makeIntValWithPtrWidth(uint64_t integer, bool isUnsigned) {
- return nonloc::ConcreteInt(
- BasicVals.getIntWithPtrWidth(integer, isUnsigned));
+ NonLoc makeIntValWithPtrWidth(QualType ptrType, uint64_t integer) {
+ return nonloc::ConcreteInt(BasicVals.getValue(integer, ptrType));
----------------
This function should have a different name.
Probbaly the `makeIntValWithWidth()` is a better alternative.
Ah but even this is far less than ideal.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2570
+ State, TotalSize.castAs<DefinedOrUnknownSVal>(),
+ svalBuilder.makeIntValWithPtrWidth(Arg1->getType(), 0));
----------------
We peobably wanted to use a different tspe for this expressuon. 'getArrayIndexType()' is a better fit IMO.
We shall see.
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