NoQ added inline comments.
================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2369
   ProgramStateRef state = C.getState();
-  RegionStateTy RS = state->get<RegionState>();
+  RegionStateTy OldRS = state->get<RegionState>();
   RegionStateTy::Factory &F = state->get_context<RegionState>();
----------------
Szelethus wrote:
> george.karpenkov wrote:
> > Szelethus wrote:
> > > We are acquiring an object of type `ImmutableMap`, modify it, and put it 
> > > back into `state`? Can't we just modify it through `ProgramState`'s 
> > > interface directly?
> > state is immutable, I don't think we can put anything into it.
> > We also can't modify ImmutableMap because, well, it's immutable.
> Poor choice of words, I admit. What I actually meant is that maybe it would 
> be more straighforward if we didnt create a local varable here. But I'm fine 
> with being in the wrong :)
Manipulating maps directly is slightly cheaper because for every operation you 
only create a new map but not a new state. I have no indication that this 
optimization is worth the effort, but i also have no indication that 
pessimizing it back is worth the effort.


https://reviews.llvm.org/D54013



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to