diff options
author | Yan Wang <yawanng@google.com> | 2017-07-12 17:43:36 +0000 |
---|---|---|
committer | Yan Wang <yawanng@google.com> | 2017-07-12 17:43:36 +0000 |
commit | b38045d02ebd412f32955769feaa6ba62f3ffd4d (patch) | |
tree | ea63c6589177cb53314d1a44aee21094cd60d889 /clang-tools-extra/clang-tidy/utils/ASTUtils.h | |
parent | 4fc696635ded88843f235e55b29c3eefc7c4810a (diff) | |
download | bcm5719-llvm-b38045d02ebd412f32955769feaa6ba62f3ffd4d.tar.gz bcm5719-llvm-b38045d02ebd412f32955769feaa6ba62f3ffd4d.zip |
[clang-tidy] Add a new Android check "android-cloexec-socket"
Summary: socket() is better to include SOCK_CLOEXEC in its type argument to avoid the file descriptor leakage.
Reviewers: chh, Eugene.Zelenko, alexfh, hokein, aaron.ballman
Reviewed By: chh, alexfh
Subscribers: srhines, mgorny, JDevlieghere, xazax.hun, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D34913
llvm-svn: 307818
Diffstat (limited to 'clang-tools-extra/clang-tidy/utils/ASTUtils.h')
-rw-r--r-- | clang-tools-extra/clang-tidy/utils/ASTUtils.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/utils/ASTUtils.h b/clang-tools-extra/clang-tidy/utils/ASTUtils.h index 7f753270f0d..ccff000adc5 100644 --- a/clang-tools-extra/clang-tidy/utils/ASTUtils.h +++ b/clang-tools-extra/clang-tidy/utils/ASTUtils.h @@ -20,6 +20,13 @@ const FunctionDecl *getSurroundingFunction(ASTContext &Context, const Stmt &Statement); // Determine whether Expr is a Binary or Ternary expression. bool IsBinaryOrTernary(const Expr *E); + +/// Checks whether a macro flag is present in the given argument. Only considers +/// cases of single match or match in a binary OR expression. For example, +/// <needed-flag> or <flag> | <needed-flag> | ... +bool exprHasBitFlagWithSpelling(const Expr *Flags, const SourceManager &SM, + const LangOptions &LangOpts, + StringRef FlagName); } // namespace utils } // namespace tidy } // namespace clang |