clang  6.0.0svn
Enumerations | Functions
ASTSelection.cpp File Reference
#include "clang/Tooling/Refactoring/ASTSelection.h"
#include "clang/AST/LexicallyOrderedRecursiveASTVisitor.h"
#include "clang/Lex/Lexer.h"
#include "llvm/Support/SaveAndRestore.h"
Include dependency graph for ASTSelection.cpp:

Go to the source code of this file.

Enumerations

enum  SelectionCanonicalizationAction
 

Functions

static const char * selectionKindToString (SourceSelectionKind Kind)
 
static void dump (const SelectedASTNode &Node, llvm::raw_ostream &OS, unsigned Indent=0)
 
static bool hasAnyDirectChildrenWithKind (const SelectedASTNode &Node, SourceSelectionKind Kind)
 Returns true if the given node has any direct children with the following selection kind. More...
 
static void findDeepestWithKind (const SelectedASTNode &ASTSelection, llvm::SmallVectorImpl< SelectedNodeWithParents > &MatchingNodes, SourceSelectionKind Kind, llvm::SmallVectorImpl< SelectedASTNode::ReferenceType > &ParentStack)
 Finds the set of bottom-most selected AST nodes that are in the selection tree with the specified selection kind. More...
 
static void findDeepestWithKind (const SelectedASTNode &ASTSelection, llvm::SmallVectorImpl< SelectedNodeWithParents > &MatchingNodes, SourceSelectionKind Kind)
 
static bool isFunctionLikeDeclaration (const Decl *D)
 

Enumeration Type Documentation

◆ SelectionCanonicalizationAction

Definition at line 263 of file ASTSelection.cpp.

Function Documentation

◆ dump()

static void dump ( const SelectedASTNode Node,
llvm::raw_ostream &  OS,
unsigned  Indent = 0 
)
static

Definition at line 217 of file ASTSelection.cpp.

Referenced by clang::tooling::SelectedASTNode::dump().

◆ findDeepestWithKind() [1/2]

static void findDeepestWithKind ( const SelectedASTNode ASTSelection,
llvm::SmallVectorImpl< SelectedNodeWithParents > &  MatchingNodes,
SourceSelectionKind  Kind,
llvm::SmallVectorImpl< SelectedASTNode::ReferenceType > &  ParentStack 
)
static

Finds the set of bottom-most selected AST nodes that are in the selection tree with the specified selection kind.

For example, given the following selection tree:

FunctionDecl "f" contains-selection CompoundStmt contains-selection [#1] CallExpr inside ImplicitCastExpr inside DeclRefExpr inside IntegerLiteral inside IntegerLiteral inside FunctionDecl "f2" contains-selection CompoundStmt contains-selection [#2] CallExpr inside ImplicitCastExpr inside DeclRefExpr inside IntegerLiteral inside IntegerLiteral inside

This function will find references to nodes #1 and #2 when searching for the ContainsSelection kind.

Definition at line 344 of file ASTSelection.cpp.

References clang::tooling::SelectedASTNode::Children, clang::ast_type_traits::DynTypedNode::get(), hasAnyDirectChildrenWithKind(), and clang::tooling::SelectedASTNode::Node.

Referenced by clang::tooling::CodeRangeASTSelection::create(), and findDeepestWithKind().

◆ findDeepestWithKind() [2/2]

static void findDeepestWithKind ( const SelectedASTNode ASTSelection,
llvm::SmallVectorImpl< SelectedNodeWithParents > &  MatchingNodes,
SourceSelectionKind  Kind 
)
static

Definition at line 374 of file ASTSelection.cpp.

References findDeepestWithKind().

◆ hasAnyDirectChildrenWithKind()

static bool hasAnyDirectChildrenWithKind ( const SelectedASTNode Node,
SourceSelectionKind  Kind 
)
static

Returns true if the given node has any direct children with the following selection kind.

Note: The direct children also include children of direct children with the "None" selection kind.

Definition at line 239 of file ASTSelection.cpp.

References clang::tooling::SelectedASTNode::Children, Node, and clang::tooling::None.

Referenced by findDeepestWithKind().

◆ isFunctionLikeDeclaration()

static bool isFunctionLikeDeclaration ( const Decl D)
static

◆ selectionKindToString()

static const char* selectionKindToString ( SourceSelectionKind  Kind)
static