Questions tagged [clang-static-analyzer]

Use this tag for the Clang Static Analyzer, an open source source code analysis tool which find bugs in C and Objective-C programs. Use this tag also for Xcode Static Analyzer.

The Clang Static Analyzer is an open source (supported by Apple) source code analysis tool which find bugs in C and Objective-C programs.

It can be run either as a standalone tool or within Xcode. The standalone tool is invoked from the command line, and is intended to be run in tandem with a build of a codebase.

The analyzer is 100% open source and is part of the Clang project. Like the rest of Clang, the analyzer is implemented as a C++ library that can be used by other tools and applications.

296 questions
0
votes
1 answer

Clang static analyzer warns about consumed block

I have the following code (in a non-ARC project): - (void)loadWithCompleteBlock:(void (^)(void))complete { ... complete = [complete copy]; ... [[NSOperationQueue mainQueue] addObserver:self…
Alexander
  • 1,495
  • 2
  • 19
  • 24
0
votes
1 answer

Not able to print correct line numbers for then part of if statement, Clang

In the following code, I am parsing a C-code using clang APIs and then trying to 1)Add a HTML header and footer to the code, so it can be viewed in a browser 2)Getting the line number of THEN part of an IF statement and printing it. I am having…
user763410
  • 502
  • 6
  • 22
0
votes
1 answer

Clang Static Code Analyzer Output Format for Xcode project

I am trying to run inbuilt Xcode Clang static analyzer on ObjectiveCProject. I want to know if it is possible to transform the Obj-C Analyzer output into a another format that sonar plugin can consume. Since there is no Sonar plugin yet for…
user2506411
  • 303
  • 1
  • 5
  • 10
0
votes
1 answer

How do I figure out clang static analyzer steps that trigger a warning?

The methods below from DDAbstractDatabaseLogger of CocoaLumberjack: - (void)createAndStartDeleteTimer { if ((deleteTimer == NULL) && (deleteInterval > 0.0) && (maxAge > 0.0)) { deleteTimer =…
Heath Borders
  • 30,998
  • 16
  • 147
  • 256
0
votes
1 answer

Clang Analyzer false positive or overflow?

Below is the simplification of some code of ours which seems like it demonstrates a bug in the clang analyzer, though it's possible there's a real bug in our code. typedef enum { value1 = 0x8000, /*If value1 is initialized at < 0x8000, …
Jon Brooks
  • 2,472
  • 24
  • 32
0
votes
2 answers

memory leaks issues in ios/objective c

i am developing the ios app and now want to test it for memory leaks, i have used the clang static analyzer and its giving me this bug report -(void)pass { printf("reading plist info"); // Path to the plist (in the application bundle) NSString…
0
votes
1 answer

How to find a work-around when Xcode analyzer finds issues but does not show them in the files?

I'm having trouble with Xcode 4.5.2's analyzer. It is able to find issues: But, while the issues are displayed on the top bar: , the issues are not shown inside the file editor. Without this information, there is no practical way to know what the…
Matthias Odisio
  • 2,038
  • 12
  • 19
0
votes
1 answer

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…
HelloMoon
0
votes
1 answer

Potential leak using ABRecord and ARC

I have this code: - (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)personRecord property:(ABPropertyID)property …
oky_sabeni
  • 7,672
  • 15
  • 65
  • 89
-1
votes
1 answer

clang static analyzer questions

I'm confused about making a decision. For example, when I wrote a code 'test.c' like this. int main(void){ int b = 2; int c = 0; int d = b/c; printf("d: %d\n", d); return 0; } And then, I typed the command…
ljs0626jh
  • 3
  • 2
-4
votes
1 answer

How to fix arrayWithObject cannot be nil warning?

When running analyze in Xcode I get this warning: Argument to 'NSArray' method 'arrayWithObject:' cannot be nil The line of code that it is happening on for me: if (indexPath) { indexPath = [self differentPath:indexPath]; } NSArray…
Steve Moser
  • 7,647
  • 5
  • 55
  • 94
1 2 3
19
20