#include "Hover.h"
#include "AST.h"
#include "CodeCompletionStrings.h"
#include "Config.h"
#include "FindTarget.h"
#include "Headers.h"
#include "IncludeCleaner.h"
#include "ParsedAST.h"
#include "Selection.h"
#include "SourceCode.h"
#include "clang-include-cleaner/Analysis.h"
#include "clang-include-cleaner/IncludeSpeller.h"
#include "clang-include-cleaner/Types.h"
#include "index/SymbolCollector.h"
#include "support/Markup.h"
#include "support/Trace.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/ASTTypeTraits.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/OperationKinds.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/Type.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Index/IndexSymbol.h"
#include "clang/Tooling/Syntax/Tokens.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <optional>
#include <string>
#include <vector>
namespace clang {
namespace clangd {
namespace {
PrintingPolicy getPrintingPolicy(PrintingPolicy Base) { … }
std::string getLocalScope(const Decl *D) { … }
std::string getNamespaceScope(const Decl *D) { … }
std::string printDefinition(const Decl *D, PrintingPolicy PP,
const syntax::TokenBuffer &TB) { … }
const char *getMarkdownLanguage(const ASTContext &Ctx) { … }
HoverInfo::PrintedType printType(QualType QT, ASTContext &ASTCtx,
const PrintingPolicy &PP) { … }
HoverInfo::PrintedType printType(const TemplateTypeParmDecl *TTP) { … }
HoverInfo::PrintedType printType(const NonTypeTemplateParmDecl *NTTP,
const PrintingPolicy &PP) { … }
HoverInfo::PrintedType printType(const TemplateTemplateParmDecl *TTP,
const PrintingPolicy &PP) { … }
std::vector<HoverInfo::Param>
fetchTemplateParameters(const TemplateParameterList *Params,
const PrintingPolicy &PP) { … }
const FunctionDecl *getUnderlyingFunction(const Decl *D) { … }
const NamedDecl *getDeclForComment(const NamedDecl *D) { … }
void enhanceFromIndex(HoverInfo &Hover, const NamedDecl &ND,
const SymbolIndex *Index) { … }
const Expr *getDefaultArg(const ParmVarDecl *PVD) { … }
HoverInfo::Param toHoverInfoParam(const ParmVarDecl *PVD,
const PrintingPolicy &PP) { … }
void fillFunctionTypeAndParams(HoverInfo &HI, const Decl *D,
const FunctionDecl *FD,
const PrintingPolicy &PP) { … }
static llvm::FormattedNumber printHex(const llvm::APSInt &V) { … }
std::optional<std::string> printExprValue(const Expr *E,
const ASTContext &Ctx) { … }
struct PrintExprResult { … };
PrintExprResult printExprValue(const SelectionTree::Node *N,
const ASTContext &Ctx) { … }
std::optional<StringRef> fieldName(const Expr *E) { … }
std::optional<StringRef> getterVariableName(const CXXMethodDecl *CMD) { … }
std::optional<StringRef> setterVariableName(const CXXMethodDecl *CMD) { … }
std::string synthesizeDocumentation(const NamedDecl *ND) { … }
HoverInfo getHoverContents(const NamedDecl *D, const PrintingPolicy &PP,
const SymbolIndex *Index,
const syntax::TokenBuffer &TB) { … }
std::optional<HoverInfo>
getPredefinedExprHoverContents(const PredefinedExpr &PE, ASTContext &Ctx,
const PrintingPolicy &PP) { … }
HoverInfo evaluateMacroExpansion(unsigned int SpellingBeginOffset,
unsigned int SpellingEndOffset,
llvm::ArrayRef<syntax::Token> Expanded,
ParsedAST &AST) { … }
HoverInfo getHoverContents(const DefinedMacro &Macro, const syntax::Token &Tok,
ParsedAST &AST) { … }
std::string typeAsDefinition(const HoverInfo::PrintedType &PType) { … }
std::optional<HoverInfo> getThisExprHoverContents(const CXXThisExpr *CTE,
ASTContext &ASTCtx,
const PrintingPolicy &PP) { … }
HoverInfo getDeducedTypeHoverContents(QualType QT, const syntax::Token &Tok,
ASTContext &ASTCtx,
const PrintingPolicy &PP,
const SymbolIndex *Index) { … }
HoverInfo getStringLiteralContents(const StringLiteral *SL,
const PrintingPolicy &PP) { … }
bool isLiteral(const Expr *E) { … }
llvm::StringLiteral getNameForExpr(const Expr *E) { … }
void maybeAddCalleeArgInfo(const SelectionTree::Node *N, HoverInfo &HI,
const PrintingPolicy &PP);
std::optional<HoverInfo> getHoverContents(const SelectionTree::Node *N,
const Expr *E, ParsedAST &AST,
const PrintingPolicy &PP,
const SymbolIndex *Index) { … }
std::optional<HoverInfo> getHoverContents(const Attr *A, ParsedAST &AST) { … }
bool isParagraphBreak(llvm::StringRef Rest) { … }
bool punctuationIndicatesLineBreak(llvm::StringRef Line) { … }
bool isHardLineBreakIndicator(llvm::StringRef Rest) { … }
bool isHardLineBreakAfter(llvm::StringRef Line, llvm::StringRef Rest) { … }
void addLayoutInfo(const NamedDecl &ND, HoverInfo &HI) { … }
HoverInfo::PassType::PassMode getPassMode(QualType ParmType) { … }
void maybeAddCalleeArgInfo(const SelectionTree::Node *N, HoverInfo &HI,
const PrintingPolicy &PP) { … }
const NamedDecl *pickDeclToUse(llvm::ArrayRef<const NamedDecl *> Candidates) { … }
void maybeAddSymbolProviders(ParsedAST &AST, HoverInfo &HI,
include_cleaner::Symbol Sym) { … }
std::string getSymbolName(include_cleaner::Symbol Sym) { … }
void maybeAddUsedSymbols(ParsedAST &AST, HoverInfo &HI, const Inclusion &Inc) { … }
}
std::optional<HoverInfo> getHover(ParsedAST &AST, Position Pos,
const format::FormatStyle &Style,
const SymbolIndex *Index) { … }
static std::string formatSize(uint64_t SizeInBits) { … }
static std::string formatOffset(uint64_t OffsetInBits) { … }
markup::Document HoverInfo::present() const { … }
std::optional<llvm::StringRef> getBacktickQuoteRange(llvm::StringRef Line,
unsigned Offset) { … }
void parseDocumentationLine(llvm::StringRef Line, markup::Paragraph &Out) { … }
void parseDocumentation(llvm::StringRef Input, markup::Document &Output) { … }
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
const HoverInfo::PrintedType &T) { … }
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
const HoverInfo::Param &P) { … }
}
}