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

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 11 07:13:48 PDT 2017


hokein added inline comments.


================
Comment at: clang-tidy/android/CloexecInotifyInit1Check.cpp:28
+void CloexecInotifyInit1Check::check(const MatchFinder::MatchResult &Result) {
+  insertMacroFlag(Result, "IN_CLOEXEC", /*ArgPos=*/0);
+}
----------------
nit: `/*MarcoFlag=*/`


================
Comment at: test/clang-tidy/android-cloexec-inotify-init1.cpp:19
+  // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: 'inotify_init1' should use IN_CLOEXEC where possible [android-cloexec-inotify-init1]
+  // CHECK-FIXES: inotify_init1(IN_NONBLOCK | IN_CLOEXEC)
+  TEMP_FAILURE_RETRY(inotify_init1(IN_NONBLOCK));
----------------
The same, trailing `;`.


https://reviews.llvm.org/D35368





More information about the cfe-commits mailing list