[PATCH] D34913: [clang-tidy] Add a new Android check "android-cloexec-socket"

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 06:30:52 PDT 2017


alexfh requested changes to this revision.
alexfh added inline comments.


================
Comment at: test/clang-tidy/android-cloexec-socket.cpp:20
+  // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: 'socket' should use SOCK_CLOEXEC where possible [android-cloexec-socket]
+  // CHECK-FIXES: SOCK_STREAM | SOCK_CLOEXEC
+  TEMP_FAILURE_RETRY(socket(0, SOCK_STREAM, 0));
----------------
hokein wrote:
> I'd use the complete statement for checking the fixes here, the same below.
Yes, CHECK-FIXES has fewer context than CHECK-MESSAGES (it doesn't have the line number, for example), and there's much more stuff that can go wrong than with the static diagnostic messages. So please make CHECK-FIXES as specific, as possible. Ideally, they should be unique, so that a wrong line can't be matched by a CHECK-FIXES. If needed, add unique comments on identical lines.


Repository:
  rL LLVM

https://reviews.llvm.org/D34913





More information about the cfe-commits mailing list