A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://clang.llvm.org/doxygen/RangeSelector_8cpp_source.html below:

clang: lib/Tooling/Transformer/RangeSelector.cpp Source File

16#include "llvm/ADT/StringRef.h" 17#include "llvm/Support/Errc.h" 18#include "llvm/Support/Error.h" 23using namespace clang

;

24using namespace

transformer;

28using

llvm::StringError;

33 return

llvm::make_error<StringError>(llvm::errc::invalid_argument, Message);

38 " kind="

+ Kind.asStringRef() +

")"

);

45 " kind="

+ Kind.asStringRef() +

")"

);

51 "' (node id="

+ ID +

")"

);

56 auto

&NodesMap =

Nodes

.getMap();

57 auto

It = NodesMap.find(ID);

58 if

(It == NodesMap.end())

93 return T

.getLocation();

103 return

SelectedRange.takeError();

112 return

SelectedRange.takeError();

114 if

(SelectedRange->isTokenRange()) {

123

*Result.SourceManager, Result.Context->

getLangOpts

());

126 "after: can't resolve sub-range to valid source range"

);

138 return Node

.takeError();

151 return Node

.takeError();

161 return

BeginRange.takeError();

164 return

EndRange.takeError();

169 if

(Result.SourceManager->isBeforeInTranslationUnit(

E

, B)) {

185 return Node

.takeError();

188

M->getMemberNameInfo().getSourceRange());

197 return

N.takeError();

200 if

(!

D

->getDeclName().isIdentifier())

214 if

(!

E

->getNameInfo().getName().isIdentifier())

220 if

(!I->isMemberInitializer() && I->isWritten())

229 Loc

= ET.getNamedTypeLoc();

236 "DeclRefExpr, NamedDecl, CXXCtorInitializer, TypeLoc"

);

247template

<

typename

T, CharSourceRange (*Func)(const MatchResult &, const T &)>

248class

RelativeSelector {

252

RelativeSelector(std::string ID) : ID(

std

::move(ID)) {}

257 return

N.takeError();

258 if

(

const auto

*Arg = N->get<

T

>())

259 return Func

(Result, *Arg);

279 return

RelativeSelector<CompoundStmt, getStatementsRange>(std::move(ID));

287 return E

.getParenOrBraceRange().getEnd();

291 return

tok::TokenKind::l_paren;

295 return

isa<CXXTemporaryObjectExpr>(

E

) ? tok::TokenKind::l_paren

296

: tok::TokenKind::l_brace;

299template

<

typename

ExprWithArgs>

308template

<

typename

ExprWithArgs>

310 const

ExprWithArgs &CE) {

313

findArgStartDelimiter(CE, RLoc, *Result.SourceManager,

315

.getLocWithOffset(1),

321 return

RelativeSelector<CallExpr, getArgumentsRange<CallExpr>>(std::move(ID));

326

getArgumentsRange<CXXConstructExpr>>(std::move(ID));

340 return

RelativeSelector<InitListExpr, getElementsRange>(std::move(ID));

348

tok::TokenKind::semi, *Result.Context);

353 return

RelativeSelector<IfStmt, getElseRange>(std::move(ID));

360 return

SRange.takeError();

361 return

Result.SourceManager->getExpansionRange(*SRange);

BoundNodesTreeBuilder Nodes

static Error invalidArgumentError(Twine Message)

static SourceLocation findPreviousTokenKind(SourceLocation Start, const SourceManager &SM, const LangOptions &LangOpts, tok::TokenKind TK)

static SourceLocation findPreviousTokenStart(SourceLocation Start, const SourceManager &SM, const LangOptions &LangOpts)

static Error missingPropertyError(StringRef ID, Twine Description, StringRef Property)

static Error typeError(StringRef ID, const ASTNodeKind &Kind)

static Expected< DynTypedNode > getNode(const ast_matchers::BoundNodes &Nodes, StringRef ID)

Defines a combinator library supporting the definition of selectors, which select source ranges based...

Defines the clang::SourceLocation class and associated facilities.

Defines the clang::TypeLoc interface and its subclasses.

Represents a call to a C++ constructor.

Represents a C++ base or member initializer.

CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).

