clang

Anyone have experience with LLVM?

Does anyone have experience with LLVM, llvm-gcc, or Clang? The whole idea behind llvm seems very intriguing to me and I'm interested in seeing how it performs. I just don't want to dump a whole lot of time into trying the tools out if the tools are not ready for production. If you have experience with the tools, what do you think of t...

Debugging with Clang

I'd like to use clang on my Xcode iPhone project. However this is the getting started guide: http://clang.llvm.org/get_started.html I've been working with Xcode for a year but this is far far far from being understandable to me! Can anyone explain in plain english how to install and use Clang with my existing iPhone project? I am not f...

What does "Leak of returned object" mean, from Clang?

Further to this question I've fixed a bunch of memory leaks in BEncoding.m (originally from here) I've fixed all the obvious memory leaks, but Clang has found four "Leak of returned object" bugs, which I'm not sure how to sort: The full messages/appropriate bits of code are: NSMutableData *data = [[NSMutableData alloc] init]; [...

Objective-C Singletons and LLVM/clang leak warnings

I'm using the singleton pattern in several places in an application, and I'm getting memory leak errors from clang when analyzing the code. static MyClass *_sharedMyClass; + (MyClass *)sharedMyClass { @synchronized(self) { if (_sharedMyClass == nil) [[self alloc] init]; } return _sharedMyClass; } // clang error: Object ...

Why does Clang complain about all my autoreleased objects?

I have the following function: - (NSString *)urlEncodedValue { NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes( kCFAllocatorDefault, (CFStringRef)self, NULL, CFSTR("?=&+/\r\n"), kCFStringEncodingUTF8 ); return [result autorelease]; } Why is Clang giving me the following c...

Can clang be told not to analyze certain files?

I'm trying to use clang to profile a project I'm working on. The project includes a rather large static library that is included in Xcode as a dependency. I would really like clang to not analyze the dependencies' files, as it seems to make clang fail. Is this possible? I've been reading the clang documentation, and I haven't found it. ...

Using Clang Static Analyzer from within XCode

Since there is no Xcode script variable for "current project directory," how can you create a script menu item to run the Clang Static Analyzer on your current project from Xcode? ...

AnalysisTool / Clang results: ivar naming convention violation

AnalysisTool (a Clang GUI front end) states some fo my ivars are improperly named: Specifically: the name of instance variable 'groupName' doesn't start with the 'm' prefix What does the 'm' prefix stand for in Cocoa? Should I be using it? Or is this a false positive. ...

CLANG giving errors complaining about defective header file UILocalizedIndexedCollation.h

I ran into this error when building my code with CLANG: In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:31, from /Users/waspfish/Documents/NanaimoStudio/Projects/iPhoneMonk/Projects/IdeaOrganizer/IdeaOrga...

problem in configuring clang static analzer

i follow the following steps to install and configure clang static analyser.but still i could not run scan-build command in project directory can anyone can give correct tutorial to set path and also run scan-build command.terminal shows "scan-build command not found" the steps i followed: Installation: Navigate to http://clang.llvm.org...

Elegant and safe way to determine if architecture is 32bit or 64bit

As title says, is there any elegant and safe way to determine if architecture is 32bit or 64bit. By elegant, you can think of precise, correct, short, clean, and smart way. By safe, think of safe in term of standard, C89/C99, and operating system independence. ...

Xcode 3.2 + LLVM = no local symbols when debugging

I have a project for Mac OS X 10.5 that I'm building on 10.6 using Xcode 3.2. When I use GCC 4.2 for Debug build and hit a breakpoint, Xcode debugger displays local variable information normally. If I choose LLVM GCC 4.2 or Clang LLVM, when I hit breakpoint, local symbols are not available, and GDB says No symbol 'self' in current contex...

How to get this Apple Script for Clang Static Analyzer working with Xcode?

Here's a script where lots of people say it's good: http://allancraig.net/blog/?p=381 But I can't get it to work. What are the steps I have to do with the Xcode script editor, to run that script? I have pasted it in "Script Editor.app", that Script Editor app from Mac OSx and saved it as clang.scpt. Then, I went to Xcode and opened t...

Why do I have to close and re-open my project every time I want to launch Clang Static Analyzer?

I've used this script from the accepted answer here: link text When I launch the script, it works all fine. But I can do that only once. The next time I want to execute it, Xcode won't allow me to exec any script. They are all "grayed out", or "inactive" in the menu. When I close and re-open the project, all fine again. How to solve tha...

Clang Static Analyzer can't start. Why?

Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' This happens when I execute this script from within xcode: #!/bin/bash result=$( osascript << END tell application "Xcode" tell act...

Is it wise to use Clang to start with?

I am just starting out with xcode and learning Objective-C & Cocoa, would it be helpful to swap the compiler in Xcode 3.2 to Clang for the enhanced error checking and static analyser. I am just curious if the extras given would be helpful or would my learning be better served sticking to the default settings? many thanks gary ...

Clang: what is "Method returns an Objective-C object with a +0 retain count" trying to tell me?

Running a static analysis with clang in both XCode 3.2 and Nikita Zhuk's Analysis Tool I've often come across this pair of warnings: Method returns an Objective-C object with a +0 retain count (non-owning reference) Incorrect decrement of the reference count of an object is not owned at this point by the caller An example of c...

XCode: Static Analyzer doesn't work if C/C++-Code used in project

Hi, with XCode 3.2.1 Apple delivered a built-in Clang static analyzer. I am working on an iPhone project which uses some C-Code (one .h and .c file). When running Build and Analyze, Clang refuses work. The build results window just says Build Succeeded. Any ideas how to get it running with C/C++-Code? Regards, Norbert ...

Xcode 3.2.1 GCC CLANG and LLVM demystification

The readme included with the new Xcode 3.2.1 this week says the following: Static code analysis is fully integrated within the Xcode IDE via the Build and Analyze option under the Build menu or via custom build settings GCC 4.2 is the default system compiler for the 10.6 SDK The optional LLVM compiler is included using two different fr...

How to detect LLVM and its version through #define directives?

The question is quite clear I think. I'm trying to write a compiler detection header to be able to include in the application information on which compiler was used and which version. This is part of the code I'm using: /* GNU C Compiler Detection */ #elif defined __GNUC__ #ifdef __MINGW32__ #define COMPILER "MinGW GCC %d.%...