[clang-tidy] new check: bugprone-posix-return
authorDmitri Gribenko <gribozavr@gmail.com>
Wed, 3 Jul 2019 09:20:18 +0000 (09:20 +0000)
committerDmitri Gribenko <gribozavr@gmail.com>
Wed, 3 Jul 2019 09:20:18 +0000 (09:20 +0000)
commite6020f5c62ea5f99133fe003aedf542f7a4c07f6
tree63fa87e8d11bdb5aa3b14eb161d291c4227b13dd
parent7264a474b7c808e7d3cf44a4e7c0142281ca3cdf
[clang-tidy] new check: bugprone-posix-return

Summary:
Checks if any calls to posix functions (except posix_openpt) expect negative return values.
These functions return either 0 on success or an errno on failure, which is positive only.

Reviewers: JonasToth, gribozavr, alexfh, hokein

Reviewed By: gribozavr

Subscribers: Eugene.Zelenko, lebedev.ri, llozano, george.burgess.iv, xazax.hun, srhines, mgorny, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D63623

Patch by Jian Cai.

llvm-svn: 365007
clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.cpp [new file with mode: 0644]
clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.h [new file with mode: 0644]
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone-posix-return.rst [new file with mode: 0644]
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/test/clang-tidy/bugprone-posix-return.cpp [new file with mode: 0644]