NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Looks good!

Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:291
@@ +290,3 @@
+  static ProgramStateRef addExtentSize(CheckerContext &C,
+                                             const CXXNewExpr *NE,
+                                             ProgramStateRef State
Whitespace a bit strange.

Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:997
@@ +996,3 @@
+ProgramStateRef MallocChecker::addExtentSize(CheckerContext &C,
+                                             const CXXNewExpr *NE,
>> Perhaps ExprEngine would be the proper place for that code as well.

> Interesting point. Can you clarify the last sentence?

I'm thinking that the standard operator new() should be properly modeled by the 
analyzer core; we are already doing this with respect to memory space of the 
region it returns, why not do that for extent as well, somewhere at the same 

We could probably make a refactoring pass over `MallocChecker` to move things 
around and return it to a readable state.

Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1011
@@ +1010,3 @@
+    // containing the elements.
+    Region = (State->getSVal(NE, LCtx))
+                 .getAsRegion()
dkrupp wrote:
> MemRegion has now method called castAs<>, only getAs<>, so I stayed with it.
Ouch, i meant, `cast<SubRegion>(State->getSVal(NE, LCtx).getAsRegion())` etc.

cfe-commits mailing list

Reply via email to