Matt Lamari
2011-Apr-21 13:18 UTC
[LLVMdev] A problem from XCode 4 - help sought tracking it down
Sorry if this isn't the right place; but I'm facing an XCode 4 (LLVM 2.0 to Apple, I heard it's LLVM 2.9 under the hood) issue that may involve LLVM, and maybe some people on this list could help me short-circuit the source. I have a code pattern that, when used in XCode 4 in Objective C++ files, causes the whole IDE to go crash. It is a stripped sample to highlight the issue. In the call stack, I see libclang.dylib, calling through clang_visitChildren, up through various CursorVisitor::Visit... and CursorVisitor::VisitChildren... calls. I have LLVM compiling, and imagine I could replace XCode's libclang.dylib in order to add debugging aids/logging. Am I on the right track? Should I look near the point of failure, or should I inspect the integrity of the data sent to clang_visitChildren first? If I'm not on the right track, I appreciate any help in getting me moving. If anyone happens to be able to test-rig XCode 4 (in iPhone mode with LLVM2 as compiler) vs the code below, it reproduces the problem: template <typename I0,typename I1> void (^ cc(void (^f)(I0,I1), I0 i0))(I1) { ^ void (I1 i1) { }; } int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; cc(^ void (NSString * a, id b) { NSLog(a, b); }, @"%@"); [pool drain]; } Thanks, Matt
Ted Kremenek
2011-Apr-21 15:11 UTC
[LLVMdev] A problem from XCode 4 - help sought tracking it down
Matt, This is definitely an issue with Clang's integration in Xcode. This isn't the right list for such discussions (cfe-dev is more appropriate). Whether you are on the right track or not depends on the *full* stack trace (and where the failure is occurring). clang_visitChildren() represents an AST walk by the IDE, but the specific problem is usually in the last couple of stack frames. If you could submit a project via bugreporter.apple.com that reproduces the issue that would be awesome. That's the appropriate place since this concerns iOS code (although it doesn't really look specific to iOS, and probably has more to do with templates and blocks). Ted On Apr 21, 2011, at 6:18 AM, Matt Lamari wrote:> > Sorry if this isn't the right place; but I'm facing an XCode 4 (LLVM 2.0 > to Apple, I heard it's LLVM 2.9 under the hood) issue that may involve > LLVM, and maybe some people on this list could help me short-circuit the > source. > > I have a code pattern that, when used in XCode 4 in Objective C++ files, > causes the whole IDE to go crash. It is a stripped sample to highlight > the issue. > > In the call stack, I see libclang.dylib, calling through > clang_visitChildren, up through various CursorVisitor::Visit... and > CursorVisitor::VisitChildren... calls. I have LLVM compiling, and > imagine I could replace XCode's libclang.dylib in order to add debugging > aids/logging. > > Am I on the right track? Should I look near the point of failure, or > should I inspect the integrity of the data sent to clang_visitChildren > first? > > If I'm not on the right track, I appreciate any help in getting me moving. > > > If anyone happens to be able to test-rig XCode 4 (in iPhone mode with > LLVM2 as compiler) vs the code below, it reproduces the problem: > > template <typename I0,typename I1> > void (^ cc(void (^f)(I0,I1), I0 i0))(I1) > { > ^ void (I1 i1) { }; > } > > > int main(int argc, char *argv[]) { > NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; > > cc(^ void (NSString * a, id b) { NSLog(a, b); }, @"%@"); > > [pool drain]; > } > > > Thanks, > Matt > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev