Jonathan Ragan-Kelley
2011-Mar-22 17:41 UTC
[LLVMdev] Xcode 4 autocomplete of LLVM includes
Slightly off-topic, but I imagine this crowd must have some experience using Xcode 4 for projects linking to LLVM. I've actually started using Xcode 4 as an IDE for C/C++ development thanks to the vastly improved code analysis-based tools it's inherited largely thanks to LLVM. But, ironically, I am particularly struggling to get the tools to parse and analyze LLVM (as a client, not for direct development in the LLVM tree). My current setup is extremely vanilla: - LLVM 2.8 is installed (by Homebrew) in /usr/local/[lib,include] - Header Search Paths for the target is set to /usr/local/include - The LLVM headers are included as <llvm/*.h> - The libs relevant to the project are added as library deps in the "Link Binary With Libraries" Build Phase Compilation (with Xcode's llvm-gcc 4.2) works, but the tools seemingly don't parse the LLVM includes for analysis, so: - autocomplete on LLVM types returns "no completions" - cmd-clicking on the LLVM #include lines (e.g. #include <llvm/Module.h>) does nothing, seemingly indicating that the parser cannot find them to open them Any ideas? Have others had more luck? Thanks.
Jonathan Ragan-Kelley <katokop1 <at> gmail.com> writes:> > Slightly off-topic, but I imagine this crowd must have some experience > using Xcode 4 for projects linking to LLVM. I've actually started > using Xcode 4 as an IDE for C/C++ development thanks to the vastly > improved code analysis-based tools it's inherited largely thanks to > LLVM. But, ironically, I am particularly struggling to get the tools > to parse and analyze LLVM (as a client, not for direct development in > the LLVM tree).I read somewhere that XCode does not support code analysis for C++, only for Objective C and C. Cannot find that link anymore. But is this true/false? I used code analysis in XCode 3 and that worked nicely for Objective C indeed. (NEver tried C++ back there.) Whatever I try in XCode 4, C++ analysis just says, ok without reporting any problems. (Even if I add a simple problem like int * p; *p =42; it surely should detect) Apart from that, if I opt for LLDB instead of GDB, this goes well, apart for a check for a call to a license manager I need to call. It then claims that the license is taken and stops. With GDB I have no such problem. All is for XCode 4.0.2, build 4A2002a. greetz, Peter
On Apr 17, 2011, at 12:24 PM, Pete wrote:> Jonathan Ragan-Kelley <katokop1 <at> gmail.com> writes: > >> >> Slightly off-topic, but I imagine this crowd must have some experience >> using Xcode 4 for projects linking to LLVM. I've actually started >> using Xcode 4 as an IDE for C/C++ development thanks to the vastly >> improved code analysis-based tools it's inherited largely thanks to >> LLVM. But, ironically, I am particularly struggling to get the tools >> to parse and analyze LLVM (as a client, not for direct development in >> the LLVM tree). > > I read somewhere that XCode does not support code analysis for C++, > only for Objective C and C. Cannot find that link anymore. > But is this true/false?I think the word "analysis" may be conflated here. Static analysis (for bug-finding) for C++ is currently not supported in Xcode. The build system will literally not invoke the static analyzer for C++/Objective-C++ files. C++ code completion powered by Clang is supported in Xcode 4. That's an unrelated feature.