This is an archive of the discontinued LLVM Phabricator instance.

[CFG] [analyzer] Heavier CFGCXXRecordTypedCall elements.
ClosedPublic

Authored by NoQ on Mar 5 2018, 3:20 PM.

Details

Summary

D42672 has added extra context to construction calls in the CFG so that the users, such as the analyzer, didn't have to peek ahead in order to figure out what sort of constructor is being called. The same seems to be necessary for arbitrary functions that return C++ objects by value (as opposed to by reference).

One of the use cases for such extra context at the call site would be to perform any sort of inter-procedural analysis that involves functions returning objects by value. In this case the elidable constructor at the return site would construct the object explained by the context at the call site, and its lifetime would also be managed by the caller, not the callee.

The extra context would also be useful for properly handling the return-value temporary at the call site, even if the callee is not being analyzed inter-procedurally.

Diff Detail

Repository
rC Clang

Event Timeline

NoQ created this revision.Mar 5 2018, 3:20 PM
dcoughlin accepted this revision.Mar 5 2018, 5:03 PM

This looks good to me. I'm not super happy with the name "CFGValueTypedCall" since it doesn't make it obvious that is reflects "a function call that returns a C++ object by value."

Is "CFGCallReturningObjectByValue" too long?

This revision is now accepted and ready to land.Mar 5 2018, 5:03 PM
NoQ updated this revision to Diff 137116.Mar 5 2018, 7:01 PM

Agreed to rename into CFGCXXRecordTypedCall. Because, yeah, int is a value as well.

NoQ retitled this revision from [CFG] [analyzer] Heavier CFGValueTypedCall elements. to [CFG] [analyzer] Heavier CFGCXXRecordTypedCall elements..Mar 5 2018, 7:08 PM
This revision was automatically updated to reflect the committed changes.