Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:22

0001 //===---------- ASTUtils.h - clang-tidy -----------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H
0010 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H
0011 
0012 #include "clang/AST/AST.h"
0013 
0014 namespace clang::tidy::utils {
0015 // Returns the (closest) Function declaration surrounding |Statement| or NULL.
0016 const FunctionDecl *getSurroundingFunction(ASTContext &Context,
0017                                            const Stmt &Statement);
0018 // Determine whether Expr is a Binary or Ternary expression.
0019 bool isBinaryOrTernary(const Expr *E);
0020 
0021 /// Checks whether a macro flag is present in the given argument. Only considers
0022 /// cases of single match or match in a binary OR expression. For example,
0023 /// <needed-flag> or <flag> | <needed-flag> | ...
0024 bool exprHasBitFlagWithSpelling(const Expr *Flags, const SourceManager &SM,
0025                                 const LangOptions &LangOpts,
0026                                 StringRef FlagName);
0027 
0028 // Check if the range is entirely contained within a macro argument.
0029 bool rangeIsEntirelyWithinMacroArgument(SourceRange Range,
0030                                         const SourceManager *SM);
0031 
0032 // Check if the range contains any locations from a macro expansion.
0033 bool rangeContainsMacroExpansion(SourceRange Range, const SourceManager *SM);
0034 
0035 // Can a fix-it be issued for this whole Range?
0036 // FIXME: false-negative if the entire range is fully expanded from a macro.
0037 bool rangeCanBeFixed(SourceRange Range, const SourceManager *SM);
0038 
0039 // Check if statements are same
0040 bool areStatementsIdentical(const Stmt *FirstStmt, const Stmt *SecondStmt,
0041                             const ASTContext &Context, bool Canonical = false);
0042 
0043 // Given a field of an anonymous record, find its corresponding
0044 // IndirectFieldDecl in the outermost possible scope.
0045 const IndirectFieldDecl *
0046 findOutermostIndirectFieldDeclForField(const FieldDecl *FD);
0047 
0048 } // namespace clang::tidy::utils
0049 
0050 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H