[PATCH] D61967: [clang-tidy] Add a close-on-exec check on pipe() in Android module.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 31 02:24:07 PDT 2019

hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.

Comment at: clang-tools-extra/clang-tidy/android/CloexecPipeCheck.cpp:31
+      Result,
+      "prefer pipe2() to pipe() because pipe2() allows O_CLOEXEC",
+      ReplacementText);
the message doesn't seem to explain the reason, especially to the people who are not familiar with the `pipe` API, maybe `prefer pipe2() to pipe() to avoid file descriptor leakage` is clearer?

Ah, it looks like you are following the existing `CloexecCreatCheck` check, no need to do it in this patch. 

Comment at: clang-tools-extra/test/clang-tidy/android-cloexec-pipe.cpp:17
+  pipe(pipefd);
+  // CHECK-MESSAGES-NOT: warning:
nit: no need to do it explicitly, if a warning is shown unexpectedly, the test will fail.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list