#include "clang/Tooling/Transformer/RangeSelector.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Tooling/Tooling.h"
#include "clang/Tooling/Transformer/Parsing.h"
#include "clang/Tooling/Transformer/SourceCode.h"
#include "llvm/Support/Error.h"
#include "llvm/Testing/Support/Error.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
usingnamespaceclang;
usingnamespacetransformer;
usingnamespaceast_matchers;
namespace {
Expected;
Failed;
HasValue;
StringError;
AllOf;
HasSubstr;
MatchResult;
struct TestMatch { … };
template <typename M> TestMatch matchCode(StringRef Code, M Matcher) { … }
Expected<StringRef> select(RangeSelector Selector, const TestMatch &Match) { … }
Expected<CharSourceRange> selectFromTrivial(const RangeSelector &Selector) { … }
testing::Matcher<StringError> withUnboundNodeMessage() { … }
Expected<CharSourceRange> selectFromAssorted(RangeSelector Selector) { … }
testing::Matcher<StringError> withTypeErrorMessage(const std::string &NodeID) { … }
TEST(RangeSelectorTest, UnboundNode) { … }
MATCHER_P(EqualsCharSourceRange, Range, "") { … }
TEST(RangeSelectorTest, BeforeOp) { … }
TEST(RangeSelectorTest, BeforeOpParsed) { … }
TEST(RangeSelectorTest, AfterOp) { … }
static SourceLocation getSpellingLocAfter(const MatchResult &Result,
StringRef Id, int Length) { … }
TEST(RangeSelectorTest, AfterOpInMacroArg) { … }
TEST(RangeSelectorTest, AfterOpInMacroArgEndsExpansion) { … }
TEST(RangeSelectorTest, AfterOpInPartOfMacroArg) { … }
TEST(RangeSelectorTest, BetweenOp) { … }
TEST(RangeSelectorTest, BetweenOpParsed) { … }
TEST(RangeSelectorTest, EncloseOpNodes) { … }
TEST(RangeSelectorTest, EncloseOpGeneral) { … }
TEST(RangeSelectorTest, EncloseOpNodesParsed) { … }
TEST(RangeSelectorTest, EncloseOpGeneralParsed) { … }
TEST(RangeSelectorTest, NodeOpStatement) { … }
TEST(RangeSelectorTest, NodeOpExpression) { … }
TEST(RangeSelectorTest, StatementOp) { … }
TEST(RangeSelectorTest, StatementOpParsed) { … }
TEST(RangeSelectorTest, MemberOp) { … }
TEST(RangeSelectorTest, MemberOpQualified) { … }
TEST(RangeSelectorTest, MemberOpTemplate) { … }
TEST(RangeSelectorTest, MemberOpOperator) { … }
TEST(RangeSelectorTest, NameOpNamedDecl) { … }
TEST(RangeSelectorTest, NameOpDeclRef) { … }
TEST(RangeSelectorTest, NameOpCtorInitializer) { … }
TEST(RangeSelectorTest, NameOpTypeLoc) { … }
TEST(RangeSelectorTest, NameOpTemplateSpecializationTypeLoc) { … }
TEST(RangeSelectorTest, NameOpErrors) { … }
TEST(RangeSelectorTest, NameOpDeclRefError) { … }
TEST(RangeSelectorTest, CallArgsOp) { … }
TEST(RangeSelectorTest, CallArgsOpNoArgs) { … }
TEST(RangeSelectorTest, CallArgsOpNoArgsWithComments) { … }
TEST(RangeSelectorTest, CallArgsOpWithParens) { … }
TEST(RangeSelectorTest, CallArgsOpLeadingComments) { … }
TEST(RangeSelectorTest, CallArgsOpTrailingComments) { … }
TEST(RangeSelectorTest, CallArgsOpEolComments) { … }
TEST(RangeSelectorTest, CallArgsErrors) { … }
TEST(RangeSelectorTest, ConstructExprArgs) { … }
TEST(RangeSelectorTest, ConstructExprBracedArgs) { … }
TEST(RangeSelectorTest, ConstructExprNoArgs) { … }
TEST(RangeSelectorTest, StatementsOp) { … }
TEST(RangeSelectorTest, StatementsOpEmptyList) { … }
TEST(RangeSelectorTest, StatementsOpErrors) { … }
TEST(RangeSelectorTest, ElementsOp) { … }
TEST(RangeSelectorTest, ElementsOpEmptyList) { … }
TEST(RangeSelectorTest, ElementsOpErrors) { … }
TEST(RangeSelectorTest, ElseBranchOpSingleStatement) { … }
TEST(RangeSelectorTest, ElseBranchOpCompoundStatement) { … }
TEST(RangeSelectorTest, ExpansionOp) { … }
TEST(RangeSelectorTest, ExpansionOpPartial) { … }
TEST(RangeSelectorTest, IfBoundOpBound) { … }
TEST(RangeSelectorTest, IfBoundOpUnbound) { … }
}