#include "clang/Tooling/Transformer/RangeSelector.h"
#include "clang/AST/Expr.h"
#include "clang/AST/TypeLoc.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Lex/Lexer.h"
#include "clang/Tooling/Transformer/SourceCode.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include <string>
#include <utility>
#include <vector>
usingnamespaceclang;
usingnamespacetransformer;
MatchFinder;
Error;
StringError;
MatchResult;
static Error invalidArgumentError(Twine Message) { … }
static Error typeError(StringRef ID, const ASTNodeKind &Kind) { … }
static Error typeError(StringRef ID, const ASTNodeKind &Kind,
Twine ExpectedType) { … }
static Error missingPropertyError(StringRef ID, Twine Description,
StringRef Property) { … }
static Expected<DynTypedNode> getNode(const ast_matchers::BoundNodes &Nodes,
StringRef ID) { … }
static SourceLocation findPreviousTokenStart(SourceLocation Start,
const SourceManager &SM,
const LangOptions &LangOpts) { … }
static SourceLocation findPreviousTokenKind(SourceLocation Start,
const SourceManager &SM,
const LangOptions &LangOpts,
tok::TokenKind TK) { … }
RangeSelector transformer::before(RangeSelector Selector) { … }
RangeSelector transformer::after(RangeSelector Selector) { … }
RangeSelector transformer::node(std::string ID) { … }
RangeSelector transformer::statement(std::string ID) { … }
RangeSelector transformer::enclose(RangeSelector Begin, RangeSelector End) { … }
RangeSelector transformer::encloseNodes(std::string BeginID,
std::string EndID) { … }
RangeSelector transformer::member(std::string ID) { … }
RangeSelector transformer::name(std::string ID) { … }
namespace {
template <typename T, CharSourceRange (*Func)(const MatchResult &, const T &)>
class RelativeSelector { … };
}
namespace {
CharSourceRange getStatementsRange(const MatchResult &,
const CompoundStmt &CS) { … }
}
RangeSelector transformer::statements(std::string ID) { … }
namespace {
SourceLocation getRLoc(const CallExpr &E) { … }
SourceLocation getRLoc(const CXXConstructExpr &E) { … }
tok::TokenKind getStartToken(const CallExpr &E) { … }
tok::TokenKind getStartToken(const CXXConstructExpr &E) { … }
template <typename ExprWithArgs>
SourceLocation findArgStartDelimiter(const ExprWithArgs &E, SourceLocation RLoc,
const SourceManager &SM,
const LangOptions &LangOpts) { … }
template <typename ExprWithArgs>
CharSourceRange getArgumentsRange(const MatchResult &Result,
const ExprWithArgs &CE) { … }
}
RangeSelector transformer::callArgs(std::string ID) { … }
RangeSelector transformer::constructExprArgs(std::string ID) { … }
namespace {
CharSourceRange getElementsRange(const MatchResult &,
const InitListExpr &E) { … }
}
RangeSelector transformer::initListElements(std::string ID) { … }
namespace {
CharSourceRange getElseRange(const MatchResult &Result, const IfStmt &S) { … }
}
RangeSelector transformer::elseBranch(std::string ID) { … }
RangeSelector transformer::expansion(RangeSelector S) { … }