[PATCH] D119601: [analyzer] Refactor makeNull to makeNullWithWidth

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 12 18:24:48 PST 2022


NoQ added a comment.

> steakhal performed systems testing across a large set of open source projects.

I'm curious if any findings there caused you to make changes in the patch. If so it'd be great to reduce them into test cases so that other people didn't make the same mistake when they edit your new code.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:885
 
-    auto NullVal = C.getSValBuilder().makeNull();
+    auto NullVal = C.getSValBuilder().makeNullWithType(CallExpr->getType());
     // Explicitly tracking the region as null.
----------------
NoQ wrote:
> I suspect that this type is going to be `bool` which is probably not what you want.
I think it makes sense to add an assertion in `makeNullWithType()` to protect against such cases. This will probably also allow you to cover this with a test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119601



More information about the cfe-commits mailing list