#include "clang/Tooling/Transformer/Stencil.h"
#include "clang/AST/ASTTypeTraits.h"
#include "clang/AST/Expr.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Tooling/FixIt.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/Error.h"
#include "llvm/Testing/Support/Error.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <optional>
usingnamespaceclang;
usingnamespacetransformer;
usingnamespaceast_matchers;
namespace {
Failed;
HasValue;
StringError;
AllOf;
HasSubstr;
MatchResult;
static std::string wrapSnippet(StringRef ExtraPreface,
StringRef StatementCode) { … }
static DeclarationMatcher wrapMatcher(const StatementMatcher &Matcher) { … }
struct TestMatch { … };
static std::optional<TestMatch> matchStmt(StringRef StatementCode,
StatementMatcher Matcher,
StringRef ExtraPreface = "") { … }
class StencilTest : public ::testing::Test { … };
TEST_F(StencilTest, SingleStatement) { … }
TEST_F(StencilTest, UnboundNode) { … }
void testExpr(StringRef Id, StringRef Snippet, const Stencil &Stencil,
StringRef Expected) { … }
void testFailure(StringRef Id, StringRef Snippet, const Stencil &Stencil,
testing::Matcher<std::string> MessageMatcher) { … }
TEST_F(StencilTest, SelectionOp) { … }
TEST_F(StencilTest, IfBoundOpBound) { … }
TEST_F(StencilTest, IfBoundOpUnbound) { … }
static auto selectMatcher() { … }
static auto selectStencil() { … }
TEST_F(StencilTest, SelectBoundChooseDetectedMatch) { … }
TEST_F(StencilTest, SelectBoundChooseFirst) { … }
TEST_F(StencilTest, SelectBoundDiesOnExhaustedCases) { … }
TEST_F(StencilTest, SelectBoundSucceedsWithDefault) { … }
TEST_F(StencilTest, ExpressionOpNoParens) { … }
TEST_F(StencilTest, ExpressionOpNoParensParens) { … }
TEST_F(StencilTest, ExpressionOpBinaryOpParens) { … }
TEST_F(StencilTest, ExpressionOpUnbound) { … }
TEST_F(StencilTest, DerefPointer) { … }
TEST_F(StencilTest, DerefBinOp) { … }
TEST_F(StencilTest, DerefAddressExpr) { … }
TEST_F(StencilTest, AddressOfValue) { … }
TEST_F(StencilTest, AddressOfDerefExpr) { … }
TEST_F(StencilTest, MaybeDerefValue) { … }
TEST_F(StencilTest, MaybeDerefPointer) { … }
TEST_F(StencilTest, MaybeDerefBinOp) { … }
TEST_F(StencilTest, MaybeDerefAddressExpr) { … }
TEST_F(StencilTest, MaybeDerefSmartPointer) { … }
TEST_F(StencilTest, MaybeDerefSmartPointerFromMemberExpr) { … }
TEST_F(StencilTest, MaybeAddressOfPointer) { … }
TEST_F(StencilTest, MaybeAddressOfValue) { … }
TEST_F(StencilTest, MaybeAddressOfBinOp) { … }
TEST_F(StencilTest, MaybeAddressOfDerefExpr) { … }
TEST_F(StencilTest, MaybeAddressOfSmartPointer) { … }
TEST_F(StencilTest, MaybeAddressOfSmartPointerFromMemberCall) { … }
TEST_F(StencilTest, MaybeAddressOfSmartPointerDerefNoCancel) { … }
TEST_F(StencilTest, AccessOpValue) { … }
TEST_F(StencilTest, AccessOpValueExplicitText) { … }
TEST_F(StencilTest, AccessOpValueAddress) { … }
TEST_F(StencilTest, AccessOpPointer) { … }
TEST_F(StencilTest, AccessOpPointerDereference) { … }
TEST_F(StencilTest, AccessOpSmartPointer) { … }
TEST_F(StencilTest, AccessOpSmartPointerDereference) { … }
TEST_F(StencilTest, AccessOpSmartPointerMemberCall) { … }
TEST_F(StencilTest, AccessOpExplicitThis) { … }
TEST_F(StencilTest, AccessOpImplicitThis) { … }
TEST_F(StencilTest, DescribeType) { … }
TEST_F(StencilTest, DescribeSugaredType) { … }
TEST_F(StencilTest, DescribeDeclType) { … }
TEST_F(StencilTest, DescribeQualifiedType) { … }
TEST_F(StencilTest, DescribeUnqualifiedType) { … }
TEST_F(StencilTest, DescribeAnonNamespaceType) { … }
TEST_F(StencilTest, DescribeFunction) { … }
TEST_F(StencilTest, DescribeImplicitOperator) { … }
TEST_F(StencilTest, RunOp) { … }
TEST_F(StencilTest, CatOfMacroRangeSucceeds) { … }
TEST_F(StencilTest, CatOfMacroArgRangeSucceeds) { … }
TEST_F(StencilTest, CatOfMacroArgSubRangeSucceeds) { … }
TEST_F(StencilTest, CatOfInvalidRangeFails) { … }
TEST(StencilToStringTest, RawTextOp) { … }
TEST(StencilToStringTest, RawTextOpEscaping) { … }
TEST(StencilToStringTest, DescribeOp) { … }
TEST(StencilToStringTest, DebugPrintNodeOp) { … }
TEST(StencilToStringTest, ExpressionOp) { … }
TEST(StencilToStringTest, DerefOp) { … }
TEST(StencilToStringTest, AddressOfOp) { … }
TEST(StencilToStringTest, SelectionOp) { … }
TEST(StencilToStringTest, AccessOpText) { … }
TEST(StencilToStringTest, AccessOpSelector) { … }
TEST(StencilToStringTest, AccessOpStencil) { … }
TEST(StencilToStringTest, IfBoundOp) { … }
TEST(StencilToStringTest, SelectBoundOp) { … }
TEST(StencilToStringTest, SelectBoundOpWithOneCase) { … }
TEST(StencilToStringTest, SelectBoundOpWithDefault) { … }
TEST(StencilToStringTest, RunOp) { … }
TEST(StencilToStringTest, Sequence) { … }
TEST(StencilToStringTest, SequenceEmpty) { … }
TEST(StencilToStringTest, SequenceSingle) { … }
TEST(StencilToStringTest, SequenceFromVector) { … }
}