clang 20.0.0git
Classes | Functions
BuildTree.cpp File Reference
#include "clang/Tooling/Syntax/BuildTree.h"
#include "clang/AST/ASTFwd.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/IgnoreExpr.h"
#include "clang/AST/OperationKinds.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/TypeLocVisitor.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Tooling/Syntax/Nodes.h"
#include "clang/Tooling/Syntax/TokenBufferTokenManager.h"
#include "clang/Tooling/Syntax/Tokens.h"
#include "clang/Tooling/Syntax/Tree.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include <cstddef>
#include <map>

Go to the source code of this file.

Classes

class  clang::syntax::TreeBuilder
 A helper class for constructing the syntax tree while traversing a clang AST. More...
 

Functions

static ExprIgnoreImplicitConstructorSingleStep (Expr *E)
 
static ExprIgnoreCXXFunctionalCastExprWrappingConstructor (Expr *E)
 
static ExprIgnoreImplicit (Expr *E)
 
static LLVM_ATTRIBUTE_UNUSED bool isImplicitExpr (Expr *E)
 
static CallExpr::arg_range dropDefaultArgs (CallExpr::arg_range Args)
 
static syntax::NodeKind getOperatorNodeKind (const CXXOperatorCallExpr &E)
 
static SourceLocation getQualifiedNameStart (NamedDecl *D)
 Get the start of the qualified name.
 
static SourceRange getInitializerRange (Decl *D)
 Gets the range of the initializer inside an init-declarator C++ [dcl.decl].
 
static SourceRange getDeclaratorRange (const SourceManager &SM, TypeLoc T, SourceLocation Name, SourceRange Initializer)
 Gets the range of declarator as defined by the C++ grammar.
 

Function Documentation

◆ dropDefaultArgs()

static CallExpr::arg_range dropDefaultArgs ( CallExpr::arg_range  Args)
static

Definition at line 158 of file BuildTree.cpp.

◆ getDeclaratorRange()

static SourceRange getDeclaratorRange ( const SourceManager SM,
TypeLoc  T,
SourceLocation  Name,
SourceRange  Initializer 
)
static

Gets the range of declarator as defined by the C++ grammar.

E.g. int a; -> range of a, int *a; -> range of *a, int a[10]; -> range of a[10], int a[1][2][3]; -> range of a[1][2][3], int *a = nullptr -> range of *a = nullptr. int S::f(){} -> range of S::f(). FIXME: Name must be a source range.

Definition at line 292 of file BuildTree.cpp.

References clang::Initializer, clang::SourceLocation::isInvalid(), SM, and clang::T.

◆ getInitializerRange()

static SourceRange getInitializerRange ( Decl D)
static

Gets the range of the initializer inside an init-declarator C++ [dcl.decl].

int a; -> range of `, int *a = nullptr-> range of= nullptr. int a{}-> range of{}. int a()-> range of()`.

Definition at line 273 of file BuildTree.cpp.

References D, and V.

◆ getOperatorNodeKind()

static syntax::NodeKind getOperatorNodeKind ( const CXXOperatorCallExpr E)
static

Definition at line 164 of file BuildTree.cpp.

References E, clang::NUM_OVERLOADED_OPERATORS, and clang::OO_None.

◆ getQualifiedNameStart()

static SourceLocation getQualifiedNameStart ( NamedDecl D)
static

Get the start of the qualified name.

In the examples below it gives the location of the ^: int ^a; int *^a; int ^a::S::f(){}

Definition at line 250 of file BuildTree.cpp.

References D, and clang::Decl::getLocation().

◆ IgnoreCXXFunctionalCastExprWrappingConstructor()

static Expr * IgnoreCXXFunctionalCastExprWrappingConstructor ( Expr E)
static

Definition at line 72 of file BuildTree.cpp.

References E.

Referenced by IgnoreImplicit().

◆ IgnoreImplicit()

static Expr * IgnoreImplicit ( Expr E)
static

◆ IgnoreImplicitConstructorSingleStep()

static Expr * IgnoreImplicitConstructorSingleStep ( Expr E)
static

Definition at line 53 of file BuildTree.cpp.

References clang::C, and E.

Referenced by IgnoreImplicit(), and clang::Expr::IgnoreUnlessSpelledInSource().

◆ isImplicitExpr()

static LLVM_ATTRIBUTE_UNUSED bool isImplicitExpr ( Expr E)
static

Definition at line 87 of file BuildTree.cpp.

References E, and IgnoreImplicit().