Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

scan-build needs option to ignore file(s) #4033

Open Quuxplusone opened 15 years ago

Quuxplusone commented 15 years ago
Bugzilla Link PR3637
Status CONFIRMED
Importance P enhancement
Reported by Kevin Ballard (kevin@sb.org)
Reported on 2009-02-20 21:41:57 -0800
Last modified on 2013-06-18 11:58:16 -0700
Version unspecified
Hardware Macintosh MacOS X
CC kremenek@apple.com, llvm-bugs@lists.llvm.org, mattiase@acm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also

scan-build desperately needs a way to instruct it to not bother analyzing certain files. This would be extremely useful when analyzing an Xcode project that includes vendor code, as analyzing the vendor code is just a waste of time.

For example, I have sqlite3.c in my project, which is a single file that's 104k lines long and contains the entirety of sqlite 3 (it's called the sqlite3-amalgamation tarball). Analyzing this one file took several times as long as analyzing the entire rest of the project, and yet the results are not only worthless, they're counterproductive as they make it harder to see the legitimate issues in the rest of my project.

I would like to see a new command-line option made available to scan-build that lets me give it a single path (the option should be repeatable). If the path is a file, that file is skipped during analysis. If the path is a directory, all files rooted inside that directory should be skipped during analysis. This way I could simply pass vendor/ and have all vendor code skipped.

Quuxplusone commented 15 years ago

The trick is passing this information from scan-build to ccc-analyzer. ccc-analyzer is the fake compiler driver that scan-build tells the build system to use instead of gcc. ccc-analyzer calls both gcc and clang. Because ccc-analyzer is invoked by the build system, information between scan-build and ccc-analyzer is passed through environment variables. It should be easy to pass a list of directories and files to ignore, although we would need to make sure that they are resolved to absolute paths since ccc-analyzer can be called from any directory by the build system (so relative paths won't work).

Quuxplusone commented 15 years ago

Do you a preference for the format of this command line argument?

Quuxplusone commented 15 years ago

Anything that works is fine. I just need to be able to indicate one or more files/directories to skip over.