On Jan 6, 2014, at 12:59, [email protected] wrote: > > > On Mon Jan 06 2014 at 8:29:19 AM, Adrian Prantl <[email protected]> wrote: > > On Jan 5, 2014, at 8:22 PM, [email protected] wrote: > > > > > > > On Fri Jan 03 2014 at 4:00:30 PM, Adrian Prantl <[email protected]> wrote: > > > > On Jan 3, 2014, at 15:53, Eric Christopher <[email protected]> wrote: > > > >> 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? > >> > >> > > > > Let’s use this as an example: > > > >> ============================================================================== > >> --- cfe/trunk/test/CodeGenObjC/arc-linetable.m (original) > >> +++ cfe/trunk/test/CodeGenObjC/arc-linetable.m Fri Jan 3 17:34:30 2014 > > > > - (int)testNoSideEffect:(NSString *)foo { > > int x = 1; > > return 1; // Return expression > > } > > > > 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). > > > > I'm confused by this - Clang doesn't emit a separate lexical scope for the > > top level compound statement of a function... > > > > At least for Objective C this is not true. From CGObjcC.cpp: > > /// Generate an Objective-C method. An Objective-C method is a C function > with > /// its pointer, name, and types registered in the class struture. > void CodeGenFunction::GenerateObjCMethod(const ObjCMethodDecl *OMD) { > StartObjCMethod(OMD, OMD->getClassInterface(), OMD->getLocStart()); > EmitStmt(OMD->getBody()); > FinishFunction(OMD->getBodyRBrace()); > } > > 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.
I implemented this behaviour in r198699. Objective-C should behave just like C++ and C now. -- adrian _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
