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
0 answers

Can we get target name (executable) in clang checker?

I know SourceManager can give us the file name. Assuming, I have a CMake based project having subprojects, and the checker is invoked using scan-build --use-analyzer=clang -enable-checker debug.SomeCustomChecker make I am wondering whether I can…
Nishant Sharma
  • 683
  • 9
  • 16
0
votes
1 answer

Making new checker visible in the Clang's Static Analyzer

I have included the following code in llvm/tools/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td file under let ParentPackage = CoreAlpha in{ ... def SimpleFunc: Checker<"SimpleFunc">, HelpText<"Simple Function Checking">, …
pavikirthi
  • 1,569
  • 3
  • 17
  • 26
0
votes
0 answers

Clang Static Analyzis check Obj C code

I am trying to make a source code which I can check by Clang Static Analyzer. I am fully newbie in Obj C so I don't know how can I use these small code parts. Here is the checkers…
tmsblgh
  • 517
  • 5
  • 21
0
votes
1 answer

Can I build a Checker using prebuilt llvm/clang?

I came across this "How to Write a Checker in 24 Hours - LLVM" by Anna Zaks and Jordan Rose. I am using an Ubuntu/Debian system. To build a custom checker, do I need to build llvm and clang from source? Anybody knows how use the prebuilt clang and…
xyz
  • 870
  • 2
  • 8
  • 16
0
votes
2 answers

Writing Clang AST Matchers

Is it possible to use the bind string on one expression in the other like the following code: expr(declRefExpr().bind("id"), hasDesendent(declRefExpr(has("id"))); Basically to use bind id string of one node to find the other node.
G Gill
  • 1,087
  • 1
  • 12
  • 24
0
votes
0 answers

Can clang static analysis be challenged with various flows

I wonder if currently there is support for clang static analysis with various flows checking. For example - there is a checker to check for zero division, but can clang find a flow which a divider can evaluate to zero ? simple example: in the bellow…
yehudahs
  • 2,488
  • 8
  • 34
  • 54
0
votes
1 answer

Don't understand memory analysis

I have upgraded my XCode to versio 3.2.3 to support iOS4 on my iphone project. using the static analyser I checked for memory management problems. In one of my routines I get the following problem: I generate a user alert after adding an event to…
user306766
0
votes
1 answer

Listing possible null dereference or forward null in CPP source code

Is there a tool which can do static analysis and find possible forward null and possible null dereference cases. I know coverity is pretty much used and also cpp check. But I dnt find it usefull when comes to user defined data-type comes to…
0
votes
1 answer

Is the scope of what Xcode's "Build and Analyze" will catch as a leak supposed to be this limited?

It doesn't care about this: NSString* leaker() { return [[NSString alloc] init]; } I thought it would have been smart enough to check if any code paths could call that function without releasing its return value (I wouldn't normally code this way,…
0
votes
1 answer

Xcode: Adding a Test that fails when there are Static Analyzer warnings or errors?

I want my Xcode project's tests to fail when there are analyzer warnings or errors. Running the Xcode "Analyze" command points out the analyzer errors in your project: However, when I use Xcode's "Test" command on this same target I'm all green:…
pkamb
  • 33,281
  • 23
  • 160
  • 191
0
votes
0 answers

How can I fix Xcode's Build & Analyze?

After installing Xcode 6, my Xcode 5 seems to have stopped performing static analysis on my main app target. I can run Build & Analyze and it turns up static analysis issues in sub projects, but not my main target. I've tried reinstalling Xcode 5,…
Greg
  • 10,360
  • 6
  • 44
  • 67
0
votes
3 answers

Clang Static Analyzer for xcode for dummies

Could somebody please help me get Clang up and running? (I don't have 3.2) I've followed numerous tutorials (basically every link off of this page Using Clang Static Analyzer from within XCode) but I just cant get it to work! The only thing I've…
dubbeat
  • 7,706
  • 18
  • 70
  • 122
0
votes
2 answers

How to compile-time check objects being passed to an NSArray constructor for nil

NSArray rather dislikes being passed a nil object as part of its constructor: UIView *aView; UIView *aSecondView = [[UIView alloc] init]; NSArray *array = @[aView, aSecondView]; will throw an exception at runtime when array is created. Does clang…
cbowns
  • 6,295
  • 5
  • 47
  • 64
0
votes
2 answers

Figuring Out Memory Leaks without Clang

I'm trying to see if I can find some leaks myself in Apple's TopSongs app. Can someone help me out in at least one and how to identify what is in the Leaks reports and how I can get an idea on finding them? ie: I got one like this: # Category …
RoLYroLLs
  • 3,113
  • 4
  • 38
  • 57
0
votes
1 answer

Does Clang-LLVM work for iPhone?

I am currently using Xcode 3.2.1 for learning the iPhone SDK and was wondering if its possible to use the Clang-LLVM and the static-analyser to aid in debugging my code. Currently I am using the default templates, but swapping the compiler in…
fuzzygoat
  • 26,573
  • 48
  • 165
  • 294
1 2 3
19
20