Questions tagged [scan-build]

28 questions
1
vote
2 answers

How to enable clang static analyzer flags from clang-tidy for alpha (experimental) checkers?

I'm trying to run the clang analyzer through its clang-tidy interface, but I need to pass the clang analyzer an additional flag. Specifically, I want to run an alpha checker for nondeterminism with clang-tidy -allow-enabling-analyzer-alpha-checkers…
ginginsha
  • 142
  • 1
  • 11
1
vote
0 answers

Scan-Build for clang-13 not showing errors

I am using clang 13 to analyze this code: int f1(){ int a=5; short b=4; bool a1=a;//maybe warn bool b1=b;//maybe warn if(a1&&b1)return 1; return 0; } class M{ public: virtual int GetAge(){return 0;} }; class P:public M{ public: virtual int…
kratos
  • 11
  • 1
1
vote
0 answers

How to use scan-build to scan some set of files rather then entire project?

How to use scan-build to scan some set of files rather then entire project..Its giving header files error..
1
vote
1 answer

scan-build not working reporting "Removing directory xxx because it contains no report."

simple buggy code file $ python --version Python 3.8.5 $ gcc --version gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty;…
albert-hk
  • 19
  • 4
1
vote
0 answers

Clang static analysis separately from build?

Is it possible to perform the clang static analysis after the build? Something like scan-build I tried using scan-build but it always returns No bugs found and running scan-build cmake .. and scan-build make seems the only way to actually…
Federico Taschin
  • 2,027
  • 3
  • 15
  • 28
1
vote
1 answer

How to detect all buffer access by using Clang Static Checker

My target: detect all buffer access in C/C++ by using clang static checker. My idea: use CheckPosition to get all memory read/write and then filter unrelated items. My problem: However, I got stuck when I try to filter something like "int i = 1"…
chaz
  • 11
  • 1
1
vote
0 answers

Using clang static analyzer with cross compiled toolchain

I am trying to set up static analysis for our code base which is cross compiled for a ARM based CPU. It appears that scan-build provided by clang is one of the best open source solutions for this. When I run scan-build, this is what I get. $…
1
vote
0 answers

scan-build linker error in xcode target build fails, but links correctly within xcodebuild

so im having a linker error while building an xcode project when using scan-build for my normal xcodebuild command i use the following xcodebuild -target LibCoreMobileGHUnit -configuration Debug -sdk iphonesimulator5.0 clean build and it uses the…
0
votes
0 answers

release_handle - detect double release

I'm trying to get a handle (du-dum-tsh) on clang's acquire_handle and release_handle attributes. I've written int create_foo(void) __attribute__((acquire_handle("foo"))); void destroy_foo(int __attribute__((release_handle("foo"))) foo); void…
Daniel Walker
  • 6,380
  • 5
  • 22
  • 45
0
votes
0 answers

How to get warning about NullDereference with clang analyzer if the a _Nullable argument is used in the function

I would like to detect NullDereference error by adding a _Nullable to my function. I wrote my_function(); It is a function will lead to NullDerenference error if the ptr is NULL. To give a hint to the clang analyzer, I use _Nullable ptr as my…
prgbenz
  • 1,129
  • 4
  • 13
  • 27
0
votes
1 answer

Clang scan-build identifying CXX compiler as GNU 9.1.0, not clang

I was trying to use scan-build with cmake. Following scan-build make after scan-build cmake. But when using scan-build, it is identifying CXX compiler as GNU 9.1.0. But if we don't use scan-build it properly identify CXX as clang. Because of CXX…
vrnithinkumar
  • 1,273
  • 1
  • 11
  • 29
0
votes
0 answers

scan-build doesn't find "variable is used uninitialized"

I am trying to find bugs in reviewed project using scan-build tool. Its output report seems just perfect to send to author of code. Tool finds some good warnings. I also use KDevelop 5.0.3 and it shows me even more warnings. Specifically it reports…
MateuszL
  • 2,751
  • 25
  • 38
0
votes
1 answer

Scan-build cannot find dead code in cygwin environment

Following the tutorial here : http://clang-analyzer.llvm.org/scan-build.html and I write a toy example to check whether scan-build can help find the dead code. The following is the testing code: #include int main () { printf("haha this…
Anakin Tung
  • 419
  • 5
  • 17
1
2