[PATCH] D63623: [clang-tidy] new check: bugprone-posix-return

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 26 02:49:01 PDT 2019


gribozavr added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.cpp:49
+    diag(OperatorLoc, "POSIX functions (except posix_openpt) never return negative values")
+        << FixItHint::CreateReplacement(OperatorLoc, Twine(">").str());
+    return;
----------------
Please add tests for fix-its.


================
Comment at: clang-tools-extra/test/clang-tidy/bugprone-posix-return.cpp:96
+  if (posix_fadvise(0, 0, 0, 0) < 0) {}
+  if (posix_fadvise(0, 0, 0, 0) >= 0) {} else {}
+  if (posix_fadvise(0, 0, 0, 0) == -1) {}
----------------
Shouldn't there be a warning in the else branch?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63623/new/

https://reviews.llvm.org/D63623





More information about the cfe-commits mailing list