PVS-Studio static analysis results for the Swift project


(Brian Gesiak) #1

Hello all,

The latest LLVM Weekly <http://llvmweekly.org/issue/149> featured a blog
post by some folks who make a static analyzer named PVS-Studio. They
published a blog post <http://www.viva64.com/en/b/0446/> of the errors they
encountered in the LLVM project. Although the report contained many false
positives <https://twitter.com/chandlerc1024/status/794442485472706563>,
some did lead to code improvements.

I tried running the analyzer on the Swift codebase; here are the results:
https://gist.github.com/modocache/00eb437ca3cac84960992cdc23fa0f52

It's a little hard to read, but there are some legitimate issues in the
report. For example, line #709 in lib/IDE/TypeReconstruction.cpp returns
'false' for a method that has a return type of 'size_t', which is probably
incorrect.

If you're interested in contributing to Swift, why not start by fixing some
of these warnings? :slight_smile:

- Brian Gesiak


(Ted Kremenek) #2

Hi Brian,

I know you sent this out 7 days ago, but thanks very much for doing this!

Ted

ยทยทยท

On Nov 7, 2016, at 1:56 PM, Brian Gesiak via swift-dev <swift-dev@swift.org> wrote:

Hello all,

The latest LLVM Weekly <http://llvmweekly.org/issue/149> featured a blog post by some folks who make a static analyzer named PVS-Studio. They published a blog post <http://www.viva64.com/en/b/0446/> of the errors they encountered in the LLVM project. Although the report contained many false positives <https://twitter.com/chandlerc1024/status/794442485472706563>, some did lead to code improvements.

I tried running the analyzer on the Swift codebase; here are the results: https://gist.github.com/modocache/00eb437ca3cac84960992cdc23fa0f52

It's a little hard to read, but there are some legitimate issues in the report. For example, line #709 in lib/IDE/TypeReconstruction.cpp returns 'false' for a method that has a return type of 'size_t', which is probably incorrect.

If you're interested in contributing to Swift, why not start by fixing some of these warnings? :slight_smile:

- Brian Gesiak

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev