r183597 - Debug info: An if condition now creates a lexical scope of its own.

Nadav Rotem nrotem at apple.com
Mon Jun 17 14:35:33 PDT 2013


On Jun 17, 2013, at 2:32 PM, Eric Christopher <echristo at gmail.com> wrote:

> On Mon, Jun 17, 2013 at 2:29 PM, Robinson, Paul
> <Paul_Robinson at playstation.sony.com> wrote:
>>> From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-
>>> bounces at cs.uiuc.edu] On Behalf Of Eric Christopher
>>> Sent: Monday, June 10, 2013 4:05 PM
>>> To: Adrian Prantl
>>> Cc: Nadav Rotem; cfe-commits at cs.uiuc.edu
>>> Subject: Re: r183597 - Debug info: An if condition now creates a lexical
>>> scope of its own.
>>> 
>>> On Mon, Jun 10, 2013 at 3:56 PM, Adrian Prantl <aprantl at apple.com>
>>> wrote:
>>>> (CC'ing John because he understands the intricacies of LexicalScope
>>> better than I do)
>>>> 
>>>> On the first glimpse LexicalScope appears to be a subclass of
>>> RunCleanupsScope that additionally emits a (DebugInfo-)LexicalScope. But
>>> looking at the destructors it appears that they have slightly different
>>> semantics: ~LexicalScope runs ForceCleanup and ~RunCleanupsScope
>>> apparently doesn't.
>>>> 
>>>> I'm wary that switching to Lexicalscope in
>>> CodeGenFunction::EmitIfStmt() might lead to tricky ARC or EH-related
>>> problems because of that.
>>>> 
>>>> Does anyone have an opinion on that?
>>> 
>>> That bit was added here:
>>> 
>>> commit 495cfa46300979642acde8d93a1f21c9291dac98
>>> Author: Nadav Rotem <nrotem at apple.com>
>>> Date:   Sat Mar 23 06:43:35 2013 +0000
>>> 
>>>    Make clang to mark static stack allocations with lifetime markers
>>> to enable a more aggressive stack coloring.
>>>    Patch by John McCall with help by Shuxin Yang.
>>>    rdar://13115369
>>> 
>>> 
>>> and oddly not to RunCleanupsScope.
>>> 
>>> Nadav?
>>> 
>>> -eric
>> 
>> Looks like ~LexicalScope() just wants RunCleanupsScope::ForceCleanup()
>> to happen before rescopeLabels().  All the right stuff happens in the right
>> order if you change the RunCleanupsScope instance to LexicalScope.
>> (RunCleanupsScope::ForceCleanup() does pretty much exactly the same thing
>> as ~RunCleanupsScope() so it works out.  It could be done in a more obvious
>> way, but functionally they're equivalent.)
>> 
> 
> Agreed. I was just curious why Nadav changed one, but not the other.
> 
> Nadav? :)
> 
> -eric


I don’t have a good answer.  I will have to consult with John who implemented this. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130617/aff3eb53/attachment.html>


More information about the cfe-commits mailing list