llvm/clang-tools-extra/clangd/unittests/InlayHintTests.cpp

//===-- InlayHintTests.cpp  -------------------------------*- C++ -*-------===//
//
// 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 "Annotations.h"
#include "Config.h"
#include "InlayHints.h"
#include "Protocol.h"
#include "TestTU.h"
#include "TestWorkspace.h"
#include "XRefs.h"
#include "support/Context.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ScopedPrinter.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <string>
#include <vector>

namespace clang {
namespace clangd {

llvm::raw_ostream &operator<<(llvm::raw_ostream &Stream,
                              const InlayHint &Hint) {}

namespace {

ElementsAre;
IsEmpty;

std::vector<InlayHint> hintsOfKind(ParsedAST &AST, InlayHintKind Kind) {}

enum HintSide {};

struct ExpectedHint {};

MATCHER_P2(HintMatcher, Expected, Code, llvm::to_string(Expected)) {}

MATCHER_P(labelIs, Label, "") {}

Config noHintsConfig() {}

template <typename... ExpectedHints>
void assertHintsWithHeader(InlayHintKind Kind, llvm::StringRef AnnotatedSource,
                           llvm::StringRef HeaderContent,
                           ExpectedHints... Expected) {}

template <typename... ExpectedHints>
void assertHints(InlayHintKind Kind, llvm::StringRef AnnotatedSource,
                 ExpectedHints... Expected) {}

// Hack to allow expression-statements operating on parameter packs in C++14.
template <typename... T> void ignore(T &&...) {}

template <typename... ExpectedHints>
void assertParameterHints(llvm::StringRef AnnotatedSource,
                          ExpectedHints... Expected) {}

template <typename... ExpectedHints>
void assertTypeHints(llvm::StringRef AnnotatedSource,
                     ExpectedHints... Expected) {}

template <typename... ExpectedHints>
void assertDesignatorHints(llvm::StringRef AnnotatedSource,
                           ExpectedHints... Expected) {}

template <typename... ExpectedHints>
void assertBlockEndHints(llvm::StringRef AnnotatedSource,
                         ExpectedHints... Expected) {}

TEST(ParameterHints, Smoke) {}

TEST(ParameterHints, NoName) {}

TEST(ParameterHints, NoNameConstReference) {}

TEST(ParameterHints, NoNameReference) {}

TEST(ParameterHints, NoNameRValueReference) {}

TEST(ParameterHints, NoNameVariadicDeclaration) {}

TEST(ParameterHints, NoNameVariadicForwarded) {}

TEST(ParameterHints, NoNameVariadicPlain) {}

TEST(ParameterHints, NameInDefinition) {}

TEST(ParameterHints, NamePartiallyInDefinition) {}

TEST(ParameterHints, NameInDefinitionVariadic) {}

TEST(ParameterHints, NameMismatch) {}

TEST(ParameterHints, NameConstReference) {}

TEST(ParameterHints, NameTypeAliasConstReference) {}

TEST(ParameterHints, NameReference) {}

TEST(ParameterHints, NameTypeAliasReference) {}

TEST(ParameterHints, NameRValueReference) {}

TEST(ParameterHints, VariadicForwardedConstructor) {}

TEST(ParameterHints, VariadicPlainConstructor) {}

TEST(ParameterHints, VariadicForwardedNewConstructor) {}

TEST(ParameterHints, VariadicPlainNewConstructor) {}

TEST(ParameterHints, VariadicForwarded) {}

TEST(ParameterHints, VariadicPlain) {}

TEST(ParameterHints, VariadicPlainWithPackFirst) {}

TEST(ParameterHints, VariadicSplitTwolevel) {}

TEST(ParameterHints, VariadicNameFromSpecialization) {}

TEST(ParameterHints, VariadicNameFromSpecializationRecursive) {}

TEST(ParameterHints, VariadicOverloaded) {}

TEST(ParameterHints, VariadicRecursive) {}

TEST(ParameterHints, VariadicVarargs) {}

TEST(ParameterHints, VariadicTwolevelUnresolved) {}

TEST(ParameterHints, VariadicTwoCalls) {}

TEST(ParameterHints, VariadicInfinite) {}

TEST(ParameterHints, VariadicDuplicatePack) {}

TEST(ParameterHints, VariadicEmplace) {}

TEST(ParameterHints, VariadicReferenceHint) {}

TEST(ParameterHints, VariadicReferenceHintForwardingRef) {}

TEST(ParameterHints, VariadicReferenceHintForwardingRefStdForward) {}

TEST(ParameterHints, VariadicNoReferenceHintForwardingRefStdForward) {}

TEST(ParameterHints, VariadicNoReferenceHintUnresolvedForward) {}

TEST(ParameterHints, MatchingNameVariadicForwarded) {}

TEST(ParameterHints, MatchingNameVariadicPlain) {}

TEST(ParameterHints, Operator) {}

TEST(ParameterHints, FunctionCallOperator) {}

TEST(ParameterHints, DeducingThis) {}

TEST(ParameterHints, Macros) {}

TEST(ParameterHints, ConstructorParens) {}

TEST(ParameterHints, ConstructorBraces) {}

TEST(ParameterHints, ConstructorStdInitList) {}

TEST(ParameterHints, MemberInit) {}

TEST(ParameterHints, ImplicitConstructor) {}

TEST(ParameterHints, FunctionPointer) {}

TEST(ParameterHints, ArgMatchesParam) {}

TEST(ParameterHints, ArgMatchesParamReference) {}

TEST(ParameterHints, LeadingUnderscore) {}

TEST(ParameterHints, DependentCalls) {}

TEST(ParameterHints, VariadicFunction) {}

TEST(ParameterHints, VarargsFunction) {}

TEST(ParameterHints, CopyOrMoveConstructor) {}

TEST(ParameterHints, AggregateInit) {}

TEST(ParameterHints, UserDefinedLiteral) {}

TEST(ParameterHints, ParamNameComment) {}

TEST(ParameterHints, SetterFunctions) {}

TEST(ParameterHints, BuiltinFunctions) {}

TEST(ParameterHints, IncludeAtNonGlobalScope) {}

TEST(TypeHints, Smoke) {}

TEST(TypeHints, Decorations) {}

TEST(TypeHints, DecltypeAuto) {}

TEST(TypeHints, NoQualifiers) {}

TEST(TypeHints, Lambda) {}

// Structured bindings tests.
// Note, we hint the individual bindings, not the aggregate.

TEST(TypeHints, StructuredBindings_PublicStruct) {}

TEST(TypeHints, StructuredBindings_Array) {}

TEST(TypeHints, StructuredBindings_TupleLike) {}

TEST(TypeHints, StructuredBindings_NoInitializer) {}

TEST(TypeHints, InvalidType) {}

TEST(TypeHints, ReturnTypeDeduction) {}

TEST(TypeHints, DependentType) {}

TEST(TypeHints, LongTypeName) {}

TEST(TypeHints, DefaultTemplateArgs) {}

TEST(TypeHints, Deduplication) {}

TEST(TypeHints, SinglyInstantiatedTemplate) {}

TEST(TypeHints, Aliased) {}

TEST(TypeHints, Decltype) {}

TEST(TypeHints, SubstTemplateParameterAliases) {}

TEST(DesignatorHints, Basic) {}

TEST(DesignatorHints, Nested) {}

TEST(DesignatorHints, AnonymousRecord) {}

TEST(DesignatorHints, Suppression) {}

TEST(DesignatorHints, StdArray) {}

TEST(DesignatorHints, OnlyAggregateInit) {}

TEST(DesignatorHints, NoCrash) {}

TEST(InlayHints, RestrictRange) {}

TEST(ParameterHints, PseudoObjectExpr) {}

TEST(ParameterHints, ArgPacksAndConstructors) {}

TEST(ParameterHints, DoesntExpandAllArgs) {}

TEST(BlockEndHints, Functions) {}

TEST(BlockEndHints, Methods) {}

TEST(BlockEndHints, Namespaces) {}

TEST(BlockEndHints, Types) {}

TEST(BlockEndHints, If) {}

TEST(BlockEndHints, Loops) {}

TEST(BlockEndHints, Switch) {}

TEST(BlockEndHints, PrintLiterals) {}

TEST(BlockEndHints, PrintRefs) {}

TEST(BlockEndHints, PrintConversions) {}

TEST(BlockEndHints, PrintOperators) {}

TEST(BlockEndHints, TrailingSemicolon) {}

TEST(BlockEndHints, TrailingText) {}

TEST(BlockEndHints, Macro) {}

TEST(BlockEndHints, PointerToMemberFunction) {}

// FIXME: Low-hanging fruit where we could omit a type hint:
//  - auto x = TypeName(...);
//  - auto x = (TypeName) (...);
//  - auto x = static_cast<TypeName>(...);  // and other built-in casts

// Annoyances for which a heuristic is not obvious:
//  - auto x = llvm::dyn_cast<LongTypeName>(y);  // and similar
//  - stdlib algos return unwieldy __normal_iterator<X*, ...> type
//    (For this one, perhaps we should omit type hints that start
//     with a double underscore.)

} // namespace
} // namespace clangd
} // namespace clang