llvm/clang/unittests/Tooling/ASTSelectionTest.cpp

//===- unittest/Tooling/ASTSelectionTest.cpp ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "TestVisitor.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Tooling/Refactoring/ASTSelection.h"
#include <optional>

usingnamespaceclang;
usingnamespacetooling;

namespace {

struct FileLocation {};

FileRange;

class SelectionFinderVisitor : public TestVisitor<SelectionFinderVisitor> {};

/// This is a test utility function that computes the AST selection at the
/// given location with an optional selection range.
///
/// A location roughly corresponds to a cursor location in an editor, while
/// the optional range corresponds to the selection range in an editor.
void findSelectedASTNodesWithRange(
    StringRef Source, FileLocation Location,
    std::optional<FileRange> SelectionRange,
    llvm::function_ref<void(SourceRange SelectionRange,
                            std::optional<SelectedASTNode>)>
        Consumer,
    SelectionFinderVisitor::Language Language =
        SelectionFinderVisitor::Lang_CXX11) {}

void findSelectedASTNodes(
    StringRef Source, FileLocation Location,
    std::optional<FileRange> SelectionRange,
    llvm::function_ref<void(std::optional<SelectedASTNode>)> Consumer,
    SelectionFinderVisitor::Language Language =
        SelectionFinderVisitor::Lang_CXX11) {}

void checkNodeImpl(bool IsTypeMatched, const SelectedASTNode &Node,
                   SourceSelectionKind SelectionKind, unsigned NumChildren) {}

void checkDeclName(const SelectedASTNode &Node, StringRef Name) {}

template <typename T>
const SelectedASTNode &
checkNode(const SelectedASTNode &StmtNode, SourceSelectionKind SelectionKind,
          unsigned NumChildren = 0,
          std::enable_if_t<std::is_base_of_v<Stmt, T>, T> *StmtOverloadChecker =
              nullptr) {}

template <typename T>
const SelectedASTNode &
checkNode(const SelectedASTNode &DeclNode, SourceSelectionKind SelectionKind,
          unsigned NumChildren = 0, StringRef Name = "",
          std::enable_if_t<std::is_base_of_v<Decl, T>, T> *DeclOverloadChecker =
              nullptr) {}

struct ForAllChildrenOf {};

ForAllChildrenOf allChildrenOf(const SelectedASTNode &Node) {}

TEST(ASTSelectionFinder, CursorNoSelection) {}

TEST(ASTSelectionFinder, CursorAtStartOfFunction) {}

TEST(ASTSelectionFinder, RangeNoSelection) {}

TEST(ASTSelectionFinder, EmptyRangeFallbackToCursor) {}

TEST(ASTSelectionFinder, WholeFunctionSelection) {}

TEST(ASTSelectionFinder, MultipleFunctionSelection) {}

TEST(ASTSelectionFinder, MultipleStatementSelection) {}

TEST(ASTSelectionFinder, SelectionInFunctionInObjCImplementation) {}

TEST(ASTSelectionFinder, FunctionInObjCImplementationCarefulWithEarlyExit) {}

TEST(ASTSelectionFinder, AvoidImplicitDeclarations) {}

TEST(ASTSelectionFinder, CorrectEndForObjectiveCImplementation) {}

const SelectedASTNode &checkFnBody(const std::optional<SelectedASTNode> &Node,
                                   StringRef Name) {}

TEST(ASTSelectionFinder, SelectObjectiveCPseudoObjectExprs) {}

TEST(ASTSelectionFinder, SimpleCodeRangeASTSelection) {}

TEST(ASTSelectionFinder, OutOfBodyCodeRange) {}

TEST(ASTSelectionFinder, SelectVarDeclStmt) {}

TEST(ASTSelectionFinder, SelectEntireDeclStmtRange) {}

TEST(ASTSelectionFinder, SelectEntireDeclStmtRangeWithMultipleDecls) {}

TEST(ASTSelectionFinder, SimpleCodeRangeASTSelectionInObjCMethod) {}

TEST(ASTSelectionFinder, CanonicalizeObjCStringLiteral) {}

TEST(ASTSelectionFinder, CanonicalizeMemberCalleeToCall) {}

TEST(ASTSelectionFinder, CanonicalizeFuncCalleeToCall) {}

} // end anonymous namespace