Hi All,

 

Please find attached a patch which teaches clang to emit lifetime.start /
lifetime.end markers for unnamed temporary objects.

 

This patch can greatly reduce the stack usage of some C++ code, where it is
so easy to have short lived unnamed temporaries.

 

As noted in the subject, this is my third attempt: my previous attempts
failed to handle correctly the lifetime extended temporaries, and I have had
a hard time to understand the CleanupScope. It all boiled down to the fact
that the body of a function is not considered a full CleanupScope (for debug
information reasons), so in the case of lifetime extended objects at the top
level of the function body, with a trivial destructor  + lifetime.end
marker, the lifetime markers were simply not considered, firing an assert in
~CodeGenFunction. All cases are now covered by testcases.

 

I would appreciate if someone knowledgeable with the lifetime extended
temporaries & cleanup scopes could give a look to this patch.

 

Cheers,

--

Arnaud A. de Grandmaison

 

Attachment: 0001-Emit-lifetime.start-lifetime.end-markers-for-unnamed.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to