[PATCH] D33304: [clang-tidy] Add a new module Android and a new check for file descriptors.

Yan Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 18 10:30:28 PDT 2017


yawanng marked an inline comment as done.
yawanng added inline comments.


================
Comment at: clang-tidy/android/FileDescriptorCheck.cpp:76
+    int64_t val = aPInt.getSExtValue();
+    if((val & O_CLOEXEC) == 0)
+      return false;
----------------
srhines wrote:
> Using O_CLOEXEC here is potentially a problem, since most of our compiles are cross-compiles. If O_CLOEXEC is different on the target platform than the host platform (where this code is being compiled), this check would fail. Perhaps we can get the value of O_CLOEXEC as defined for the translation unit (and if it isn't defined, that's already a pretty big indicator that any use of these functions will be wrong). Alternately, maybe just re-parsing for "O_CLOEXEC" is better.
I also think re-parsing is better. I will think about this and update soon. 


https://reviews.llvm.org/D33304





More information about the cfe-commits mailing list