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

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


hokein added inline comments.


================
Comment at: clang-tidy/android/CloexecCheck.h:91
+  /// Helper function to get the spelling of a particular argument.
+  StringRef getSpellingArg(const ast_matchers::MatchFinder::MatchResult &Result,
+                           int N) const;
----------------
This method seems only be used in one check. Maybe move it to the implementation of that specific check? And you can make the  private members `FuncBindingStr` and `FuncDeclBindingStr` to protected member.


================
Comment at: test/clang-tidy/android-cloexec-dup.cpp:7
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer fcntl() to dup() because fcntl() allows F_DUPFD_CLOEXEC [android-cloexec-dup]
+  // CHECK-FIXES: fcntl(1, F_DUPFD_CLOEXEC)
+  int oldfd = 0;
----------------
nit: trailing `;`, the same below. Please apply this to other patches as well.


https://reviews.llvm.org/D35364





More information about the cfe-commits mailing list