<br><br><div>On Mon Jan 06 2014 at 8:29:19 AM, Adrian Prantl <<a href="mailto:aprantl@apple.com">aprantl@apple.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Jan 5, 2014, at 8:22 PM, <a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a> wrote:<br>
<br>
><br>
><br>
> On Fri Jan 03 2014 at 4:00:30 PM, Adrian Prantl <<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>> wrote:<br>
><br>
> On Jan 3, 2014, at 15:53, Eric Christopher <<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>> wrote:<br>
><br>
>> There's not enough information in the commit message, the comments, or the test cases to know what's broken or fixed here. Why is forcing the block the correct solution here? What is it working around?<br>

>><br>
>><br>
><br>
> Let’s use this as an example:<br>
><br>
>> ==============================<u></u>==============================<u></u>==================<br>
>> --- cfe/trunk/test/CodeGenObjC/<u></u>arc-linetable.m (original)<br>
>> +++ cfe/trunk/test/CodeGenObjC/<u></u>arc-linetable.m Fri Jan  3 17:34:30 2014<br>
><br>
> - (int)testNoSideEffect:(<u></u>NSString *)foo {<br>
> int x = 1;<br>
> return 1; // Return expression<br>
> }<br>
><br>
> Before this fix, a user would set a breakpoint at the return expression and then attempt to print x and it would fail, because the instruction that is at that line would be in the DW_TAG_subprogram lexical scope (instead of the lexical scope of the function body compound statement which contains x).<br>

><br>
> I'm confused by this - Clang doesn't emit a separate lexical scope for the top level compound statement of a function...<br>
><br>
<br>
At least for Objective C this is not true. From CGObjcC.cpp:<br>
<br>
/// Generate an Objective-C method.  An Objective-C method is a C function with<br>
/// its pointer, name, and types registered in the class struture.<br>
void CodeGenFunction::<u></u>GenerateObjCMethod(const ObjCMethodDecl *OMD) {<br>
StartObjCMethod(OMD, OMD->getClassInterface(), OMD->getLocStart());<br>
EmitStmt(OMD->getBody());<br>
FinishFunction(OMD-><u></u>getBodyRBrace());<br>
}<br></blockquote><div><br></div><div>OK - would the issue be fixed if we didn't emit the extra lexical block? (compare this to GCC's behavior - I think at least in C++ they don't emit the extra top level lexical block. They might do it in C, but I'm not sure why (there may be a reason)). I think I changed Clang to not do this for C++, hopefully for C too - but may've missed this particular ObjC case. </div>