[clang-tidy] Refactor the code and add a close-on-exec check on memfd_create() in Android module.

Summary:
1. Refactor the structure of the code by adding a base class for all close-on-exec checks, which implements most of the needed functions.
2. memfd_create() is better to set MFD_CLOEXEC flag to avoid file descriptor leakage.

Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: alexfh, hokein

Subscribers: Eugene.Zelenko, chh, cfe-commits, srhines, mgorny, JDevlieghere, xazax.hun

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D35372

Change-Id: I6a7d479fdc1e303b73cd074911b9ba542c9191ef
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@310630 91177308-0d34-0410-b5e6-96231b3b80d8
10 files changed