Represents a character-granular source range.

static CharSourceRange getCharRange(SourceRange R)

static CharSourceRange getTokenRange(SourceRange R)

CompoundStmt - This represents a group of statements like { stmt stmt }.

SourceLocation getLBracLoc() const

SourceLocation getRBracLoc() const

A reference to a declared variable, function, enum, etc.

Decl - This represents one declaration (or definition), e.g.

SourceLocation getLocation() const

const LangOptions & getLangOpts() const LLVM_READONLY

Helper to get the language options from the ASTContext.

ASTNodeKind getNodeKind() const

SourceRange getSourceRange() const

For nodes which represent textual entities in the source code, return their SourceRange.

const T * get() const

Retrieve the stored node as type T.

This represents one expression.

IfStmt - This represents an if/then/else.

Describes an C or C++ initializer list.

Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...

static CharSourceRange makeFileCharRange(CharSourceRange Range, const SourceManager &SM, const LangOptions &LangOpts)

Accepts a range and returns a character range with file locations.

static SourceLocation GetBeginningOfToken(SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)

Given a location any where in a source buffer, find the location that corresponds to the beginning of...

static bool getRawToken(SourceLocation Loc, Token &Result, const SourceManager &SM, const LangOptions &LangOpts, bool IgnoreWhiteSpace=false)

Relex the token at the specified location.

MemberExpr - [C99 6.5.2.3] Structure and Union Members.

This represents a decl that may have a name.

Smart pointer class that efficiently represents Objective-C method names.

Encodes a location in the source.

SourceLocation getLocWithOffset(IntTy Offset) const

Return a source location with the specified offset from this SourceLocation.

This class handles loading and caching of source files into memory.

A trivial tuple used to represent a source range.

SourceLocation getEnd() const

Stmt - This represents one statement.

SourceLocation getBeginLoc() const LLVM_READONLY

Token - This structure provides full information about a lexed token.

Base wrapper for a particular "section" of type source info.

Maps string IDs to AST nodes matched by parts of a matcher.

A class to allow finding matches over the Clang AST.

TokenKind

Provides a simple uniform namespace for tokens from all C languages.

RangeSelector initListElements(std::string ID)

RangeSelector enclose(RangeSelector Begin, RangeSelector End)

Selects from the start of Begin and to the end of End.

RangeSelector member(std::string ID)

Given a MemberExpr, selects the member token.

RangeSelector elseBranch(std::string ID)

Given an \IfStmt (bound to ID), selects the range of the else branch, starting from the else keyword.

RangeSelector node(std::string ID)

Selects a node, including trailing semicolon, if any (for declarations and non-expression statements)...

MatchConsumer< CharSourceRange > RangeSelector

RangeSelector encloseNodes(std::string BeginID, std::string EndID)

Convenience version of range where end-points are bound nodes.

RangeSelector after(RangeSelector Selector)

Selects the point immediately following Selector.

RangeSelector constructExprArgs(std::string ID)

RangeSelector callArgs(std::string ID)

RangeSelector before(RangeSelector Selector)

Selects the (empty) range [B,B) when Selector selects the range [B,E).

RangeSelector statement(std::string ID)

Selects a node, including trailing semicolon (always).

RangeSelector expansion(RangeSelector S)

Selects the range from which S was expanded (possibly along with other source), if S is an expansion,...

RangeSelector statements(std::string ID)

RangeSelector name(std::string ID)

Given a node with a "name", (like NamedDecl, DeclRefExpr, CxxCtorInitializer, and TypeLoc) selects th...

The JSON file list parser is used to communicate input to InstallAPI.

@ Property

The type of a property.

const FunctionProtoType * T

Contains all information for a given match.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4