[PATCH] Emit lifetime start/end for unnamed objects --- take 3

Arnaud A. de Grandmaison arnaud.degrandmaison at arm.com
Mon Sep 15 16:05:03 PDT 2014


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

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140916/4feacf88/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Emit-lifetime.start-lifetime.end-markers-for-unnamed.patch
Type: application/octet-stream
Size: 23212 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140916/4feacf88/attachment.obj>


More information about the cfe-commits mailing list