clang-tools  7.0.0
ASTUtils.h
Go to the documentation of this file.
1 //===---------- ASTUtils.h - clang-tidy -----------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H
12 
13 #include "clang/AST/AST.h"
14 
15 namespace clang {
16 namespace tidy {
17 namespace utils {
18 // Returns the (closest) Function declaration surrounding |Statement| or NULL.
19 const FunctionDecl *getSurroundingFunction(ASTContext &Context,
20  const Stmt &Statement);
21 // Determine whether Expr is a Binary or Ternary expression.
22 bool IsBinaryOrTernary(const Expr *E);
23 
24 /// Checks whether a macro flag is present in the given argument. Only considers
25 /// cases of single match or match in a binary OR expression. For example,
26 /// <needed-flag> or <flag> | <needed-flag> | ...
27 bool exprHasBitFlagWithSpelling(const Expr *Flags, const SourceManager &SM,
28  const LangOptions &LangOpts,
29  StringRef FlagName);
30 } // namespace utils
31 } // namespace tidy
32 } // namespace clang
33 
34 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H
bool IsBinaryOrTernary(const Expr *E)
Definition: ASTUtils.cpp:28
bool exprHasBitFlagWithSpelling(const Expr *Flags, const SourceManager &SM, const LangOptions &LangOpts, StringRef FlagName)
Checks whether a macro flag is present in the given argument.
Definition: ASTUtils.cpp:43
const FunctionDecl * getSurroundingFunction(ASTContext &Context, const Stmt &Statement)
Definition: ASTUtils.cpp:21
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//