NoQ added a comment.

A slower explanation of the approach in '3.' in the previous message:

(1) Evaluate operator new() aka the allocator call as usual.
(2) Take the return value of (1) as usual.
(3) Take `CXXConstructExpr` which is the child of the `CXXNewExpr` that 
triggered the allocator call on (1).
(4) Construct a `StackFrameContext` with `CXXConstructExpr` from (3).
(5) //**Don't**// put the newly constructed `StackFrameContext` on the location 
context stack.
(6) Construct the `StackArgumentsSpaceRegion` for the `StackFrameContext` from 
(4).
(7) Construct the `CXXThisRegion` for the `StackArgumentsSpaceRegion` from (6).
(8) Bind the return value from (2) to `CXXThisRegion` from (7) in the Store.
(9) Put the node with the state from (8) to the worklist as usual.
(10) `CoreEngine` says it's time to evaluate `CXXConstructExpr` from (3) as 
usual.
(11) Make sure that the binding we made in (8) survives garbage collection*.
(11) Construct `StackFrameContext` for the `CXXConstructExpr` from (3) as usual.
(12) `LocationContextManager` ensures that on (4) and on (11) we get //the 
same// `StackFrameContext`.
(13) //**Don't**// bind `CXXThisRegion` while entering the stack frame - it was 
already done in (8).
(14) Finally enter the stack frame we've constructed twice on (4) and on (11), 
as usual.
(15) Evaluate the constructor, as usual.
(16) Bind this-value to `CXXConstructExpr` after evaluation (as usual? not 
sure).
(17) Allow the binding in the Store we made on (8) to be garbage-colllected as 
usual.
(18) When evaluating `CXXNewExpr`, take value of `CXXConstructExpr` and bind it 
to `CXXNewExpr`.

__
*We  may modify `SymbolReaper::isLiveRegion()` for this purpose. Sounds easy.


https://reviews.llvm.org/D40560



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

Reply via email to