clang-tools 8.0.0

Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
clang::clangd Namespace Reference

## Namespaces
| detail
| dex
| riff
| trace

## Classes
struct | ApplyWorkspaceEditParams
struct | ASTRetentionPolicy
| Configuration of the AST retention policy. More...
class | AsyncTaskRunner
| Runs tasks on separate (detached) threads and wait for all tasks to finish. More...
class | BackgroundIndex
class | BackgroundIndexStorage
class | CancelledError
| Conventional error when no result is returned due to cancellation. More...
class | CanonicalIncludes
| Maps a definition location onto an #include file, based on a set of filename rules. More...
struct | ClangdCompileCommand
| Clangd extension that's used in the 'compilationDatabaseChanges' in workspace/didChangeConfiguration to record updates to the in-memory compilation database. More...
struct | ClangdDiagnosticOptions
class | ClangdLSPServer
| This class exposes ClangdServer's capabilities via Language Server Protocol. More...
class | ClangdServer
| Manages a collection of source files and derived data (ASTs, indexes), and provides language-aware features such as code completion. More...
struct | ClientCapabilities
struct | CodeAction
| A code action represents a change that can be performed in code, e.g. More...
struct | CodeActionContext
struct | CodeActionParams
struct | CodeCompleteOptions
struct | CodeCompleteResult
struct | CodeCompletion
struct | Command
struct | CompletionContext
struct | CompletionItem
struct | CompletionList
| Represents a collection of completion items to be presented in the editor. More...
struct | CompletionParams
struct | ConfigurationSettings
| Clangd extension: parameters configurable at any time, via the `workspace/didChangeConfiguration` notification. More...
class | Context
| A context is an immutable container for per-request data that must be propagated through layers that don't care about it. More...
class | Deadline
| A point in time we can wait for. More...
struct | Diag
| A top-level diagnostic that may have Notes and Fixes. More...
struct | DiagBase
| Contains basic information about a diagnostic. More...
struct | Diagnostic
class | DiagnosticsConsumer
struct | DidChangeConfigurationParams
struct | DidChangeTextDocumentParams
struct | DidChangeWatchedFilesParams
struct | DidCloseTextDocumentParams
struct | DidOpenTextDocumentParams
class | DirectoryBasedGlobalCompilationDatabase
| Gets compile args from tooling::CompilationDatabases built for parent directories. More...
struct | DocumentFormattingParams
struct | DocumentHighlight
| A document highlight is a range inside a text document which deserves special attention. More...
struct | DocumentOnTypeFormattingParams
struct | DocumentRangeFormattingParams
struct | DocumentSymbol
| Represents programming constructs like variables, classes, interfaces etc. More...
struct | DocumentSymbolParams
class | DraftStore
| A thread-safe container for files opened in a workspace, addressed by filenames. More...
class | Event
| An Event<T> allows events of type T to be broadcast to listeners. More...
struct | ExecuteCommandParams
| Exact commands are not specified in the protocol so we define the ones supported by Clangd here. More...
class | FileDistance
struct | FileDistanceOptions
struct | FileEvent
class | FileIndex
| This manages symbols from files and an in-memory index on all symbols. More...
struct | FileStatus
| Clangd extension: indicates the current state of the file in clangd, sent from server via the `textDocument/clangd.fileStatus` notification. More...
class | FileSymbols
| A container of Symbols from several source files. More...
class | FileSystemProvider
struct | Fix
| Represents a single fix-it that editor can apply to fix the error. More...
struct | FormattingOptions
struct | ForwardBinder
| Stores a callable object (Func) and arguments (Args) and allows to call the callable with provided arguments later using `operator ()`. More...
struct | FuzzyFindRequest
class | FuzzyMatcher
class | GlobalCompilationDatabase
| Provides compilation arguments used for parsing C and C++ files. More...
struct | HeaderFile
| Represents a header file to be #include'd. More...
struct | Hover
class | IgnoreDiagnostics
struct | IncludeGraphNode
class | IncludeInserter
class | IncludeStructure
struct | Inclusion
struct | IndexFileIn
struct | IndexFileOut
struct | InitializationOptions
| Clangd extension: parameters configurable at `initialize` time. More...
struct | InitializeParams
struct | InputsAndAST
struct | InputsAndPreamble
class | Key
| Values in a Context are indexed by typed keys. More...
struct | Location
class | Logger
| Interface to allow custom logging in clangd. More...
class | LoggingSession
| Only one LoggingSession can be active at a time. More...
struct | LookupRequest
struct | LSPDiagnosticCompare
| A LSP-specific comparator used to find diagnostic in a container like std:map. More...
class | LSPError
struct | MarkupContent
class | MemIndex
| MemIndex is a naive in-memory index suitable for a small set of symbols. More...
class | MergedIndex
struct | NoParams
struct | Note
| Represents a note for the diagnostic. More...
class | Notification
| A threadsafe flag that is initially clear. More...
class | OpaqueType
| A representation of a type that can be computed based on clang AST and compared for equality. More...
class | OverlayCDB
| Wraps another compilation database, and supports overriding the commands using an in-memory mapping. More...
struct | ParameterInformation
| A single parameter of a particular signature. More...
class | ParsedAST
| Stores and provides access to parsed AST. More...
struct | ParseInputs
| Information required to run clang, e.g. to parse AST or do code completion. More...
class | ParsingCallbacks
struct | Position
struct | PreambleData
class | PreambleFileStatusCache
| Records status information for files open()ed or stat()ed during preamble build (except for the main file), so we can avoid stat()s on the underlying FS when reusing the preamble. More...
struct | ProjectInfo
struct | Range
class | RealFileSystemProvider
struct | Ref
struct | ReferenceParams
class | RefSlab
struct | RefsRequest
struct | RenameParams
class | ScopeDistance
| Support lookups like FileDistance, but the lookup keys are symbol scopes. More...
class | Semaphore
| Limits the number of threads that can acquire the lock at the same time. More...
struct | SignatureHelp
| Represents the signature of a callable. More...
struct | SignatureInformation
| Represents the signature of something callable. More...
struct | SignatureQualitySignals
struct | SourceParams
struct | SpeculativeFuzzyFind
| A speculative and asynchronous fuzzy find index request (based on cached request) that can be sent before parsing sema. More...
class | StoreDiags
| StoreDiags collects the diagnostics that can later be reported by clangd. More...
class | StreamLogger
class | SwapIndex
struct | Symbol
class | SymbolCollector
| Collect declarations (symbols) from an AST. More...
struct | SymbolDetails
| Represents information about identifier. More...
class | SymbolID
class | SymbolIndex
| Interface for symbol indexes that can be used for searching or matching symbols among a set of symbols based on names or unique IDs. More...
struct | SymbolInformation
| Represents information about programming constructs like variables, classes, interfaces etc. More...
struct | SymbolLocation
struct | SymbolQualitySignals
| Attributes of a symbol that affect how much we like it. More...
struct | SymbolRelevanceSignals
| Attributes of a symbol-query pair that affect how much we like it. More...
class | SymbolSlab
struct | TextDocumentContentChangeEvent
struct | TextDocumentIdentifier
struct | TextDocumentItem
struct | TextDocumentPositionParams
struct | TextEdit
class | TopN
| TopN<T> is a lossy container that preserves only the "best" N elements. More...
class | Transport
struct | TUAction
class | TUScheduler
| Handles running tasks for ClangdServer and managing the resources (e.g., preambles and ASTs) for opened files. More...
struct | TUStatus
class | URI
| A URI describes the location of a source file. More...
class | URIDistance
struct | URIForFile
class | URIScheme
| URIScheme is an extension point for teaching clangd to recognize a custom URI scheme. More...
class | WithContext
| WithContext replaces Context::current() with a provided scope. More...
class | WithContextValue
| WithContextValue extends Context::current() with a single value. More...
struct | WorkspaceEdit
struct | WorkspaceSymbolParams
| The parameters of a Workspace Symbol Request. More...

## Typedefs
using | Canceler = std::function< void()>
| A canceller requests cancellation of a task, when called. More...
using | PreambleParsedCallback = std::function< void(ASTContext &, std::shared_ptr< clang::Preprocessor >)>
template<typename T >
using | Callback = llvm::unique_function< void(llvm::Expected< T >)>
| A Callback<T> is a void function that accepts Expected<T>. More...
using | CharTypeSet = unsigned char
using | IncludeGraph = llvm::StringMap< IncludeGraphNode >
using | Path = std::string
| A typedef to represent a file path. More...
using | PathRef = llvm::StringRef
| A typedef to represent a ref to file path. More...
using | ShutdownParams = NoParams
using | ExitParams = NoParams
using | CompletionItemKindBitset = std::bitset< CompletionItemKindMax+1 >
using | SymbolKindBitset = std::bitset< SymbolKindMax+1 >
using | FileDigest = decltype(llvm::SHA1::hash({}))
typedef llvm::Registry< URIScheme > | URISchemeRegistry
| By default, a "file" scheme is supported where URI paths are always absolute in the file system. More...

## Enumerations
enum | CharType : unsigned char { Empty = 0, Lower = 1, Upper = 2, Punctuation = 3 }
enum | CharRole : unsigned char { Unknown = 0, Tail = 1, Head = 2, Separator = 3 }
enum | IndexType { IndexType::Light, IndexType::Heavy }
| Select between in-memory index implementations, which have tradeoffs. More...
enum | DuplicateHandling { DuplicateHandling::PickOne, DuplicateHandling::Merge }
| How to handle duplicated symbols across multiple files. More...
enum | SymbolOrigin : uint8_t { SymbolOrigin::Unknown = 0, SymbolOrigin::AST = 1 << 0, SymbolOrigin::Dynamic = 1 << 1, SymbolOrigin::Static = 1 << 2, SymbolOrigin::Merge = 1 << 3 }
enum | RefKind : uint8_t { RefKind::Unknown = 0, RefKind::Declaration = static_cast<uint8_t>(index::SymbolRole::Declaration), RefKind::Definition = static_cast<uint8_t>(index::SymbolRole::Definition), RefKind::Reference = static_cast<uint8_t>(index::SymbolRole::Reference), RefKind::All = Declaration | Definition | Reference }
enum | IndexFileFormat { IndexFileFormat::RIFF, IndexFileFormat::YAML }
enum | ErrorCode { ErrorCode::ParseError = -32700, ErrorCode::InvalidRequest = -32600, ErrorCode::MethodNotFound = -32601, ErrorCode::InvalidParams = -32602, ErrorCode::InternalError = -32603, ErrorCode::ServerNotInitialized = -32002, ErrorCode::UnknownErrorCode = -32001, ErrorCode::RequestCancelled = -32800 }
enum | TraceLevel { TraceLevel::Off = 0, TraceLevel::Messages = 1, TraceLevel::Verbose = 2 }
enum | TextDocumentSyncKind { TextDocumentSyncKind::None = 0, TextDocumentSyncKind::Full = 1, TextDocumentSyncKind::Incremental = 2 }
| Defines how the host (editor) should sync document changes to the language server. More...
enum | CompletionItemKind { CompletionItemKind::Missing = 0, CompletionItemKind::Text = 1, CompletionItemKind::Method = 2, CompletionItemKind::Function = 3, CompletionItemKind::Constructor = 4, CompletionItemKind::Field = 5, CompletionItemKind::Variable = 6, CompletionItemKind::Class = 7, CompletionItemKind::Interface = 8, CompletionItemKind::Module = 9, CompletionItemKind::Property = 10, CompletionItemKind::Unit = 11, CompletionItemKind::Value = 12, CompletionItemKind::Enum = 13, CompletionItemKind::Keyword = 14, CompletionItemKind::Snippet = 15, CompletionItemKind::Color = 16, CompletionItemKind::File = 17, CompletionItemKind::Reference = 18, CompletionItemKind::Folder = 19, CompletionItemKind::EnumMember = 20, CompletionItemKind::Constant = 21, CompletionItemKind::Struct = 22, CompletionItemKind::Event = 23, CompletionItemKind::Operator = 24, CompletionItemKind::TypeParameter = 25 }
| The kind of a completion entry. More...
enum | SymbolKind { SymbolKind::File = 1, SymbolKind::Module = 2, SymbolKind::Namespace = 3, SymbolKind::Package = 4, SymbolKind::Class = 5, SymbolKind::Method = 6, SymbolKind::Property = 7, SymbolKind::Field = 8, SymbolKind::Constructor = 9, SymbolKind::Enum = 10, SymbolKind::Interface = 11, SymbolKind::Function = 12, SymbolKind::Variable = 13, SymbolKind::Constant = 14, SymbolKind::String = 15, SymbolKind::Number = 16, SymbolKind::Boolean = 17, SymbolKind::Array = 18, SymbolKind::Object = 19, SymbolKind::Key = 20, SymbolKind::Null = 21, SymbolKind::EnumMember = 22, SymbolKind::Struct = 23, SymbolKind::Event = 24, SymbolKind::Operator = 25, SymbolKind::TypeParameter = 26 }
| A symbol kind. More...
enum | FileChangeType { FileChangeType::Created = 1, FileChangeType::Changed = 2, FileChangeType::Deleted = 3 }
enum | CompletionTriggerKind { CompletionTriggerKind::Invoked = 1, CompletionTriggerKind::TriggerCharacter = 2, CompletionTriggerKind::TriggerTriggerForIncompleteCompletions = 3 }
enum | MarkupKind { MarkupKind::PlainText, MarkupKind::Markdown }
enum | InsertTextFormat { InsertTextFormat::Missing = 0, InsertTextFormat::PlainText = 1, InsertTextFormat::Snippet = 2 }
| Defines whether the insert text in a completion item should be interpreted as plain text or a snippet. More...
enum | DocumentHighlightKind { DocumentHighlightKind::Text = 1, DocumentHighlightKind::Read = 2, DocumentHighlightKind::Write = 3 }
enum | ThreadPriority { ThreadPriority::Low = 0, ThreadPriority::Normal = 1 }
enum | CompletionStyleFlag { Detailed, Bundled }
enum | PCHStorageFlag { Disk, Memory }
enum | CompileArgsFrom { LSPCompileArgs, FilesystemCompileArgs }
enum | JSONStreamStyle { Standard, Delimited }
enum | WantDiagnostics { WantDiagnostics::Yes, WantDiagnostics::No, WantDiagnostics::Auto }
| Determines whether diagnostics should be generated for a file snapshot. More...

## Functions
bool | isSpelledInSourceCode (const Decl *D)
bool | isImplementationDetail (const Decl *D)
| Returns true if the declaration is considered implementation detail based on heuristics. More...
SourceLocation | findNameLoc (const clang::Decl *D)
| Find the identifier source location of the given D. More...
std::string | printQualifiedName (const NamedDecl &ND)
| Returns the qualified name of ND. More...
static const TemplateArgumentList * | getTemplateSpecializationArgs (const NamedDecl &ND)
std::string | printName (const ASTContext &Ctx, const NamedDecl &ND)
| Prints unqualified name of the decl for the purpose of displaying it to the user. More...
std::string | printNamespaceScope (const DeclContext &DC)
| Returns the first enclosing namespace scope starting from `DC`. More...
llvm::Optional< SymbolID > | getSymbolID (const Decl *D)
| Gets the symbol ID for a declaration, if possible. More...
llvm::Optional< SymbolID > | getSymbolID (const IdentifierInfo &II, const MacroInfo *MI, const SourceManager &SM)
| Gets the symbol ID for a macro, if possible. More...
std::pair< Context, Canceler > | cancelableTask ()
| Defines a new task whose cancellation may be requested. More...
bool | isCancelled (const Context &Ctx=Context::current())
| True if the current context is within a cancelable task which was cancelled. More...
static std::vector< SymbolInformation > | flattenSymbolHierarchy (llvm::ArrayRef< DocumentSymbol > Symbols, const URIForFile &FileURI)
| The functions constructs a flattened view of the DocumentSymbol hierarchy. More...
static llvm::Optional< Command > | asCommand (const CodeAction &Action)
void | dumpAST (ParsedAST &AST, llvm::raw_ostream &OS)
| For testing/debugging purposes. More...
std::unique_ptr< CompilerInvocation > | buildCompilerInvocation (const ParseInputs &Inputs)
| Builds compiler invocation that could be used to build AST or preamble. More...
std::shared_ptr< const PreambleData > | buildPreamble (PathRef FileName, CompilerInvocation &CI, std::shared_ptr< const PreambleData > OldPreamble, const tooling::CompileCommand &OldCompileCommand, const ParseInputs &Inputs, std::shared_ptr< PCHContainerOperations > PCHs, bool StoreInMemory, PreambleParsedCallback PreambleCallback)
| Rebuild the preamble for the new inputs unless the old one can be reused. More...
llvm::Optional< ParsedAST > | buildAST (PathRef FileName, std::unique_ptr< CompilerInvocation > Invocation, const ParseInputs &Inputs, std::shared_ptr< const PreambleData > Preamble, std::shared_ptr< PCHContainerOperations > PCHs)
| Build an AST from provided user inputs. More...
SourceLocation | getBeginningOfIdentifier (ParsedAST &Unit, const Position &Pos, const FileID FID)
| Get the beginning SourceLocation at a specified `Pos`. More...
llvm::Expected< llvm::StringRef > | speculateCompletionFilter (llvm::StringRef Content, Position Pos)
| Retrives a speculative code completion filter text before the cursor. More...
CodeCompleteResult | codeComplete (PathRef FileName, const tooling::CompileCommand &Command, const PreambleData *Preamble, llvm::StringRef Contents, Position Pos, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, std::shared_ptr< PCHContainerOperations > PCHs, CodeCompleteOptions Opts, SpeculativeFuzzyFind *SpecFuzzyFind)
SignatureHelp | signatureHelp (PathRef FileName, const tooling::CompileCommand &Command, const PreambleData *Preamble, llvm::StringRef Contents, Position Pos, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, std::shared_ptr< PCHContainerOperations > PCHs, const SymbolIndex *Index)
bool | isIndexedForCodeCompletion (const NamedDecl &ND, ASTContext &ASTCtx)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const CodeCompletion &C)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const CodeCompleteResult &R)
raw_ostream & | operator<< (raw_ostream &, const CodeCompletion &)
raw_ostream & | operator<< (raw_ostream &, const CodeCompleteResult &)
CodeCompleteResult | codeComplete (PathRef FileName, const tooling::CompileCommand &Command, const PreambleData *Preamble, StringRef Contents, Position Pos, IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, std::shared_ptr< PCHContainerOperations > PCHs, CodeCompleteOptions Opts, SpeculativeFuzzyFind *SpecFuzzyFind=nullptr)
| Get code completions at a specified `Pos` in `FileName`. More...
SignatureHelp | signatureHelp (PathRef FileName, const tooling::CompileCommand &Command, const PreambleData *Preamble, StringRef Contents, Position Pos, IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, std::shared_ptr< PCHContainerOperations > PCHs, const SymbolIndex *Index)
| Get signature help at a specified `Pos` in `FileName`. More...
std::string | getDocComment (const ASTContext &Ctx, const CodeCompletionResult &Result, bool CommentsFromHeaders)
| Gets a minimally formatted documentation comment of `Result`, with comment markers stripped. More...
std::string | getDeclComment (const ASTContext &Ctx, const NamedDecl &D)
| Similar to getDocComment, but returns the comment for a NamedDecl. More...
void | getSignature (const CodeCompletionString &CCS, std::string *Signature, std::string *Snippet, std::string *RequiredQualifiers=nullptr)
| Formats the signature for an item, as a display string and snippet. More...
std::string | formatDocumentation (const CodeCompletionString &CCS, llvm::StringRef DocComment)
| Assembles formatted documentation for a completion result. More...
std::string | getReturnType (const CodeCompletionString &CCS)
| Gets detail to be used as the detail field in an LSP completion item. More...
std::unique_ptr< CompilerInstance > | prepareCompilerInstance (std::unique_ptr< clang::CompilerInvocation > CI, const PrecompiledPreamble *Preamble, std::unique_ptr< llvm::MemoryBuffer > Buffer, std::shared_ptr< PCHContainerOperations > PCHs, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, DiagnosticConsumer &DiagsClient)
std::unique_ptr< CompilerInstance > | prepareCompilerInstance (std::unique_ptr< clang::CompilerInvocation >, const PrecompiledPreamble *, std::unique_ptr< llvm::MemoryBuffer > MainFile, std::shared_ptr< PCHContainerOperations >, IntrusiveRefCntPtr< llvm::vfs::FileSystem >, DiagnosticConsumer &)
| Creates a compiler instance, configured so that: More...
static Context & | currentContext ()
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const DiagBase &D)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Fix &F)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Diag &D)
CodeAction | toCodeAction (const Fix &D, const URIForFile &File)
| Convert from Fix to LSP CodeAction. More...
void | toLSPDiags (const Diag &D, const URIForFile &File, const ClangdDiagnosticOptions &Opts, llvm::function_ref< void(clangd::Diagnostic, llvm::ArrayRef< Fix >)> OutFn)
| Conversion to LSP diagnostics. More...
int | getSeverity (DiagnosticsEngine::Level L)
| Convert from clang diagnostic level to LSP severity. More...
static llvm::SmallString< 128 > | canonicalize (llvm::StringRef Path)
static std::pair< std::string, int > | scopeToPath (llvm::StringRef Scope)
static FileDistance | createScopeFileDistance (llvm::ArrayRef< std::string > QueryScopes)
llvm::Expected< std::vector< SymbolInformation > > | getWorkspaceSymbols (llvm::StringRef Query, int Limit, const SymbolIndex *const Index, llvm::StringRef HintPath)
| Searches for the symbols matching `Query`. More...
llvm::Expected< std::vector< DocumentSymbol > > | getDocumentSymbols (ParsedAST &AST)
| Retrieves the symbols contained in the "main file" section of an AST in the same order that they appear. More...
template<class Func , class... Args>
ForwardBinder< Func, Args... > | Bind (Func F, Args &&... As)
| Creates an object that stores a callable (`F`) and first arguments to the callable (`As`) and allows to call `F` with at a later point. More...
static char | lower (char C)
static bool | isAwful (int S)
template<typename T >
static T | packedLookup (const uint8_t *Data, int I)
CharTypeSet | calculateRoles (llvm::StringRef Text, llvm::MutableArrayRef< CharRole > Roles)
static std::string | getFallbackClangPath ()
bool | isLiteralInclude (llvm::StringRef Include)
| Returns true if `Include` is literal include like "path" or <path>. More...
std::unique_ptr< PPCallbacks > | collectIncludeStructureCallback (const SourceManager &SM, IncludeStructure *Out)
| Returns a PPCallback that visits all inclusions in the main file. More...
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Inclusion &Inc)
std::unique_ptr< CommentHandler > | collectIWYUHeaderMaps (CanonicalIncludes *Includes)
| Returns a CommentHandler that parses pragma comment on include files to determine when we should include a different header from the header that directly defines a symbol. More...
void | addSystemHeadersMapping (CanonicalIncludes *Includes)
| Adds mapping for system headers and some special symbols (e.g. More...
static std::pair< SymbolSlab, RefSlab > | indexSymbols (ASTContext &AST, std::shared_ptr< Preprocessor > PP, llvm::ArrayRef< Decl *> DeclsToIndex, bool IsIndexMainAST)
std::pair< SymbolSlab, RefSlab > | indexMainDecls (ParsedAST &AST)
| Retrieves symbols and refs of local top level decls in `AST` (i.e. More...
SymbolSlab | indexHeaderSymbols (ASTContext &AST, std::shared_ptr< Preprocessor > PP)
| Idex declarations from `AST` and macros from `PP` that are declared in included headers. More...
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const SymbolLocation &L)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, SymbolOrigin O)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, Symbol::SymbolFlag F)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Symbol &S)
float | quality (const Symbol &S)
static void | own (Symbol &S, llvm::UniqueStringSaver &Strings)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, RefKind K)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Ref &R)
bool | fromJSON (const llvm::json::Value &Parameters, FuzzyFindRequest &Request)
llvm::json::Value | toJSON (const FuzzyFindRequest &Request)
bool | operator== (const SymbolLocation::Position &L, const SymbolLocation::Position &R)
bool | operator< (const SymbolLocation::Position &L, const SymbolLocation::Position &R)
bool | operator== (const SymbolLocation &L, const SymbolLocation &R)
bool | operator< (const SymbolLocation &L, const SymbolLocation &R)
SymbolOrigin | operator| (SymbolOrigin A, SymbolOrigin B)
SymbolOrigin & | operator|= (SymbolOrigin &A, SymbolOrigin B)
SymbolOrigin | operator & (SymbolOrigin A, SymbolOrigin B)
raw_ostream & | operator<< (raw_ostream &, SymbolOrigin)
Symbol::SymbolFlag | operator| (Symbol::SymbolFlag A, Symbol::SymbolFlag B)
Symbol::SymbolFlag & | operator|= (Symbol::SymbolFlag &A, Symbol::SymbolFlag B)
raw_ostream & | operator<< (raw_ostream &, Symbol::SymbolFlag)
template<typename Callback >
void | visitStrings (Symbol &S, const Callback &CB)
RefKind | operator| (RefKind L, RefKind R)
RefKind & | operator|= (RefKind &L, RefKind R)
RefKind | operator & (RefKind A, RefKind B)
bool | operator< (const Ref &L, const Ref &R)
bool | operator== (const Ref &L, const Ref &R)
std::unique_ptr< FrontendAction > | createStaticIndexingAction (SymbolCollector::Options Opts, std::function< void(SymbolSlab)> SymbolsCallback, std::function< void(RefSlab)> RefsCallback, std::function< void(IncludeGraph)> IncludeGraphCallback)
Symbol | mergeSymbol (const Symbol &L, const Symbol &R)
void | writeYAML (const IndexFileOut &, llvm::raw_ostream &)
llvm::Expected< IndexFileIn > | readYAML (llvm::StringRef)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const IndexFileOut &O)
llvm::Expected< IndexFileIn > | readIndexFile (llvm::StringRef Data)
std::unique_ptr< SymbolIndex > | loadIndex (llvm::StringRef SymbolFilename, bool UseDex)
std::string | toYAML (const Symbol &)
std::string | toYAML (const std::pair< SymbolID, ArrayRef< Ref >> &)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const SymbolID &ID)
llvm::hash_code | hash_value (const SymbolID &ID)
std::string | toYAML (const std::pair< SymbolID, llvm::ArrayRef< Ref >> &Data)
std::unique_ptr< Transport > | newJSONTransport (std::FILE *In, llvm::raw_ostream &Out, llvm::raw_ostream *InMirror, bool Pretty, JSONStreamStyle Style)
template<typename... Ts>
void | elog (const char *Fmt, Ts &&... Vals)
template<typename... Ts>
void | log (const char *Fmt, Ts &&... Vals)
template<typename... Ts>
void | vlog (const char *Fmt, Ts &&... Vals)
bool | fromJSON (const llvm::json::Value &E, URIForFile &R)
llvm::json::Value | toJSON (const URIForFile &U)
| Serialize/deserialize `URIForFile` to/from a string URI. More...
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const URIForFile &U)
llvm::json::Value | toJSON (const TextDocumentIdentifier &R)
bool | fromJSON (const llvm::json::Value &Params, TextDocumentIdentifier &R)
bool | fromJSON (const llvm::json::Value &Params, Position &R)
llvm::json::Value | toJSON (const Position &P)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Position &P)
bool | fromJSON (const llvm::json::Value &Params, Range &R)
llvm::json::Value | toJSON (const Range &P)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Range &R)
llvm::json::Value | toJSON (const Location &P)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Location &L)
bool | fromJSON (const llvm::json::Value &Params, TextDocumentItem &R)
bool | fromJSON (const llvm::json::Value &Params, TextEdit &R)
llvm::json::Value | toJSON (const TextEdit &P)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const TextEdit &TE)
bool | fromJSON (const llvm::json::Value &E, TraceLevel &Out)
bool | fromJSON (const llvm::json::Value &E, SymbolKind &Out)
bool | fromJSON (const llvm::json::Value &E, SymbolKindBitset &Out)
SymbolKind | adjustKindToCapability (SymbolKind Kind, SymbolKindBitset &SupportedSymbolKinds)
bool | fromJSON (const llvm::json::Value &Params, ClientCapabilities &R)
bool | fromJSON (const llvm::json::Value &Params, InitializeParams &R)
bool | fromJSON (const llvm::json::Value &Params, DidOpenTextDocumentParams &R)
bool | fromJSON (const llvm::json::Value &Params, DidCloseTextDocumentParams &R)
bool | fromJSON (const llvm::json::Value &Params, DidChangeTextDocumentParams &R)
bool | fromJSON (const llvm::json::Value &E, FileChangeType &Out)
bool | fromJSON (const llvm::json::Value &Params, FileEvent &R)
bool | fromJSON (const llvm::json::Value &Params, DidChangeWatchedFilesParams &R)
bool | fromJSON (const llvm::json::Value &Params, TextDocumentContentChangeEvent &R)
bool | fromJSON (const llvm::json::Value &Params, FormattingOptions &R)
llvm::json::Value | toJSON (const FormattingOptions &P)
bool | fromJSON (const llvm::json::Value &Params, DocumentRangeFormattingParams &R)
bool | fromJSON (const llvm::json::Value &Params, DocumentOnTypeFormattingParams &R)
bool | fromJSON (const llvm::json::Value &Params, DocumentFormattingParams &R)
bool | fromJSON (const llvm::json::Value &Params, DocumentSymbolParams &R)
llvm::json::Value | toJSON (const Diagnostic &D)
bool | fromJSON (const llvm::json::Value &Params, Diagnostic &R)
bool | fromJSON (const llvm::json::Value &Params, CodeActionContext &R)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Diagnostic &D)
bool | fromJSON (const llvm::json::Value &Params, CodeActionParams &R)
bool | fromJSON (const llvm::json::Value &Params, WorkspaceEdit &R)
bool | fromJSON (const llvm::json::Value &Params, ExecuteCommandParams &R)
llvm::json::Value | toJSON (const SymbolInformation &P)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &O, const SymbolInformation &SI)
bool | operator== (const SymbolDetails &LHS, const SymbolDetails &RHS)
llvm::json::Value | toJSON (const SymbolDetails &P)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &O, const SymbolDetails &S)
bool | fromJSON (const llvm::json::Value &Params, WorkspaceSymbolParams &R)
llvm::json::Value | toJSON (const Command &C)
llvm::json::Value | toJSON (const CodeAction &CA)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &O, const DocumentSymbol &S)
llvm::json::Value | toJSON (const DocumentSymbol &S)
llvm::json::Value | toJSON (const WorkspaceEdit &WE)
llvm::json::Value | toJSON (const ApplyWorkspaceEditParams &Params)
bool | fromJSON (const llvm::json::Value &Params, TextDocumentPositionParams &R)
bool | fromJSON (const llvm::json::Value &Params, CompletionContext &R)
bool | fromJSON (const llvm::json::Value &Params, CompletionParams &R)
static llvm::StringRef | toTextKind (MarkupKind Kind)
llvm::json::Value | toJSON (const MarkupContent &MC)
llvm::json::Value | toJSON (const Hover &H)
bool | fromJSON (const llvm::json::Value &E, CompletionItemKind &Out)
CompletionItemKind | adjustKindToCapability (CompletionItemKind Kind, CompletionItemKindBitset &supportedCompletionItemKinds)
bool | fromJSON (const llvm::json::Value &E, CompletionItemKindBitset &Out)
llvm::json::Value | toJSON (const CompletionItem &CI)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &O, const CompletionItem &I)
bool | operator< (const CompletionItem &L, const CompletionItem &R)
llvm::json::Value | toJSON (const CompletionList &L)
llvm::json::Value | toJSON (const ParameterInformation &PI)
llvm::json::Value | toJSON (const SignatureInformation &SI)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &O, const SignatureInformation &I)
llvm::json::Value | toJSON (const SignatureHelp &SH)
bool | fromJSON (const llvm::json::Value &Params, RenameParams &R)
llvm::json::Value | toJSON (const DocumentHighlight &DH)
llvm::json::Value | toJSON (const FileStatus &FStatus)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &O, const DocumentHighlight &V)
bool | fromJSON (const llvm::json::Value &Params, DidChangeConfigurationParams &CCP)
bool | fromJSON (const llvm::json::Value &Params, ClangdCompileCommand &CDbUpdate)
bool | fromJSON (const llvm::json::Value &Params, ConfigurationSettings &S)
bool | fromJSON (const llvm::json::Value &Params, InitializationOptions &Opts)
bool | fromJSON (const llvm::json::Value &Params, ReferenceParams &R)
bool | fromJSON (const llvm::json::Value &, NoParams &)
static bool | isReserved (llvm::StringRef Name)
static bool | hasDeclInMainFile (const Decl &D)
static bool | hasUsingDeclInMainFile (const CodeCompletionResult &R)
static SymbolQualitySignals::SymbolCategory | categorize (const NamedDecl &ND)
static SymbolQualitySignals::SymbolCategory | categorize (const CodeCompletionResult &R)
static SymbolQualitySignals::SymbolCategory | categorize (const index::SymbolInfo &D)
static bool | isInstanceMember (const NamedDecl *ND)
static bool | isInstanceMember (const index::SymbolInfo &D)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const SymbolQualitySignals &S)
static SymbolRelevanceSignals::AccessibleScope | computeScope (const NamedDecl *D)
static std::pair< float, unsigned > | uriProximity (llvm::StringRef SymbolURI, URIDistance *D)
static float | scopeBoost (ScopeDistance &Distance, llvm::Optional< llvm::StringRef > SymbolScope)
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const SymbolRelevanceSignals &S)
float | evaluateSymbolAndRelevance (float SymbolQuality, float SymbolRelevance)
| Combine symbol quality and relevance into a single score. More...
static uint32_t | encodeFloat (float F)
std::string | sortText (float Score, llvm::StringRef Tiebreak="")
| Returns a string that sorts in the same order as (-Score, Tiebreak), for LSP. More...
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const SignatureQualitySignals &S)
template<typename Callback >
static bool | iterateCodepoints (llvm::StringRef U8, const Callback &CB)
static size_t | measureUTF16 (llvm::StringRef U8, int U16Units, bool &Valid)
size_t | lspLength (llvm::StringRef Code)
llvm::Expected< size_t > | positionToOffset (llvm::StringRef Code, Position P, bool AllowColumnsBeyondLineLength=true)
| Turn a [line, column] pair into an offset in Code. More...
Position | offsetToPosition (llvm::StringRef Code, size_t Offset)
| Turn an offset in Code into a [line, column] pair. More...
Position | sourceLocToPosition (const SourceManager &SM, SourceLocation Loc)
| Turn a SourceLocation into a [line, column] pair. More...
Range | halfOpenToRange (const SourceManager &SM, CharSourceRange R)
std::pair< size_t, size_t > | offsetToClangLineColumn (llvm::StringRef Code, size_t Offset)
std::pair< llvm::StringRef, llvm::StringRef > | splitQualifiedName (llvm::StringRef QName)
| From "a::b::c", return {"a::b::", "c"}. More...
TextEdit | replacementToEdit (llvm::StringRef Code, const tooling::Replacement &R)
std::vector< TextEdit > | replacementsToEdits (llvm::StringRef Code, const tooling::Replacements &Repls)
llvm::Optional< std::string > | getCanonicalPath (const FileEntry *F, const SourceManager &SourceMgr)
| Get the canonical path of `F`. More...
TextEdit | toTextEdit (const FixItHint &FixIt, const SourceManager &M, const LangOptions &L)
bool | IsRangeConsecutive (const Range &Left, const Range &Right)
FileDigest | digest (llvm::StringRef Content)
llvm::Optional< FileDigest > | digestFile (const SourceManager &SM, FileID FID)
FileDigest | digest (StringRef Content)
size_t | lspLength (StringRef Code)
TextEdit | replacementToEdit (StringRef Code, const tooling::Replacement &R)
std::vector< TextEdit > | replacementsToEdits (StringRef Code, const tooling::Replacements &Repls)
Deadline | timeoutSeconds (llvm::Optional< double > Seconds)
| Makes a deadline from a timeout in seconds. None means wait forever. More...
void | wait (std::unique_lock< std::mutex > &Lock, std::condition_variable &CV, Deadline D)
| Wait once on CV for the specified duration. More...
void | setCurrentThreadPriority (ThreadPriority Priority)
void | preventThreadStarvationInTests ()
template<typename Func >
LLVM_NODISCARD bool | wait (std::unique_lock< std::mutex > &Lock, std::condition_variable &CV, Deadline D, Func F)
| Waits on a condition variable until F() is true or D expires. More...
static llvm::cl::opt< bool > | UseDex ("use-dex-index", llvm::cl::desc("Use experimental Dex dynamic index."), llvm::cl::init(false), llvm::cl::Hidden)
static llvm::cl::opt< Path > | CompileCommandsDir ("compile-commands-dir", llvm::cl::desc("Specify a path to look for compile_commands.json. If path " "is invalid, clangd will look in the current directory and " "parent paths of each source file."))
static llvm::cl::opt< unsigned > | WorkerThreadsCount ("j", llvm::cl::desc("Number of async workers used by clangd"), llvm::cl::init(getDefaultAsyncThreadsCount()))
static llvm::cl::opt< CompletionStyleFlag > | CompletionStyle ("completion-style", llvm::cl::desc("Granularity of code completion suggestions"), llvm::cl::values(clEnumValN(Detailed, "detailed", "One completion item for each semantically distinct " "completion, with full type information."), clEnumValN(Bundled, "bundled", "Similar completion items (e.g. function overloads) are " "combined. Type information shown where possible.")), llvm::cl::init(Detailed))
static llvm::cl::opt< bool > | IncludeIneligibleResults ("include-ineligible-results", llvm::cl::desc("Include ineligible completion results (e.g. private members)"), llvm::cl::init(CodeCompleteOptions().IncludeIneligibleResults), llvm::cl::Hidden)
static llvm::cl::opt< JSONStreamStyle > | InputStyle ("input-style", llvm::cl::desc("Input JSON stream encoding"), llvm::cl::values(clEnumValN(JSONStreamStyle::Standard, "standard", "usual LSP protocol"), clEnumValN(JSONStreamStyle::Delimited, "delimited", "messages delimited by --- lines, with # comment support")), llvm::cl::init(JSONStreamStyle::Standard))
static llvm::cl::opt< bool > | PrettyPrint ("pretty", llvm::cl::desc("Pretty-print JSON output"), llvm::cl::init(false))
static llvm::cl::opt< Logger::Level > | LogLevel ("log", llvm::cl::desc("Verbosity of log messages written to stderr"), llvm::cl::values(clEnumValN(Logger::Error, "error", "Error messages only"), clEnumValN(Logger::Info, "info", "High level execution tracing"), clEnumValN(Logger::Debug, "verbose", "Low level details")), llvm::cl::init(Logger::Info))
static llvm::cl::opt< bool > | Test ("lit-test", llvm::cl::desc("Abbreviation for -input-style=delimited -pretty " "-run-synchronously -enable-test-scheme. " "Intended to simplify lit tests."), llvm::cl::init(false), llvm::cl::Hidden)
static llvm::cl::opt< bool > | EnableTestScheme ("enable-test-uri-scheme", llvm::cl::desc("Enable 'test:' URI scheme. Only use in lit tests."), llvm::cl::init(false), llvm::cl::Hidden)
static llvm::cl::opt< PCHStorageFlag > | PCHStorage ("pch-storage", llvm::cl::desc("Storing PCHs in memory increases memory usages, but may " "improve performance"), llvm::cl::values(clEnumValN(PCHStorageFlag::Disk, "disk", "store PCHs on disk"), clEnumValN(PCHStorageFlag::Memory, "memory", "store PCHs in memory")), llvm::cl::init(PCHStorageFlag::Disk))
static llvm::cl::opt< int > | LimitResults ("limit-results", llvm::cl::desc("Limit the number of results returned by clangd. " "0 means no limit."), llvm::cl::init(100))
static llvm::cl::opt< bool > | RunSynchronously ("run-synchronously", llvm::cl::desc("Parse on main thread. If set, -j is ignored"), llvm::cl::init(false), llvm::cl::Hidden)
static llvm::cl::opt< Path > | ResourceDir ("resource-dir", llvm::cl::desc("Directory for system clang headers"), llvm::cl::init(""), llvm::cl::Hidden)
static llvm::cl::opt< Path > | InputMirrorFile ("input-mirror-file", llvm::cl::desc("Mirror all LSP input to the specified file. Useful for debugging."), llvm::cl::init(""), llvm::cl::Hidden)
static llvm::cl::opt< bool > | EnableIndex ("index", llvm::cl::desc("Enable index-based features. By default, clangd maintains an index " "built from symbols in opened files. Global index support needs to " "enabled separatedly."), llvm::cl::init(true), llvm::cl::Hidden)
static llvm::cl::opt< bool > | AllScopesCompletion ("all-scopes-completion", llvm::cl::desc("If set to true, code completion will include index symbols that are " "not defined in the scopes (e.g. " "namespaces) visible from the code completion point. Such completions " "can insert scope qualifiers."), llvm::cl::init(true))
static llvm::cl::opt< bool > | ShowOrigins ("debug-origin", llvm::cl::desc("Show origins of completion items"), llvm::cl::init(CodeCompleteOptions().ShowOrigins), llvm::cl::Hidden)
static llvm::cl::opt< bool > | HeaderInsertionDecorators ("header-insertion-decorators", llvm::cl::desc("Prepend a circular dot or space before the completion " "label, depending on whether " "an include line will be inserted or not."), llvm::cl::init(true))
static llvm::cl::opt< Path > | IndexFile ("index-file", llvm::cl::desc("Index file to build the static index. The file must have been created " "by a compatible clangd-index.\ "WARNING:This option is experimental only, and will be removed " "eventually. Don 't rely on it."), llvm::cl::init(""), llvm::cl::Hidden)
static llvm::cl::opt< bool > | EnableBackgroundIndex ("background-index", llvm::cl::desc("Index project code in the background and persist index on disk. " "Experimental"), llvm::cl::init(false), llvm::cl::Hidden)
static llvm::cl::opt< int > | BackgroundIndexRebuildPeriod ("background-index-rebuild-period", llvm::cl::desc("If set to non-zero, the background index rebuilds the symbol index " "periodically every X milliseconds; otherwise, the " "symbol index will be updated for each indexed file."), llvm::cl::init(5000), llvm::cl::Hidden)
static llvm::cl::opt< CompileArgsFrom > | CompileArgsFrom ("compile_args_from", llvm::cl::desc("The source of compile commands"), llvm::cl::values(clEnumValN(LSPCompileArgs, "lsp", "All compile commands come from LSP and " "'compile_commands.json' files are ignored"), clEnumValN(FilesystemCompileArgs, "filesystem", "All compile commands come from the " "'compile_commands.json' files")), llvm::cl::init(FilesystemCompileArgs), llvm::cl::Hidden)
static llvm::cl::opt< bool > | EnableFunctionArgSnippets ("function-arg-placeholders", llvm::cl::desc("When disabled, completions contain only parentheses for " "function calls. When enabled, completions also contain " "placeholders for method parameters."), llvm::cl::init(CodeCompleteOptions().EnableFunctionArgSnippets))
unsigned | getDefaultAsyncThreadsCount ()
| Returns a number of a default async threads to use for TUScheduler. More...
template<typename T >
std::future< T > | runAsync (llvm::unique_function< T()> Action)
| Runs `Action` asynchronously with a new std::thread. More...
xpc_object_t | jsonToXpc (const json::Value &JSON)
json::Value | xpcToJson (const xpc_object_t &XPCObject)
xpc_object_t | jsonToXpc (const llvm::json::Value &JSON)
std::unique_ptr< Transport > | newXPCTransport ()
std::vector< Location > | findDefinitions (ParsedAST &AST, Position Pos, const SymbolIndex *Index=nullptr)
| Get definition of symbol at a specified `Pos`. More...
std::vector< DocumentHighlight > | findDocumentHighlights (ParsedAST &AST, Position Pos)
| Returns highlights for all usages of a symbol at `Pos`. More...
static PrintingPolicy | printingPolicyForDecls (PrintingPolicy Base)
static std::string | typeDeclToString (const TypeDecl *TD)
| Return a string representation (e.g. More...
static std::string | namedDeclQualifiedName (const NamedDecl *ND, llvm::StringRef Prefix)
| Return a string representation (e.g. More...
static llvm::Optional< std::string > | getScopeName (const Decl *D)
| Given a declaration `D`, return a human-readable string representing the scope in which it is declared. More...
static Hover | getHoverContents (const Decl *D)
| Generate a `Hover` object given the declaration `D`. More...
static Hover | getHoverContents (QualType T, ASTContext &ASTCtx)
| Generate a `Hover` object given the type `T`. More...
static Hover | getHoverContents (llvm::StringRef MacroName)
| Generate a `Hover` object given the macro `MacroInf`. More...
llvm::Optional< QualType > | getDeducedType (ParsedAST &AST, SourceLocation SourceLocationBeg)
| Retrieves the deduced type at a given location (auto, decltype). More...
llvm::Optional< Hover > | getHover (ParsedAST &AST, Position Pos)
| Get the hover information when hovering at `Pos`. More...
std::vector< Location > | findReferences (ParsedAST &AST, Position Pos, uint32_t Limit, const SymbolIndex *Index=nullptr)
| Returns reference locations of the symbol at a specified `Pos`. More...
std::vector< SymbolDetails > | getSymbolInfo (ParsedAST &AST, Position Pos)
| Get info about symbols at `Pos`. More...

## Variables
static Key< std::shared_ptr< std::atomic< bool > > > | FlagKey
static constexpr int | AwfulScore = -(1 << 13)
static constexpr int | PerfectBonus = 3
static constexpr uint8_t | CharTypes []
static constexpr uint8_t | CharRoles []
constexpr auto | CompletionItemKindMin
constexpr auto | CompletionItemKindMax
constexpr auto | SymbolKindMin = static_cast<size_t>(SymbolKind::File)
constexpr auto | SymbolKindMax = static_cast<size_t>(SymbolKind::TypeParameter)
static std::atomic< bool > | AvoidThreadStarvation = {false}
static clang::clangd::Key< std::string > | kFileBeingProcessed

## Typedef Documentation

## ◆ Callback

template<typename T >

using clang::clangd::Callback = typedef llvm::unique_function<void(llvm::Expected<T>)>

A Callback<T> is a void function that accepts Expected<T>.

This is accepted by ClangdServer functions that logically return T.

Definition at line 29 of file Function.h.

## ◆ Canceler

using clang::clangd::Canceler = typedef std::function<void()>

A canceller requests cancellation of a task, when called.

Calling it again has no effect.

Definition at line 71 of file Cancellation.h.

## ◆ CharTypeSet

using clang::clangd::CharTypeSet = typedef unsigned char

Definition at line 50 of file FuzzyMatch.h.

## ◆ CompletionItemKindBitset

using clang::clangd::CompletionItemKindBitset = typedef std::bitset<CompletionItemKindMax + 1>

Definition at line 292 of file Protocol.h.

## ◆ ExitParams

using clang::clangd::ExitParams = typedef NoParams

Definition at line 242 of file Protocol.h.

## ◆ FileDigest

using clang::clangd::FileDigest = typedef decltype(llvm::SHA1::hash({}))

Definition at line 31 of file SourceCode.h.

## ◆ IncludeGraph

using clang::clangd::IncludeGraph = typedef llvm::StringMap<IncludeGraphNode>

Definition at line 65 of file Headers.h.

## ◆ Path

using clang::clangd::Path = typedef std::string

A typedef to represent a file path.

Used solely for more descriptive signatures.

Definition at line 21 of file Path.h.

## ◆ PathRef

using clang::clangd::PathRef = typedef llvm::StringRef

A typedef to represent a ref to file path.

Used solely for more descriptive signatures.

Definition at line 24 of file Path.h.

## ◆ PreambleParsedCallback

using clang::clangd::PreambleParsedCallback = typedef std::function<void(ASTContext &, std::shared_ptr<clang::Preprocessor>)>

Definition at line 136 of file ClangdUnit.h.

## ◆ ShutdownParams

using clang::clangd::ShutdownParams = typedef NoParams

Definition at line 241 of file Protocol.h.

## ◆ SymbolKindBitset

using clang::clangd::SymbolKindBitset = typedef std::bitset<SymbolKindMax + 1>

Definition at line 330 of file Protocol.h.

## ◆ URISchemeRegistry

typedef llvm::Registry<URIScheme> clang::clangd::URISchemeRegistry

By default, a "file" scheme is supported where URI paths are always absolute in the file system.

Definition at line 128 of file URI.h.

## Enumeration Type Documentation

## ◆ CharRole

enum clang::clangd::CharRole : unsigned char

Enumerator
Unknown |
Tail |
Head |
Separator |

Definition at line 56 of file FuzzyMatch.h.

## ◆ CharType

enum clang::clangd::CharType : unsigned char

Enumerator
Empty |
Lower |
Upper |
Punctuation |

Definition at line 42 of file FuzzyMatch.h.

## ◆ CompileArgsFrom

enum clang::clangd::CompileArgsFrom

Enumerator
LSPCompileArgs |
FilesystemCompileArgs |

Definition at line 187 of file ClangdMain.cpp.

## ◆ CompletionItemKind

enum clang::clangd::CompletionItemKind
| strong

The kind of a completion entry.

Enumerator
Missing |
Text |
Method |
Function |
Constructor |
Field |
Variable |
Class |
Interface |
Module |
Property |
Unit |
Value |
Enum |
Keyword |
Snippet |
Color |
File |
Reference |
Folder |
EnumMember |
Constant |
Struct |
Event |
Operator |
TypeParameter |

Definition at line 259 of file Protocol.h.

## ◆ CompletionStyleFlag

enum clang::clangd::CompletionStyleFlag

Enumerator
Detailed |
Bundled |

Definition at line 49 of file ClangdMain.cpp.

## ◆ CompletionTriggerKind

enum clang::clangd::CompletionTriggerKind
| strong

Enumerator
Invoked | Completion was triggered by typing an identifier (24x7 code complete), manual invocation (e.g Ctrl+Space) or via API.
TriggerCharacter | Completion was triggered by a trigger character specified by the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
TriggerTriggerForIncompleteCompletions | Completion was re-triggered as the current completion list is incomplete.

Definition at line 778 of file Protocol.h.

## ◆ DocumentHighlightKind

enum clang::clangd::DocumentHighlightKind
| strong

Enumerator
Text |
Read |
Write |

Definition at line 971 of file Protocol.h.

## ◆ DuplicateHandling

enum clang::clangd::DuplicateHandling
| strong

How to handle duplicated symbols across multiple files.

Enumerator
PickOne |
Merge |

Definition at line 38 of file FileIndex.h.

## ◆ ErrorCode

enum clang::clangd::ErrorCode
| strong

Enumerator
ParseError |
InvalidRequest |
MethodNotFound |
InvalidParams |
InternalError |
ServerNotInitialized |
UnknownErrorCode |
RequestCancelled |

Definition at line 38 of file Protocol.h.

## ◆ FileChangeType

enum clang::clangd::FileChangeType
| strong

Enumerator
Created | The file got created.
Changed | The file got changed.
Deleted | The file got deleted.

Definition at line 479 of file Protocol.h.

## ◆ IndexFileFormat

enum clang::clangd::IndexFileFormat
| strong

Enumerator
RIFF |
YAML |

Definition at line 34 of file Serialization.h.

## ◆ IndexType

enum clang::clangd::IndexType
| strong

Select between in-memory index implementations, which have tradeoffs.

Enumerator
Light |
Heavy |

Definition at line 30 of file FileIndex.h.

## ◆ InsertTextFormat

enum clang::clangd::InsertTextFormat
| strong

Defines whether the insert text in a completion item should be interpreted as plain text or a snippet.

Enumerator
Missing |
PlainText | The primary text to be inserted is treated as a plain string.
Snippet | The primary text to be inserted is treated as a snippet. A snippet can define tab stops and placeholders with `$1`, `$2` and `${3:foo}`. `$0` defines the final tab stop, it defaults to the end of the snippet. Placeholders with equal identifiers are linked, that is typing in one will update others too. See also: https//github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md

Definition at line 826 of file Protocol.h.

## ◆ JSONStreamStyle

enum clang::clangd::JSONStreamStyle

Enumerator
Standard |
Delimited |

Definition at line 66 of file Transport.h.

## ◆ MarkupKind

enum clang::clangd::MarkupKind
| strong

Enumerator
PlainText |
Markdown |

Definition at line 803 of file Protocol.h.

## ◆ PCHStorageFlag

enum clang::clangd::PCHStorageFlag

Enumerator
Disk |
Memory |

Definition at line 103 of file ClangdMain.cpp.

## ◆ RefKind

enum clang::clangd::RefKind : uint8_t
| strong

Enumerator
Unknown |
Declaration |
Definition |
Reference |
All |

Definition at line 351 of file Index.h.

## ◆ SymbolKind

enum clang::clangd::SymbolKind
| strong

A symbol kind.

Enumerator
File |
Module |
Namespace |
Package |
Class |
Method |
Property |
Field |
Constructor |
Enum |
Interface |
Function |
Variable |
Constant |
String |
Number |
Boolean |
Array |
Object |
Key |
Null |
EnumMember |
Struct |
Event |
Operator |
TypeParameter |

Definition at line 299 of file Protocol.h.

## ◆ SymbolOrigin

enum clang::clangd::SymbolOrigin : uint8_t
| strong

Enumerator
Unknown |
AST |
Dynamic |
Static |
Merge |

Definition at line 126 of file Index.h.

## ◆ TextDocumentSyncKind

enum clang::clangd::TextDocumentSyncKind
| strong

Defines how the host (editor) should sync document changes to the language server.

Enumerator
None | Documents should not be synced at all.
Full | Documents are synced by always sending the full content of the document.
Incremental | Documents are synced by sending the full content on open. After that only incremental updates to the document are send.

Definition at line 246 of file Protocol.h.

## ◆ ThreadPriority

enum clang::clangd::ThreadPriority
| strong

Enumerator
Low |
Normal |

Definition at line 121 of file Threading.h.

## ◆ TraceLevel

enum clang::clangd::TraceLevel
| strong

Enumerator
Off |
Messages |
Verbose |

Definition at line 232 of file Protocol.h.

## ◆ WantDiagnostics

enum clang::clangd::WantDiagnostics
| strong

Determines whether diagnostics should be generated for a file snapshot.

Enumerator
Yes |
No | Diagnostics must be generated for this snapshot.
Auto | Diagnostics must not be generated for this snapshot.

Definition at line 39 of file TUScheduler.h.

## Function Documentation

## ◆ addSystemHeadersMapping()

void clang::clangd::addSystemHeadersMapping | ( | CanonicalIncludes * | Includes | ) |

Adds mapping for system headers and some special symbols (e.g.

STL symbols in <iosfwd> need to be mapped individually). Approximately, the following system headers are handled:

- C++ standard library e.g. bits/basic_string.h$ -> <string>
- Posix library e.g. bits/pthreadtypes.h$ -> <pthread.h>
- Compiler extensions, e.g. include/avx512bwintrin.h$ -> <immintrin.h> The mapping is hardcoded and hand-maintained, so it might not cover all headers.

Definition at line 109 of file CanonicalIncludes.cpp.

## ◆ adjustKindToCapability() [1/2]

SymbolKind clang::clangd::adjustKindToCapability | ( | SymbolKind | Kind,
|  | SymbolKindBitset & | SupportedSymbolKinds
| ) |  |

Definition at line 198 of file Protocol.cpp.

References Class, Enum, EnumMember, Kind, String, Struct, and SymbolKindMin.

Referenced by asCommand().

## ◆ adjustKindToCapability() [2/2]

CompletionItemKind clang::clangd::adjustKindToCapability | ( | CompletionItemKind | Kind,
|  | CompletionItemKindBitset & | supportedCompletionItemKinds
| ) |  |

Definition at line 622 of file Protocol.cpp.

References Class, CompletionItemKindMin, Enum, EnumMember, File, Folder, Kind, Struct, and Text.

## ◆ AllScopesCompletion()

static llvm::cl::opt<bool> clang::clangd::AllScopesCompletion | ( | "all-scopes-completion" | ,
|  | llvm::cl::desc("If set to true, code completion will include index symbols that are " "not defined in the scopes (e.g. " "namespaces) visible from the code completion point. Such completions " "can insert scope qualifiers.") | ,
|  | llvm::cl::init(true) |
| ) |  |
| static

## ◆ asCommand()

static llvm::Optional<Command> clang::clangd::asCommand | ( | const CodeAction & | Action | ) |
| static

Definition at line 585 of file ClangdLSPServer.cpp.

References Action, adjustKindToCapability(), Bind(), clang::clangd::CodeAction::command, Command, Commands(), clang::clangd::ConfigurationSettings::compilationDatabaseChanges, clang::clangd::CodeActionParams::context, clang::clangd::URI::createFile(), D, clang::clangd::CodeActionContext::diagnostics, clang::clangd::CodeAction::edit, clang::clangd::URIForFile::file(), File, InvalidParams, clang::clangd::CompletionList::isIncomplete, clang::clangd::CompletionList::items, clang::clangd::CodeAction::kind, clang::clangd::CompletionItem::kind, None, clang::clangd::TextDocumentPositionParams::position, clang::clangd::CodeAction::QUICKFIX_KIND, Result, clang::clangd::DidChangeConfigurationParams::settings, clang::clangd::CodeActionParams::textDocument, clang::clangd::TextDocumentPositionParams::textDocument, clang::clangd::CodeAction::title, toCodeAction(), clang::clangd::URI::toString(), and clang::clangd::TextDocumentIdentifier::uri.

## ◆ BackgroundIndexRebuildPeriod()

static llvm::cl::opt<int> clang::clangd::BackgroundIndexRebuildPeriod | ( | "background-index-rebuild-period" | ,
|  | llvm::cl::desc("If set to non-zero, the background index rebuilds the symbol index " "periodically every X milliseconds; otherwise, the " "symbol index will be updated for each indexed file.") | ,
|  | llvm::cl::init(5000) | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

## ◆ Bind()

template<class Func , class... Args>

ForwardBinder<Func, Args...> clang::clangd::Bind | ( | Func | F,
|  | Args &&... | As
| ) |  |

Creates an object that stores a callable (`F`) and first arguments to the callable (`As`) and allows to call `F` with at a later point.

Similar to std::bind, but also works with move-only `F` and `As`.

The returned object must be called no more than once, as `As` are std::forwarded'ed (therefore can be moved) into `F` during the call.

Definition at line 82 of file Function.h.

Referenced by asCommand(), clang::clangd::ClangdServer::documentSymbols(), clang::clangd::ClangdServer::dumpAST(), clang::clangd::ClangdServer::findDefinitions(), clang::clangd::ClangdServer::findDocumentHighlights(), clang::clangd::ClangdServer::findHover(), clang::clangd::ClangdServer::signatureHelp(), and clang::clangd::ClangdServer::symbolInfo().

## ◆ buildAST()

llvm::Optional< ParsedAST > clang::clangd::buildAST | ( | PathRef | FileName,
|  | std::unique_ptr< CompilerInvocation > | Invocation,
|  | const ParseInputs & | Inputs,
|  | std::shared_ptr< const PreambleData > | Preamble,
|  | std::shared_ptr< PCHContainerOperations > | PCHs
| ) |  |

Build an AST from provided user inputs.

This function does not check if preamble can be reused, as this function expects that `Preamble` is the result of calling buildPreamble.

Definition at line 523 of file ClangdUnit.cpp.

## ◆ buildCompilerInvocation()

std::unique_ptr< CompilerInvocation > clang::clangd::buildCompilerInvocation | ( | const ParseInputs & | Inputs | ) |

Builds compiler invocation that could be used to build AST or preamble.

Definition at line 426 of file ClangdUnit.cpp.

References clang::clangd::ParseInputs::CompileCommand, clang::clangd::ParseInputs::FS, and log().

## ◆ buildPreamble()

std::shared_ptr< const PreambleData > clang::clangd::buildPreamble | ( | PathRef | FileName,
|  | CompilerInvocation & | CI,
|  | std::shared_ptr< const PreambleData > | OldPreamble,
|  | const tooling::CompileCommand & | OldCompileCommand,
|  | const ParseInputs & | Inputs,
|  | std::shared_ptr< PCHContainerOperations > | PCHs,
|  | bool | StoreInMemory,
|  | PreambleParsedCallback | PreambleCallback
| ) |  |

Rebuild the preamble for the new inputs unless the old one can be reused.

If `OldPreamble` can be reused, it is returned unchanged. If `OldPreamble` is null, always builds the preamble. If `PreambleCallback` is set, it will be run on top of the AST while building the preamble. Note that if the old preamble was reused, no AST is built and, therefore, the callback will not be executed.

Definition at line 454 of file ClangdUnit.cpp.

References clang::clangd::ParseInputs::CompileCommand, clang::clangd::ParseInputs::Contents, clang::clangd::ParseInputs::FS, and vlog().

## ◆ calculateRoles()

CharTypeSet clang::clangd::calculateRoles | ( | llvm::StringRef | Text,
|  | llvm::MutableArrayRef< CharRole > | Roles
| ) |  |

Definition at line 155 of file FuzzyMatch.cpp.

References AwfulScore, CharRoles, CharTypes, Empty, Head, Lower, lower(), Tail, and Upper.

Referenced by clang::clangd::FuzzyMatcher::FuzzyMatcher(), and clang::clangd::dex::generateIdentifierTrigrams().

## ◆ cancelableTask()

std::pair< Context, Canceler > clang::clangd::cancelableTask | ( |  | ) |

Defines a new task whose cancellation may be requested.

The returned Context defines the scope of the task. When the context is active, isCancelled() is false until the Canceler is invoked, and true afterwards.

Definition at line 19 of file Cancellation.cpp.

References clang::clangd::Context::current(), and clang::clangd::Context::derive().

## ◆ canonicalize()

static llvm::SmallString<128> clang::clangd::canonicalize | ( | llvm::StringRef | Path | ) |
| static

Definition at line 47 of file FileDistance.cpp.

References hash_value(), Result, clang::clangd::FileDistance::RootHash, and clang::clangd::FileDistance::Unreachable.

Referenced by clang::clangd::FileDistance::distance().

## ◆ categorize() [1/3]

static SymbolQualitySignals::SymbolCategory clang::clangd::categorize | ( | const NamedDecl & | ND | ) |
| static

Definition at line 63 of file Quality.cpp.

References Constructor, Function, MAP, Namespace, clang::clangd::SymbolQualitySignals::Operator, Unknown, and Variable.

Referenced by categorize(), and clang::clangd::SymbolQualitySignals::merge().

## ◆ categorize() [2/3]

static SymbolQualitySignals::SymbolCategory clang::clangd::categorize | ( | const CodeCompletionResult & | R | ) |
| static

Definition at line 93 of file Quality.cpp.

References categorize(), clang::clangd::SymbolQualitySignals::Constructor, clang::clangd::SymbolQualitySignals::Function, clang::clangd::SymbolQualitySignals::Keyword, clang::clangd::SymbolQualitySignals::Macro, clang::clangd::SymbolQualitySignals::Namespace, clang::clangd::SymbolQualitySignals::Type, and clang::clangd::SymbolQualitySignals::Variable.

## ◆ categorize() [3/3]

static SymbolQualitySignals::SymbolCategory clang::clangd::categorize | ( | const index::SymbolInfo & | D | ) |
| static

Definition at line 119 of file Quality.cpp.

References clang::clangd::SymbolQualitySignals::Constructor, clang::clangd::SymbolQualitySignals::Destructor, clang::clangd::SymbolQualitySignals::Function, clang::clangd::SymbolQualitySignals::Macro, clang::clangd::SymbolQualitySignals::Namespace, clang::clangd::SymbolQualitySignals::Type, Unknown, clang::clangd::SymbolQualitySignals::Unknown, and clang::clangd::SymbolQualitySignals::Variable.

## ◆ codeComplete() [1/2]

CodeCompleteResult clang::clangd::codeComplete | ( | PathRef | FileName,
|  | const tooling::CompileCommand & | Command,
|  | const PreambleData * | Preamble,
|  | StringRef | Contents,
|  | Position | Pos,
|  | IntrusiveRefCntPtr< llvm::vfs::FileSystem > | VFS,
|  | std::shared_ptr< PCHContainerOperations > | PCHs,
|  | CodeCompleteOptions | Opts,
|  | SpeculativeFuzzyFind * | SpecFuzzyFind = `nullptr`
| ) |  |

Get code completions at a specified `Pos` in `FileName`.

If `SpecFuzzyFind` is set, a speculative and asynchronous fuzzy find index request (based on cached request) will be run before parsing sema. In case the speculative result is used by code completion (e.g. speculation failed), the speculative result is not consumed, and `SpecFuzzyFind` is only destroyed when the async request finishes.

## ◆ codeComplete() [2/2]

CodeCompleteResult clang::clangd::codeComplete | ( | PathRef | FileName,
|  | const tooling::CompileCommand & | Command,
|  | const PreambleData * | Preamble,
|  | llvm::StringRef | Contents,
|  | Position | Pos,
|  | llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > | VFS,
|  | std::shared_ptr< PCHContainerOperations > | PCHs,
|  | CodeCompleteOptions | Opts,
|  | SpeculativeFuzzyFind * | SpecFuzzyFind
| ) |  |

Definition at line 1617 of file CodeComplete.cpp.

## ◆ collectIncludeStructureCallback()

std::unique_ptr< PPCallbacks > clang::clangd::collectIncludeStructureCallback | ( | const SourceManager & | SM,
|  | IncludeStructure * | Out
| ) |  |

Returns a PPCallback that visits all inclusions in the main file.

Definition at line 78 of file Headers.cpp.

## ◆ collectIWYUHeaderMaps()

std::unique_ptr< CommentHandler > clang::clangd::collectIWYUHeaderMaps | ( | CanonicalIncludes * | Includes | ) |

Returns a CommentHandler that parses pragma comment on include files to determine when we should include a different header from the header that directly defines a symbol.

Mappinps are registered with `Includes`.

Currently it only supports IWYU private pragma: https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md#iwyu-pragma-private

Definition at line 84 of file CanonicalIncludes.cpp.

## ◆ CompileArgsFrom()

static llvm::cl::opt<CompileArgsFrom> clang::clangd::CompileArgsFrom | ( | "compile_args_from" | ,
|  | llvm::cl::desc("The source of compile commands") | ,
|  | llvm::cl::values(clEnumValN(LSPCompileArgs, "lsp", "All compile commands come from LSP and " "'compile_commands.json' files are ignored"), clEnumValN(FilesystemCompileArgs, "filesystem", "All compile commands come from the " "'compile_commands.json' files")) | ,
|  | llvm::cl::init(FilesystemCompileArgs) | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

## ◆ CompileCommandsDir()

static llvm::cl::opt<Path> clang::clangd::CompileCommandsDir | ( | "compile-commands-dir" | ,
|  | llvm::cl::desc("Specify a path to look for compile_commands.json. If path " "is invalid, clangd will look in the current directory and " "parent paths of each source file.") |
| ) |  |
| static

## ◆ CompletionStyle()

static llvm::cl::opt<CompletionStyleFlag> clang::clangd::CompletionStyle | ( | "completion-style" | ,
|  | llvm::cl::desc("Granularity of code completion suggestions") | ,
|  | llvm::cl::values(clEnumValN(Detailed, "detailed", "One completion item for each semantically distinct " "completion, with full type information."), clEnumValN(Bundled, "bundled", "Similar completion items (e.g. function overloads) are " "combined. Type information shown where possible.")) | ,
|  | llvm::cl::init(Detailed) |
| ) |  |
| static

## ◆ computeScope()

static SymbolRelevanceSignals::AccessibleScope clang::clangd::computeScope | ( | const NamedDecl * | D | ) |
| static

Definition at line 262 of file Quality.cpp.

References clang::clangd::SymbolRelevanceSignals::ClassScope, clang::clangd::SymbolRelevanceSignals::FileScope, clang::clangd::SymbolRelevanceSignals::FunctionScope, and clang::clangd::SymbolRelevanceSignals::GlobalScope.

Referenced by clang::clangd::SymbolRelevanceSignals::merge().

## ◆ createScopeFileDistance()

static FileDistance clang::clangd::createScopeFileDistance | ( | llvm::ArrayRef< std::string > | QueryScopes | ) |
| static

Definition at line 187 of file FileDistance.cpp.

## ◆ createStaticIndexingAction()

std::unique_ptr< FrontendAction > clang::clangd::createStaticIndexingAction | ( | SymbolCollector::Options | Opts,
|  | std::function< void(SymbolSlab)> | SymbolsCallback,
|  | std::function< void(RefSlab)> | RefsCallback,
|  | std::function< void(IncludeGraph)> | IncludeGraphCallback
| ) |  |

Definition at line 167 of file IndexAction.cpp.

## ◆ currentContext()

static Context& clang::clangd::currentContext | ( |  | ) |
| static

Definition at line 23 of file Context.cpp.

References clang::clangd::Context::empty().

Referenced by clang::clangd::Context::current(), and clang::clangd::Context::swapCurrent().

## ◆ digest() [1/2]

FileDigest clang::clangd::digest | ( | StringRef | Content | ) |

## ◆ digest() [2/2]

FileDigest clang::clangd::digest | ( | llvm::StringRef | Content | ) |

Definition at line 240 of file SourceCode.cpp.

## ◆ digestFile()

Optional< FileDigest > clang::clangd::digestFile | ( | const SourceManager & | SM,
|  | FileID | FID
| ) |  |

Definition at line 244 of file SourceCode.cpp.

## ◆ dumpAST()

void clang::clangd::dumpAST | ( | ParsedAST & | AST,
|  | llvm::raw_ostream & | OS
| ) |  |

For testing/debugging purposes.

Note that this method deserializes all unserialized Decls, so use with care.

Definition at line 222 of file ClangdUnit.cpp.

References clang::clangd::ParsedAST::getASTContext().

Referenced by clang::clangd::ClangdServer::dumpAST().

## ◆ elog()

template<typename... Ts>

void clang::clangd::elog | ( | const char * | Fmt,
|  | Ts &&... | Vals
| ) |  |

Definition at line 57 of file Logger.h.

References clang::clangd::Logger::Error, and clang::clangd::detail::log().

Referenced by clang::clangd::ClangdLSPServer::MessageHandler::bind(), clang::clangd::URIForFile::canonicalize(), fromJSON(), clang::clangd::ClangdLSPServer::MessageHandler::onNotify(), clang::clangd::TUScheduler::remove(), and xpcToJson().

## ◆ EnableBackgroundIndex()

static llvm::cl::opt<bool> clang::clangd::EnableBackgroundIndex | ( | "background-index" | ,
|  | llvm::cl::desc("Index project code in the background and persist index on disk. " "Experimental") | ,
|  | llvm::cl::init(false) | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

## ◆ EnableFunctionArgSnippets()

static llvm::cl::opt<bool> clang::clangd::EnableFunctionArgSnippets | ( | "function-arg-placeholders" | ,
|  | llvm::cl::desc("When disabled, completions contain only parentheses for " "function calls. When enabled, completions also contain " "placeholders for method parameters.") | ,
|  | llvm::cl::init(CodeCompleteOptions().EnableFunctionArgSnippets) |
| ) |  |
| static

## ◆ EnableIndex()

static llvm::cl::opt<bool> clang::clangd::EnableIndex | ( | "index" | ,
|  | llvm::cl::desc("Enable index-based features. By default, clangd maintains an index " "built from symbols in opened files. Global index support needs to " "enabled separatedly.") | ,
|  | llvm::cl::init(true) | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

## ◆ EnableTestScheme()

static llvm::cl::opt<bool> clang::clangd::EnableTestScheme | ( | "enable-test-uri-scheme" | ,
|  | llvm::cl::desc("Enable 'test:' URI scheme. Only use in lit tests.") | ,
|  | llvm::cl::init(false) | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

Referenced by main().

## ◆ encodeFloat()

static uint32_t clang::clangd::encodeFloat | ( | float | F | ) |
| static

Definition at line 440 of file Quality.cpp.

Referenced by sortText().

## ◆ evaluateSymbolAndRelevance()

float clang::clangd::evaluateSymbolAndRelevance | ( | float | SymbolQuality,
|  | float | SymbolRelevance
| ) |  |

Combine symbol quality and relevance into a single score.

Definition at line 434 of file Quality.cpp.

## ◆ findDefinitions()

std::vector< Location > clang::clangd::findDefinitions | ( | ParsedAST & | AST,
|  | Position | Pos,
|  | const SymbolIndex * | Index
| ) |  |

Get definition of symbol at a specified `Pos`.

Definition at line 244 of file XRefs.cpp.

Referenced by clang::clangd::ClangdServer::findDefinitions().

## ◆ findDocumentHighlights()

std::vector< DocumentHighlight > clang::clangd::findDocumentHighlights | ( | ParsedAST & | AST,
|  | Position | Pos
| ) |  |

Returns highlights for all usages of a symbol at `Pos`.

Definition at line 434 of file XRefs.cpp.

Referenced by clang::clangd::ClangdServer::findDocumentHighlights().

## ◆ findNameLoc()

SourceLocation clang::clangd::findNameLoc | ( | const clang::Decl * | D | ) |

Find the identifier source location of the given D.

The returned location is usually the spelling location where the name of the decl occurs in the code.

Definition at line 46 of file AST.cpp.

## ◆ findReferences()

std::vector< Location > clang::clangd::findReferences | ( | ParsedAST & | AST,
|  | Position | Pos,
|  | uint32_t | Limit,
|  | const SymbolIndex * | Index = `nullptr`
| ) |  |

Returns reference locations of the symbol at a specified `Pos`.

`Limit` limits the number of results returned (0 means no limit).

Definition at line 706 of file XRefs.cpp.

## ◆ flattenSymbolHierarchy()

static std::vector<SymbolInformation> clang::clangd::flattenSymbolHierarchy | ( | llvm::ArrayRef< DocumentSymbol > | Symbols,
|  | const URIForFile & | FileURI
| ) |  |
| static

The functions constructs a flattened view of the DocumentSymbol hierarchy.

Used by the clients that do not support the hierarchical view.

Definition at line 542 of file ClangdLSPServer.cpp.

## ◆ formatDocumentation()

std::string clang::clangd::formatDocumentation | ( | const CodeCompletionString & | CCS,
|  | llvm::StringRef | DocComment
| ) |  |

Assembles formatted documentation for a completion result.

This includes documentation comments and other relevant information like annotations.

Parameters

  DocComment | is a documentation comment for the original declaration, it should be obtained via getDocComment or getParameterDocComment.

Definition at line 172 of file CodeCompletionStrings.cpp.

References Result.

## ◆ fromJSON() [1/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | E,
|  | URIForFile & | R
| ) |  |

Definition at line 53 of file Protocol.cpp.

References elog(), clang::clangd::URIForFile::fromURI(), and clang::clangd::URI::parse().

## ◆ fromJSON() [2/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | TextDocumentIdentifier & | R
| ) |  |

Definition at line 87 of file Protocol.cpp.

References clang::clangd::TextDocumentIdentifier::uri.

## ◆ fromJSON() [3/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | Position & | R
| ) |  |

Definition at line 92 of file Protocol.cpp.

References clang::clangd::Position::character, and clang::clangd::Position::line.

## ◆ fromJSON() [4/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | Range & | R
| ) |  |

Definition at line 108 of file Protocol.cpp.

References clang::clangd::Range::end, and clang::clangd::Range::start.

## ◆ fromJSON() [5/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | TextDocumentItem & | R
| ) |  |

Definition at line 135 of file Protocol.cpp.

References clang::clangd::TextDocumentItem::languageId, clang::clangd::TextDocumentItem::text, clang::clangd::TextDocumentItem::uri, and clang::clangd::TextDocumentItem::version.

## ◆ fromJSON() [6/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | TextEdit & | R
| ) |  |

Definition at line 141 of file Protocol.cpp.

References clang::clangd::TextEdit::newText, and clang::clangd::TextEdit::range.

## ◆ fromJSON() [7/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | E,
|  | TraceLevel & | Out
| ) |  |

Definition at line 159 of file Protocol.cpp.

## ◆ fromJSON() [8/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | E,
|  | SymbolKind & | Out
| ) |  |

Definition at line 175 of file Protocol.cpp.

## ◆ fromJSON() [9/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Parameters,
|  | FuzzyFindRequest & | Request
| ) |  |

Definition at line 176 of file Index.cpp.

Referenced by clang::clangd::ClangdLSPServer::MessageHandler::bind(), clang::clangd::Range::contains(), fromJSON(), clang::clangd::FuzzyFindRequest::operator!=(), clang::clangd::LSPDiagnosticCompare::operator()(), and clang::clangd::TextEdit::operator==().

## ◆ fromJSON() [10/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | E,
|  | SymbolKindBitset & | Out
| ) |  |

Definition at line 186 of file Protocol.cpp.

## ◆ fromJSON() [11/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | ClientCapabilities & | R
| ) |  |

Definition at line 216 of file Protocol.cpp.

References clang::clangd::ClientCapabilities::DiagnosticCategory, and clang::clangd::ClientCapabilities::DiagnosticFixes.

## ◆ fromJSON() [12/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | ,
|  | NoParams & |
| ) |  |
| inline

Definition at line 240 of file Protocol.h.

## ◆ fromJSON() [13/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | InitializeParams & | R
| ) |  |

Definition at line 264 of file Protocol.cpp.

References clang::clangd::InitializeParams::capabilities, clang::clangd::InitializeParams::initializationOptions, clang::clangd::InitializeParams::processId, clang::clangd::InitializeParams::rootPath, clang::clangd::InitializeParams::rootUri, and clang::clangd::InitializeParams::trace.

## ◆ fromJSON() [14/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | DidOpenTextDocumentParams & | R
| ) |  |

Definition at line 279 of file Protocol.cpp.

References clang::clangd::DidOpenTextDocumentParams::textDocument.

## ◆ fromJSON() [15/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | DidCloseTextDocumentParams & | R
| ) |  |

Definition at line 284 of file Protocol.cpp.

References clang::clangd::DidCloseTextDocumentParams::textDocument.

## ◆ fromJSON() [16/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | DidChangeTextDocumentParams & | R
| ) |  |

Definition at line 289 of file Protocol.cpp.

References clang::clangd::DidChangeTextDocumentParams::contentChanges, clang::clangd::DidChangeTextDocumentParams::textDocument, and clang::clangd::DidChangeTextDocumentParams::wantDiagnostics.

## ◆ fromJSON() [17/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | E,
|  | FileChangeType & | Out
| ) |  |

Definition at line 296 of file Protocol.cpp.

## ◆ fromJSON() [18/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | FileEvent & | R
| ) |  |

Definition at line 307 of file Protocol.cpp.

References clang::clangd::FileEvent::type, and clang::clangd::FileEvent::uri.

## ◆ fromJSON() [19/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | DidChangeWatchedFilesParams & | R
| ) |  |

Definition at line 312 of file Protocol.cpp.

References clang::clangd::DidChangeWatchedFilesParams::changes.

## ◆ fromJSON() [20/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | TextDocumentContentChangeEvent & | R
| ) |  |

Definition at line 317 of file Protocol.cpp.

References clang::clangd::TextDocumentContentChangeEvent::range, clang::clangd::TextDocumentContentChangeEvent::rangeLength, and clang::clangd::TextDocumentContentChangeEvent::text.

## ◆ fromJSON() [21/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | FormattingOptions & | R
| ) |  |

Definition at line 324 of file Protocol.cpp.

References clang::clangd::FormattingOptions::insertSpaces, and clang::clangd::FormattingOptions::tabSize.

## ◆ fromJSON() [22/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | DocumentRangeFormattingParams & | R
| ) |  |

Definition at line 337 of file Protocol.cpp.

References clang::clangd::DocumentRangeFormattingParams::options, clang::clangd::DocumentRangeFormattingParams::range, and clang::clangd::DocumentRangeFormattingParams::textDocument.

## ◆ fromJSON() [23/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | DocumentOnTypeFormattingParams & | R
| ) |  |

Definition at line 344 of file Protocol.cpp.

References clang::clangd::DocumentOnTypeFormattingParams::ch, clang::clangd::DocumentOnTypeFormattingParams::options, clang::clangd::DocumentOnTypeFormattingParams::position, and clang::clangd::DocumentOnTypeFormattingParams::textDocument.

## ◆ fromJSON() [24/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | DocumentFormattingParams & | R
| ) |  |

Definition at line 352 of file Protocol.cpp.

References clang::clangd::DocumentFormattingParams::options, and clang::clangd::DocumentFormattingParams::textDocument.

## ◆ fromJSON() [25/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | DocumentSymbolParams & | R
| ) |  |

Definition at line 358 of file Protocol.cpp.

References clang::clangd::DocumentSymbolParams::textDocument.

## ◆ fromJSON() [26/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | Diagnostic & | R
| ) |  |

Definition at line 376 of file Protocol.cpp.

References clang::clangd::Diagnostic::category, clang::clangd::Diagnostic::message, clang::clangd::Diagnostic::range, and clang::clangd::Diagnostic::severity.

## ◆ fromJSON() [27/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | CodeActionContext & | R
| ) |  |

Definition at line 385 of file Protocol.cpp.

References clang::clangd::CodeActionContext::diagnostics.

## ◆ fromJSON() [28/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | CodeActionParams & | R
| ) |  |

Definition at line 412 of file Protocol.cpp.

References clang::clangd::CodeActionParams::context, clang::clangd::CodeActionParams::range, and clang::clangd::CodeActionParams::textDocument.

## ◆ fromJSON() [29/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | WorkspaceEdit & | R
| ) |  |

Definition at line 418 of file Protocol.cpp.

References clang::clangd::WorkspaceEdit::changes, and clang::clangd::ExecuteCommandParams::CLANGD_APPLY_FIX_COMMAND.

## ◆ fromJSON() [30/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | ExecuteCommandParams & | R
| ) |  |

Definition at line 425 of file Protocol.cpp.

References clang::clangd::ExecuteCommandParams::command.

## ◆ fromJSON() [31/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | WorkspaceSymbolParams & | R
| ) |  |

Definition at line 492 of file Protocol.cpp.

References clang::clangd::WorkspaceSymbolParams::query.

## ◆ fromJSON() [32/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | TextDocumentPositionParams & | R
| ) |  |

Definition at line 552 of file Protocol.cpp.

References clang::clangd::TextDocumentPositionParams::position, and clang::clangd::TextDocumentPositionParams::textDocument.

## ◆ fromJSON() [33/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | CompletionContext & | R
| ) |  |

Definition at line 558 of file Protocol.cpp.

References fromJSON(), clang::clangd::CompletionContext::triggerCharacter, and clang::clangd::CompletionContext::triggerKind.

## ◆ fromJSON() [34/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | CompletionParams & | R
| ) |  |

Definition at line 573 of file Protocol.cpp.

References clang::clangd::CompletionParams::context, fromJSON(), and clang::clangd::Context::get().

## ◆ fromJSON() [35/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | E,
|  | CompletionItemKind & | Out
| ) |  |

Definition at line 610 of file Protocol.cpp.

## ◆ fromJSON() [36/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | E,
|  | CompletionItemKindBitset & | Out
| ) |  |

Definition at line 643 of file Protocol.cpp.

## ◆ fromJSON() [37/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | RenameParams & | R
| ) |  |

Definition at line 735 of file Protocol.cpp.

References clang::clangd::RenameParams::newName, clang::clangd::RenameParams::position, and clang::clangd::RenameParams::textDocument.

## ◆ fromJSON() [38/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | DidChangeConfigurationParams & | CCP
| ) |  |

Definition at line 765 of file Protocol.cpp.

References clang::clangd::DidChangeConfigurationParams::settings.

## ◆ fromJSON() [39/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | ClangdCompileCommand & | CDbUpdate
| ) |  |

Definition at line 771 of file Protocol.cpp.

References clang::clangd::ClangdCompileCommand::compilationCommand, and clang::clangd::ClangdCompileCommand::workingDirectory.

## ◆ fromJSON() [40/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | ConfigurationSettings & | S
| ) |  |

Definition at line 778 of file Protocol.cpp.

References clang::clangd::ConfigurationSettings::compilationDatabaseChanges.

## ◆ fromJSON() [41/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | InitializationOptions & | Opts
| ) |  |

Definition at line 786 of file Protocol.cpp.

## ◆ fromJSON() [42/42]

bool clang::clangd::fromJSON | ( | const llvm::json::Value & | Params,
|  | ReferenceParams & | R
| ) |  |

Definition at line 798 of file Protocol.cpp.

References fromJSON().

## ◆ getBeginningOfIdentifier()

SourceLocation clang::clangd::getBeginningOfIdentifier | ( | ParsedAST & | Unit,
|  | const Position & | Pos,
|  | const FileID | FID
| ) |  |

Get the beginning SourceLocation at a specified `Pos`.

May be invalid if Pos is, or if there's no identifier.

Definition at line 545 of file ClangdUnit.cpp.

References AST, and clang::clangd::ParsedAST::getASTContext().

## ◆ getCanonicalPath()

llvm::Optional< std::string > clang::clangd::getCanonicalPath | ( | const FileEntry * | F,
|  | const SourceManager & | SourceMgr
| ) |  |

Get the canonical path of `F`.

This means:

- Absolute path
- Symlinks resolved
- No "." or ".." component
- No duplicate or trailing directory separator

This function should be used when paths needs to be used outside the component that generate it, so that paths are normalized as much as possible.

Definition at line 187 of file SourceCode.cpp.

## ◆ getDeclComment()

std::string clang::clangd::getDeclComment | ( | const ASTContext & | Ctx,
|  | const NamedDecl & | Decl
| ) |  |

Similar to getDocComment, but returns the comment for a NamedDecl.

Definition at line 57 of file CodeCompletionStrings.cpp.

Referenced by getDocComment().

## ◆ getDeducedType()

llvm::Optional<QualType> clang::clangd::getDeducedType | ( | ParsedAST & | AST,
|  | SourceLocation | SourceLocationBeg
| ) |  |

Retrieves the deduced type at a given location (auto, decltype).

Definition at line 666 of file XRefs.cpp.

## ◆ getDefaultAsyncThreadsCount()

unsigned clang::clangd::getDefaultAsyncThreadsCount | ( |  | ) |

Returns a number of a default async threads to use for TUScheduler.

Returned value is always >= 1 (i.e. will not cause requests to be processed synchronously).

Definition at line 762 of file TUScheduler.cpp.

## ◆ getDocComment()

std::string clang::clangd::getDocComment | ( | const ASTContext & | Ctx,
|  | const CodeCompletionResult & | Result,
|  | bool | CommentsFromHeaders
| ) |  |

Gets a minimally formatted documentation comment of `Result`, with comment markers stripped.

See clang::RawComment::getFormattedText() for the detailed explanation of how the comment text is transformed. Returns empty string when no comment is available. If `CommentsFromHeaders` parameter is set, only comments from the main file will be returned. It is used to workaround crashes when parsing comments in the stale headers, coming from completion preamble.

Definition at line 45 of file CodeCompletionStrings.cpp.

References getDeclComment().

## ◆ getDocumentSymbols()

llvm::Expected< std::vector< DocumentSymbol > > clang::clangd::getDocumentSymbols | ( | ParsedAST & | AST | ) |

Retrieves the symbols contained in the "main file" section of an AST in the same order that they appear.

Definition at line 322 of file FindSymbols.cpp.

Referenced by clang::clangd::ClangdServer::documentSymbols().

## ◆ getFallbackClangPath()

static std::string clang::clangd::getFallbackClangPath | ( |  | ) |
| static

Definition at line 43 of file GlobalCompilationDatabase.cpp.

Referenced by clang::clangd::GlobalCompilationDatabase::getFallbackCommand().

## ◆ getHover()

llvm::Optional< Hover > clang::clangd::getHover | ( | ParsedAST & | AST,
|  | Position | Pos
| ) |  |

Get the hover information when hovering at `Pos`.

Definition at line 686 of file XRefs.cpp.

Referenced by clang::clangd::ClangdServer::findHover().

## ◆ getHoverContents() [1/3]

static Hover clang::clangd::getHoverContents | ( | const Decl * | D | ) |
| static

Generate a `Hover` object given the declaration `D`.

Definition at line 521 of file XRefs.cpp.

References clang::clangd::Hover::contents, getScopeName(), printingPolicyForDecls(), and clang::clangd::MarkupContent::value.

## ◆ getHoverContents() [2/3]

static Hover clang::clangd::getHoverContents | ( | QualType | T,
|  | ASTContext & | ASTCtx
| ) |  |
| static

Generate a `Hover` object given the type `T`.

Definition at line 553 of file XRefs.cpp.

## ◆ getHoverContents() [3/3]

static Hover clang::clangd::getHoverContents | ( | llvm::StringRef | MacroName | ) |
| static

Generate a `Hover` object given the macro `MacroInf`.

Definition at line 565 of file XRefs.cpp.

References clang::clangd::Hover::contents, and clang::clangd::MarkupContent::value.

## ◆ getReturnType()

std::string clang::clangd::getReturnType | ( | const CodeCompletionString & | CCS | ) |

Gets detail to be used as the detail field in an LSP completion item.

This is usually the return type of a function.

Definition at line 202 of file CodeCompletionStrings.cpp.

## ◆ getScopeName()

static llvm::Optional<std::string> clang::clangd::getScopeName | ( | const Decl * | D | ) |
| static

Given a declaration `D`, return a human-readable string representing the scope in which it is declared.

If the declaration is in the global scope, return the string "global namespace".

Definition at line 505 of file XRefs.cpp.

References namedDeclQualifiedName(), None, and typeDeclToString().

Referenced by getHoverContents().

## ◆ getSeverity()

int clang::clangd::getSeverity | ( | DiagnosticsEngine::Level | L | ) |

Convert from clang diagnostic level to LSP severity.

Definition at line 275 of file Diagnostics.cpp.

## ◆ getSignature()

void clang::clangd::getSignature | ( | const CodeCompletionString & | CCS,
|  | std::string * | Signature,
|  | std::string * | Snippet,
|  | std::string * | RequiredQualifiers = `nullptr`
| ) |  |

Formats the signature for an item, as a display string and snippet.

e.g. for const_reference std::vector<T>::at(size_type) const, this returns: *Signature = "(size_type) const" *Snippet = "(${0:size_type})" If set, RequiredQualifiers is the text that must be typed before the name. e.g "Base::" when calling a base class member function that's hidden.

Definition at line 76 of file CodeCompletionStrings.cpp.

## ◆ getSymbolID() [1/2]

llvm::Optional< SymbolID > clang::clangd::getSymbolID | ( | const Decl * | D | ) |

Gets the symbol ID for a declaration, if possible.

Definition at line 117 of file AST.cpp.

## ◆ getSymbolID() [2/2]

llvm::Optional< SymbolID > clang::clangd::getSymbolID | ( | const IdentifierInfo & | II,
|  | const MacroInfo * | MI,
|  | const SourceManager & | SM
| ) |  |

Gets the symbol ID for a macro, if possible.

Currently, this is an encoded USR of the macro, which incorporates macro locations (e.g. file name, offset in file). FIXME: the USR semantics might not be stable enough as the ID for index macro (e.g. a change in definition offset can result in a different USR). We could change these semantics in the future by reimplementing this funcure (e.g. avoid USR for macros).

Definition at line 124 of file AST.cpp.

## ◆ getSymbolInfo()

std::vector< SymbolDetails > clang::clangd::getSymbolInfo | ( | ParsedAST & | AST,
|  | Position | Pos
| ) |  |

Get info about symbols at `Pos`.

Definition at line 765 of file XRefs.cpp.

Referenced by clang::clangd::ClangdServer::symbolInfo().

## ◆ getTemplateSpecializationArgs()

static const TemplateArgumentList* clang::clangd::getTemplateSpecializationArgs | ( | const NamedDecl & | ND | ) |
| static

Definition at line 70 of file AST.cpp.

## ◆ getWorkspaceSymbols()

llvm::Expected< std::vector< SymbolInformation > > clang::clangd::getWorkspaceSymbols | ( | llvm::StringRef | Query,
|  | int | Limit,
|  | const SymbolIndex *const | Index,
|  | llvm::StringRef | HintPath
| ) |  |

Searches for the symbols matching `Query`.

The syntax of `Query` can be the non-qualified name or fully qualified of a symbol. For example, "vector" will match the symbol std::vector and "std::vector" would also match it. Direct children of scopes (namepaces, etc) can be listed with a trailing "::". For example, "std::" will list all children of the std namespace and "::" alone will list all children of the global namespace. `Limit` limits the number of results returned (0 means no limit). `HintPath` This is used when resolving URIs. If empty, URI resolution can fail if a hint path is required for the scheme of a specific URI.

Definition at line 103 of file FindSymbols.cpp.

## ◆ halfOpenToRange()

Range clang::clangd::halfOpenToRange | ( | const SourceManager & | SM,
|  | CharSourceRange | R
| ) |  |

Definition at line 145 of file SourceCode.cpp.

Referenced by toTextEdit().

## ◆ hasDeclInMainFile()

static bool clang::clangd::hasDeclInMainFile | ( | const Decl & | D | ) |
| static

Definition at line 42 of file Quality.cpp.

Referenced by clang::clangd::SymbolRelevanceSignals::merge().

## ◆ hash_value()

llvm::hash_code clang::clangd::hash_value | ( | const SymbolID & | ID | ) |

Definition at line 51 of file SymbolID.cpp.

Referenced by canonicalize(), clang::clangd::FileDistance::distance(), clang::clangd::URIDistance::distance(), and llvm::DenseMapInfo< clang::clangd::SymbolID >::getHashValue().

## ◆ hasUsingDeclInMainFile()

static bool clang::clangd::hasUsingDeclInMainFile | ( | const CodeCompletionResult & | R | ) |
| static

Definition at line 52 of file Quality.cpp.

Referenced by clang::clangd::SymbolRelevanceSignals::merge().

## ◆ HeaderInsertionDecorators()

static llvm::cl::opt<bool> clang::clangd::HeaderInsertionDecorators | ( | "header-insertion-decorators" | ,
|  | llvm::cl::desc("Prepend a circular dot or space before the completion " "label, depending on whether " "an include line will be inserted or not.") | ,
|  | llvm::cl::init(true) |
| ) |  |
| static

## ◆ IncludeIneligibleResults()

static llvm::cl::opt<bool> clang::clangd::IncludeIneligibleResults | ( | "include-ineligible-results" | ,
|  | llvm::cl::desc("Include ineligible completion results (e.g. private members)") | ,
|  | llvm::cl::init(CodeCompleteOptions().IncludeIneligibleResults) | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

## ◆ IndexFile()

static llvm::cl::opt<Path> clang::clangd::IndexFile | ( | "index-file" | ,
|  | llvm::cl::desc("Index file to build the static index. The file must have been created " "by a compatible clangd-index.\"WARNING:This option is experimental only, and will be removed " "eventually. Don 't rely on it.") | ,
|  | llvm::cl::init("") | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

## ◆ indexHeaderSymbols()

SymbolSlab clang::clangd::indexHeaderSymbols | ( | ASTContext & | AST,
|  | std::shared_ptr< Preprocessor > | PP
| ) |  |

Idex declarations from `AST` and macros from `PP` that are declared in included headers.

Definition at line 80 of file FileIndex.cpp.

## ◆ indexMainDecls()

std::pair< SymbolSlab, RefSlab > clang::clangd::indexMainDecls | ( | ParsedAST & | AST | ) |

Retrieves symbols and refs of local top level decls in `AST` (i.e.

`AST.getLocalTopLevelDecls()`). Exposed to assist in unit tests.

Definition at line 74 of file FileIndex.cpp.

References clang::clangd::ParsedAST::getASTContext(), clang::clangd::ParsedAST::getLocalTopLevelDecls(), clang::clangd::ParsedAST::getPreprocessorPtr(), and indexSymbols().

Referenced by clang::clangd::FileIndex::updateMain().

## ◆ indexSymbols()

static std::pair<SymbolSlab, RefSlab> clang::clangd::indexSymbols | ( | ASTContext & | AST,
|  | std::shared_ptr< Preprocessor > | PP,
|  | llvm::ArrayRef< Decl *> | DeclsToIndex,
|  | bool | IsIndexMainAST
| ) |  |
| static

Definition at line 31 of file FileIndex.cpp.

Referenced by indexMainDecls().

## ◆ InputMirrorFile()

static llvm::cl::opt<Path> clang::clangd::InputMirrorFile | ( | "input-mirror-file" | ,
|  | llvm::cl::desc("Mirror all LSP input to the specified file. Useful for debugging.") | ,
|  | llvm::cl::init("") | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

Referenced by main().

## ◆ InputStyle()

static llvm::cl::opt<JSONStreamStyle> clang::clangd::InputStyle | ( | "input-style" | ,
|  | llvm::cl::desc("Input JSON stream encoding") | ,
|  | llvm::cl::values(clEnumValN(JSONStreamStyle::Standard, "standard", "usual LSP protocol"), clEnumValN(JSONStreamStyle::Delimited, "delimited", "messages delimited by --- lines, with # comment support")) | ,
|  | llvm::cl::init(JSONStreamStyle::Standard) |
| ) |  |
| static

Referenced by main().

## ◆ isAwful()

static bool clang::clangd::isAwful | ( | int | S | ) |
| static

Definition at line 74 of file FuzzyMatch.cpp.

Referenced by clang::clangd::FuzzyMatcher::dumpLast(), and clang::clangd::FuzzyMatcher::match().

## ◆ isCancelled()

bool clang::clangd::isCancelled | ( | const Context & | Ctx = `Context::current()` | ) |

True if the current context is within a cancelable task which was cancelled.

Always false if there is no active cancelable task. This isn't free (context lookup) - don't call it in a tight loop.

Definition at line 27 of file Cancellation.cpp.

References clang::clangd::Context::get().

## ◆ isImplementationDetail()

bool clang::clangd::isImplementationDetail | ( | const Decl * | D | ) |

Returns true if the declaration is considered implementation detail based on heuristics.

For example, a declaration whose name is not explicitly spelled in code is considered implementation detail.

Definition at line 44 of file AST.cpp.

References isSpelledInSourceCode().

Referenced by clang::clangd::SymbolQualitySignals::merge().

## ◆ isIndexedForCodeCompletion()

bool clang::clangd::isIndexedForCodeCompletion | ( | const NamedDecl & | ND,
|  | ASTContext & | ASTCtx
| ) |  |

Definition at line 1650 of file CodeComplete.cpp.

## ◆ isInstanceMember() [1/2]

static bool clang::clangd::isInstanceMember | ( | const NamedDecl * | ND | ) |
| static

Definition at line 160 of file Quality.cpp.

Referenced by clang::clangd::SymbolRelevanceSignals::merge().

## ◆ isInstanceMember() [2/2]

static bool clang::clangd::isInstanceMember | ( | const index::SymbolInfo & | D | ) |
| static

Definition at line 170 of file Quality.cpp.

## ◆ isLiteralInclude()

bool clang::clangd::isLiteralInclude | ( | llvm::StringRef | Include | ) |

Returns true if `Include` is literal include like "path" or <path>.

Definition at line 68 of file Headers.cpp.

Referenced by clang::clangd::HeaderFile::valid().

## ◆ IsRangeConsecutive()

bool clang::clangd::IsRangeConsecutive | ( | const Range & | Left,
|  | const Range & | Right
| ) |  |

Definition at line 235 of file SourceCode.cpp.

References clang::clangd::Position::character, clang::clangd::Range::end, clang::clangd::Position::line, and clang::clangd::Range::start.

## ◆ isReserved()

static bool clang::clangd::isReserved | ( | llvm::StringRef | Name | ) |
| static

Definition at line 36 of file Quality.cpp.

## ◆ isSpelledInSourceCode()

bool clang::clangd::isSpelledInSourceCode | ( | const Decl * | D | ) |

Definition at line 30 of file AST.cpp.

Referenced by isImplementationDetail().

## ◆ iterateCodepoints()

template<typename Callback >

static bool clang::clangd::iterateCodepoints | ( | llvm::StringRef | U8,
|  | const Callback & | CB
| ) |  |
| static

Definition at line 29 of file SourceCode.cpp.

Referenced by lspLength(), and measureUTF16().

## ◆ jsonToXpc() [1/2]

xpc_object_t clang::clangd::jsonToXpc | ( | const llvm::json::Value & | JSON | ) |

## ◆ jsonToXpc() [2/2]

xpc_object_t clang::clangd::jsonToXpc | ( | const json::Value & | JSON | ) |

Definition at line 21 of file Conversion.cpp.

Referenced by main().

## ◆ LimitResults()

static llvm::cl::opt<int> clang::clangd::LimitResults | ( | "limit-results" | ,
|  | llvm::cl::desc("Limit the number of results returned by clangd. " "0 means no limit.") | ,
|  | llvm::cl::init(100) |
| ) |  |
| static

## ◆ loadIndex()

std::unique_ptr< SymbolIndex > clang::clangd::loadIndex | ( | llvm::StringRef | SymbolFilename,
|  | bool | UseDex
| ) |  |

Definition at line 551 of file Serialization.cpp.

Referenced by clang::clangd::IndexFileOut::IndexFileOut().

## ◆ log()

template<typename... Ts>

void clang::clangd::log | ( | const char * | Fmt,
|  | Ts &&... | Vals
| ) |  |

Definition at line 63 of file Logger.h.

References clang::clangd::Logger::Info, and clang::clangd::detail::log().

Referenced by clang::clangd::BackgroundIndex::BackgroundIndex(), clang::clangd::ParsedAST::build(), buildCompilerInvocation(), clang::clangd::URIDistance::distance(), clang::clangd::DirectoryBasedGlobalCompilationDatabase::getCompileCommand(), clang::clangd::StoreDiags::HandleDiagnostic(), and clang::clangd::ClangdLSPServer::MessageHandler::onNotify().

## ◆ LogLevel()

static llvm::cl::opt<Logger::Level> clang::clangd::LogLevel | ( | "log" | ,
|  | llvm::cl::desc("Verbosity of log messages written to stderr") | ,
|  | llvm::cl::values(clEnumValN(Logger::Error, "error", "Error messages only"), clEnumValN(Logger::Info, "info", "High level execution tracing"), clEnumValN(Logger::Debug, "verbose", "Low level details")) | ,
|  | llvm::cl::init(Logger::Info) |
| ) |  |
| static

## ◆ lower()

static char clang::clangd::lower | ( | char | C | ) |
| static

Definition at line 69 of file FuzzyMatch.cpp.

Referenced by calculateRoles(), clang::clangd::FuzzyMatcher::FuzzyMatcher(), and clang::tidy::bugprone::isLikelyTypo().

## ◆ lspLength() [1/2]

size_t clang::clangd::lspLength | ( | StringRef | Code | ) |

## ◆ lspLength() [2/2]

size_t clang::clangd::lspLength | ( | llvm::StringRef | Code | ) |

Definition at line 70 of file SourceCode.cpp.

References iterateCodepoints().

Referenced by offsetToPosition().

## ◆ measureUTF16()

static size_t clang::clangd::measureUTF16 | ( | llvm::StringRef | U8,
|  | int | U16Units,
|  | bool & | Valid
| ) |  |
| static

Definition at line 56 of file SourceCode.cpp.

References iterateCodepoints(), and Result.

Referenced by positionToOffset().

## ◆ mergeSymbol()

Symbol clang::clangd::mergeSymbol | ( | const Symbol & | L,
|  | const Symbol & | R
| ) |  |

Definition at line 119 of file Merge.cpp.

References clang::clangd::Symbol::CanonicalDeclaration, clang::clangd::Symbol::CompletionSnippetSuffix, clang::clangd::Symbol::Definition, clang::clangd::Symbol::Documentation, clang::clangd::SymbolLocation::FileURI, clang::clangd::Symbol::Flags, clang::clangd::Symbol::ID, clang::clangd::Symbol::IncludeHeaders, Merge, clang::clangd::Symbol::Origin, clang::clangd::Symbol::References, clang::clangd::Symbol::ReturnType, clang::clangd::Symbol::Signature, and clang::clangd::Symbol::Type.

Referenced by clang::clangd::FileSymbols::buildIndex().

## ◆ namedDeclQualifiedName()

static std::string clang::clangd::namedDeclQualifiedName | ( | const NamedDecl * | ND,
|  | llvm::StringRef | Prefix
| ) |  |
| static

Return a string representation (e.g.

"namespace ns1::ns2") of the named declaration `ND`.

Definition at line 489 of file XRefs.cpp.

References Name, and printingPolicyForDecls().

Referenced by getScopeName().

## ◆ newJSONTransport()

std::unique_ptr< Transport > clang::clangd::newJSONTransport | ( | std::FILE * | In,
|  | llvm::raw_ostream & | Out,
|  | llvm::raw_ostream * | InMirror,
|  | bool | Pretty,
|  | JSONStreamStyle | Style
| ) |  |

Definition at line 293 of file JSONTransport.cpp.

## ◆ newXPCTransport()

std::unique_ptr<Transport> clang::clangd::newXPCTransport | ( |  | ) |

Definition at line 212 of file XPCTransport.cpp.

## ◆ offsetToClangLineColumn()

std::pair< size_t, size_t > clang::clangd::offsetToClangLineColumn | ( | llvm::StringRef | Code,
|  | size_t | Offset
| ) |  |

Definition at line 153 of file SourceCode.cpp.

References Lines.

## ◆ offsetToPosition()

Position clang::clangd::offsetToPosition | ( | llvm::StringRef | Code,
|  | size_t | Offset
| ) |  |

Turn an offset in Code into a [line, column] pair.

The offset must be in range [0, Code.size()].

Definition at line 116 of file SourceCode.cpp.

References clang::clangd::Position::character, clang::clangd::Position::line, Lines, lspLength(), and Pos.

Referenced by replacementToEdit().

## ◆ operator &() [1/2]

SymbolOrigin clang::clangd::operator& | ( | SymbolOrigin | A,
|  | SymbolOrigin | B
| ) |  |
| inline

Definition at line 141 of file Index.h.

References operator<<().

## ◆ operator &() [2/2]

RefKind clang::clangd::operator& | ( | RefKind | A,
|  | RefKind | B
| ) |  |
| inline

Definition at line 363 of file Index.h.

References operator<<().

## ◆ operator<() [1/4]

bool clang::clangd::operator< | ( | const SymbolLocation::Position & | L,
|  | const SymbolLocation::Position & | R
| ) |  |
| inline

Definition at line 79 of file Index.h.

References clang::clangd::SymbolLocation::Position::column(), and clang::clangd::SymbolLocation::Position::line().

## ◆ operator<() [2/4]

bool clang::clangd::operator< | ( | const SymbolLocation & | L,
|  | const SymbolLocation & | R
| ) |  |
| inline

Definition at line 89 of file Index.h.

References clang::clangd::SymbolLocation::End, clang::clangd::SymbolLocation::FileURI, operator<<(), and clang::clangd::SymbolLocation::Start.

## ◆ operator<() [3/4]

bool clang::clangd::operator< | ( | const Ref & | L,
|  | const Ref & | R
| ) |  |
| inline

Definition at line 378 of file Index.h.

References clang::clangd::Ref::Kind, and clang::clangd::Ref::Location.

## ◆ operator<() [4/4]

bool clang::clangd::operator< | ( | const CompletionItem & | L,
|  | const CompletionItem & | R
| ) |  |

Definition at line 686 of file Protocol.cpp.

References clang::clangd::CompletionItem::label, and clang::clangd::CompletionItem::sortText.

## ◆ operator<<() [1/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const SymbolLocation & | L
| ) |  |

Definition at line 37 of file Index.cpp.

References clang::clangd::SymbolLocation::Position::column(), clang::clangd::SymbolLocation::End, clang::clangd::SymbolLocation::FileURI, clang::clangd::SymbolLocation::Position::line(), and clang::clangd::SymbolLocation::Start.

## ◆ operator<<() [2/33]

llvm::raw_ostream& clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | SymbolOrigin | O
| ) |  |

Definition at line 44 of file Index.cpp.

References Unknown.

## ◆ operator<<() [3/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const SymbolID & | ID
| ) |  |

Definition at line 47 of file SymbolID.cpp.

## ◆ operator<<() [4/33]

llvm::raw_ostream& clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | Symbol::SymbolFlag | F
| ) |  |

Definition at line 54 of file Index.cpp.

References clang::clangd::Symbol::Deprecated, clang::clangd::Symbol::IndexedForCodeCompletion, and clang::clangd::Symbol::None.

## ◆ operator<<() [5/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const Symbol & | S
| ) |  |

Definition at line 65 of file Index.cpp.

References clang::clangd::Symbol::Name, and clang::clangd::Symbol::Scope.

## ◆ operator<<() [6/33]

llvm::raw_ostream& clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const URIForFile & | U
| ) |  |

Definition at line 79 of file Protocol.cpp.

References clang::clangd::URIForFile::uri().

## ◆ operator<<() [7/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const Position & | P
| ) |  |

Definition at line 104 of file Protocol.cpp.

References clang::clangd::Position::character, and clang::clangd::Position::line.

## ◆ operator<<() [8/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | RefKind | K
| ) |  |

Definition at line 115 of file Index.cpp.

References Messages, and Unknown.

## ◆ operator<<() [9/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const Range & | R
| ) |  |

Definition at line 120 of file Protocol.cpp.

References clang::clangd::Range::end, and clang::clangd::Range::start.

## ◆ operator<<() [10/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const Location & | L
| ) |  |

Definition at line 131 of file Protocol.cpp.

References clang::clangd::Location::range, and clang::clangd::Location::uri.

## ◆ operator<<() [11/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const Ref & | R
| ) |  |

Definition at line 131 of file Index.cpp.

References clang::clangd::Ref::Kind, and clang::clangd::Ref::Location.

## ◆ operator<<() [12/33]

raw_ostream& clang::clangd::operator<< | ( | raw_ostream & | ,
|  | SymbolOrigin |
| ) |  |

## ◆ operator<<() [13/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const TextEdit & | TE
| ) |  |

Definition at line 153 of file Protocol.cpp.

References clang::clangd::TextEdit::newText, and clang::clangd::TextEdit::range.

## ◆ operator<<() [14/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const Inclusion & | Inc
| ) |  |

Definition at line 177 of file Headers.cpp.

References clang::clangd::Inclusion::R, clang::clangd::Inclusion::Resolved, and clang::clangd::Inclusion::Written.

## ◆ operator<<() [15/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const DiagBase & | D
| ) |  |

Definition at line 191 of file Diagnostics.cpp.

References clang::clangd::Range::end, clang::clangd::DiagBase::File, clang::clangd::DiagBase::InsideMainFile, clang::clangd::DiagBase::Message, clang::clangd::DiagBase::Range, and clang::clangd::Range::start.

## ◆ operator<<() [16/33]

raw_ostream& clang::clangd::operator<< | ( | raw_ostream & | ,
|  | const CodeCompletion & |
| ) |  |

## ◆ operator<<() [17/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const Fix & | F
| ) |  |

Definition at line 200 of file Diagnostics.cpp.

References clang::clangd::Fix::Message.

## ◆ operator<<() [18/33]

raw_ostream& clang::clangd::operator<< | ( | raw_ostream & | ,
|  | const CodeCompleteResult & |
| ) |  |

## ◆ operator<<() [19/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const Diag & | D
| ) |  |

Definition at line 210 of file Diagnostics.cpp.

References D, and clang::clangd::Diag::Notes.

## ◆ operator<<() [20/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const SymbolQualitySignals & | S
| ) |  |

Definition at line 251 of file Quality.cpp.

References clang::clangd::SymbolQualitySignals::Category, clang::clangd::SymbolQualitySignals::Deprecated, clang::clangd::SymbolQualitySignals::evaluate(), clang::clangd::SymbolQualitySignals::References, and clang::clangd::SymbolQualitySignals::ReservedName.

## ◆ operator<<() [21/33]

raw_ostream& clang::clangd::operator<< | ( | raw_ostream & | ,
|  | Symbol::SymbolFlag |
| ) |  |

## ◆ operator<<() [22/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const Diagnostic & | D
| ) |  |

Definition at line 390 of file Protocol.cpp.

References clang::clangd::Diagnostic::message, clang::clangd::Diagnostic::range, and clang::clangd::Diagnostic::severity.

## ◆ operator<<() [23/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const SymbolRelevanceSignals & | S
| ) |  |

Definition at line 400 of file Quality.cpp.

References clang::clangd::SymbolRelevanceSignals::Context, clang::clangd::SymbolRelevanceSignals::evaluate(), clang::clangd::SymbolRelevanceSignals::FileProximityMatch, clang::clangd::SymbolRelevanceSignals::Forbidden, clang::clangd::SymbolRelevanceSignals::HadContextType, clang::clangd::SymbolRelevanceSignals::HadSymbolType, clang::clangd::SymbolRelevanceSignals::IsInstanceMember, clang::clangd::SymbolRelevanceSignals::NameMatch, clang::clangd::SymbolRelevanceSignals::NeedsFixIts, clang::clangd::SymbolRelevanceSignals::Query, clang::clangd::SymbolRelevanceSignals::Scope, scopeBoost(), clang::clangd::SymbolRelevanceSignals::ScopeProximityMatch, clang::clangd::SymbolRelevanceSignals::SemaFileProximityScore, clang::clangd::SymbolRelevanceSignals::SemaSaysInScope, clang::clangd::SymbolRelevanceSignals::SymbolScope, clang::clangd::SymbolRelevanceSignals::SymbolURI, clang::clangd::SymbolRelevanceSignals::TypeMatchesPreferred, and uriProximity().

## ◆ operator<<() [24/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | O,
|  | const SymbolInformation & | SI
| ) |  |

Definition at line 447 of file Protocol.cpp.

References clang::clangd::SymbolInformation::containerName, clang::clangd::SymbolInformation::name, and toJSON().

## ◆ operator<<() [25/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const SignatureQualitySignals & | S
| ) |  |

Definition at line 464 of file Quality.cpp.

References clang::clangd::SignatureQualitySignals::ContainsActiveParameter, clang::clangd::SignatureQualitySignals::Kind, clang::clangd::SignatureQualitySignals::NumberOfOptionalParameters, and clang::clangd::SignatureQualitySignals::NumberOfParameters.

## ◆ operator<<() [26/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | O,
|  | const SymbolDetails & | S
| ) |  |

Definition at line 480 of file Protocol.cpp.

References clang::clangd::SymbolDetails::containerName, clang::clangd::SymbolDetails::name, and toJSON().

## ◆ operator<<() [27/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | O,
|  | const DocumentSymbol & | S
| ) |  |

Definition at line 519 of file Protocol.cpp.

References clang::clangd::DocumentSymbol::name, and toJSON().

## ◆ operator<<() [28/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const IndexFileOut & | O
| ) |  |

Definition at line 528 of file Serialization.cpp.

References clang::clangd::IndexFileOut::Format, RIFF, writeYAML(), and YAML.

## ◆ operator<<() [29/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | O,
|  | const CompletionItem & | I
| ) |  |

Definition at line 681 of file Protocol.cpp.

References clang::clangd::CompletionItem::label, and toJSON().

## ◆ operator<<() [30/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | O,
|  | const SignatureInformation & | I
| ) |  |

Definition at line 717 of file Protocol.cpp.

References clang::clangd::SignatureInformation::label, and toJSON().

## ◆ operator<<() [31/33]

llvm::raw_ostream & clang::clangd::operator<< | ( | llvm::raw_ostream & | O,
|  | const DocumentHighlight & | V
| ) |  |

Definition at line 755 of file Protocol.cpp.

References clang::clangd::DocumentHighlight::kind, clang::clangd::DocumentHighlight::range, Read, and Write.

## ◆ operator<<() [32/33]

llvm::raw_ostream& clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const CodeCompletion & | C
| ) |  |

Definition at line 1719 of file CodeComplete.cpp.

References clang::clangd::CodeCompletion::render().

Referenced by clang::clangd::Range::contains(), clang::clangd::IndexFileOut::IndexFileOut(), operator &(), clang::clangd::LSPDiagnosticCompare::operator()(), operator<(), clang::clangd::TextEdit::operator==(), operator==(), and operator|=().

## ◆ operator<<() [33/33]

llvm::raw_ostream& clang::clangd::operator<< | ( | llvm::raw_ostream & | OS,
|  | const CodeCompleteResult & | R
| ) |  |

Definition at line 1724 of file CodeComplete.cpp.

References clang::clangd::CodeCompleteResult::Completions, clang::clangd::CodeCompleteResult::Context, and clang::clangd::CodeCompleteResult::HasMore.

## ◆ operator==() [1/4]

bool clang::clangd::operator== | ( | const SymbolLocation::Position & | L,
|  | const SymbolLocation::Position & | R
| ) |  |
| inline

Definition at line 74 of file Index.h.

References clang::clangd::SymbolLocation::Position::column(), and clang::clangd::SymbolLocation::Position::line().

## ◆ operator==() [2/4]

bool clang::clangd::operator== | ( | const SymbolLocation & | L,
|  | const SymbolLocation & | R
| ) |  |
| inline

Definition at line 84 of file Index.h.

References clang::clangd::SymbolLocation::End, clang::clangd::SymbolLocation::FileURI, and clang::clangd::SymbolLocation::Start.

## ◆ operator==() [3/4]

bool clang::clangd::operator== | ( | const Ref & | L,
|  | const Ref & | R
| ) |  |
| inline

Definition at line 381 of file Index.h.

References clang::clangd::Ref::Kind, clang::clangd::Ref::Location, and operator<<().

## ◆ operator==() [4/4]

bool clang::clangd::operator== | ( | const SymbolDetails & | LHS,
|  | const SymbolDetails & | RHS
| ) |  |

Definition at line 453 of file Protocol.cpp.

References clang::clangd::SymbolDetails::containerName, clang::clangd::SymbolDetails::ID, clang::clangd::SymbolDetails::name, and clang::clangd::SymbolDetails::USR.

## ◆ operator|() [1/3]

SymbolOrigin clang::clangd::operator| | ( | SymbolOrigin | A,
|  | SymbolOrigin | B
| ) |  |
| inline

Definition at line 134 of file Index.h.

## ◆ operator|() [2/3]

Symbol::SymbolFlag clang::clangd::operator| | ( | Symbol::SymbolFlag | A,
|  | Symbol::SymbolFlag | B
| ) |  |
| inline

Definition at line 251 of file Index.h.

## ◆ operator|() [3/3]

RefKind clang::clangd::operator| | ( | RefKind | L,
|  | RefKind | R
| ) |  |
| inline

Definition at line 358 of file Index.h.

## ◆ operator|=() [1/3]

SymbolOrigin& clang::clangd::operator|= | ( | SymbolOrigin & | A,
|  | SymbolOrigin | B
| ) |  |
| inline

Definition at line 138 of file Index.h.

## ◆ operator|=() [2/3]

Symbol::SymbolFlag& clang::clangd::operator|= | ( | Symbol::SymbolFlag & | A,
|  | Symbol::SymbolFlag | B
| ) |  |
| inline

Definition at line 255 of file Index.h.

References operator<<().

## ◆ operator|=() [3/3]

RefKind& clang::clangd::operator|= | ( | RefKind & | L,
|  | RefKind | R
| ) |  |
| inline

Definition at line 362 of file Index.h.

## ◆ own()

static void clang::clangd::own | ( | Symbol & | S,
|  | llvm::UniqueStringSaver & | Strings
| ) |  |
| static

Definition at line 87 of file Index.cpp.

References visitStrings().

## ◆ packedLookup()

template<typename T >

static T clang::clangd::packedLookup | ( | const uint8_t * | Data,
|  | int | I
| ) |  |
| static

Definition at line 152 of file FuzzyMatch.cpp.

## ◆ PCHStorage()

static llvm::cl::opt<PCHStorageFlag> clang::clangd::PCHStorage | ( | "pch-storage" | ,
|  | llvm::cl::desc("Storing PCHs in memory increases memory usages, but may " "improve performance") | ,
|  | llvm::cl::values(clEnumValN(PCHStorageFlag::Disk, "disk", "store PCHs on disk"), clEnumValN(PCHStorageFlag::Memory, "memory", "store PCHs in memory")) | ,
|  | llvm::cl::init(PCHStorageFlag::Disk) |
| ) |  |
| static

## ◆ positionToOffset()

llvm::Expected< size_t > clang::clangd::positionToOffset | ( | llvm::StringRef | Code,
|  | Position | P,
|  | bool | AllowColumnsBeyondLineLength = `true`
| ) |  |

Turn a [line, column] pair into an offset in Code.

If P.character exceeds the line length, returns the offset at end-of-line. (If !AllowColumnsBeyondLineLength, then returns an error instead). If the line number is out of range, returns an error.

The returned value is in the range [0, Code.size()].

Definition at line 81 of file SourceCode.cpp.

References clang::clangd::Position::character, clang::clangd::Position::line, and measureUTF16().

Referenced by clang::clangd::ClangdServer::formatOnType(), and speculateCompletionFilter().

## ◆ prepareCompilerInstance() [1/2]

std::unique_ptr<CompilerInstance> clang::clangd::prepareCompilerInstance | ( | std::unique_ptr< clang::CompilerInvocation > | CI,
|  | const PrecompiledPreamble * | Preamble,
|  | std::unique_ptr< llvm::MemoryBuffer > | Buffer,
|  | std::shared_ptr< PCHContainerOperations > | PCHs,
|  | llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > | VFS,
|  | DiagnosticConsumer & | DiagsClient
| ) |  |

Definition at line 44 of file Compiler.cpp.

References PCHs, and VFS.

Referenced by clang::clangd::ParsedAST::build().

## ◆ prepareCompilerInstance() [2/2]

std::unique_ptr<CompilerInstance> clang::clangd::prepareCompilerInstance | ( | std::unique_ptr< clang::CompilerInvocation > | ,
|  | const PrecompiledPreamble * | ,
|  | std::unique_ptr< llvm::MemoryBuffer > | MainFile,
|  | std::shared_ptr< PCHContainerOperations > | ,
|  | IntrusiveRefCntPtr< llvm::vfs::FileSystem > | ,
|  | DiagnosticConsumer & |
| ) |  |

Creates a compiler instance, configured so that:

- Contents of the parsed file are remapped to `MainFile`.
- Preamble is overriden to use PCH passed to this function. It means the changes to the preamble headers or files included in the preamble are not visible to this compiler instance.
- llvm::vfs::FileSystem is used for all underlying file accesses. The actual vfs used by the compiler may be an overlay over the passed vfs. Returns null on errors. When non-null value is returned, it is expected to be consumed by FrontendAction::BeginSourceFile to properly destroy `MainFile`.

## ◆ PrettyPrint()

static llvm::cl::opt<bool> clang::clangd::PrettyPrint | ( | "pretty" | ,
|  | llvm::cl::desc("Pretty-print JSON output") | ,
|  | llvm::cl::init(false) |
| ) |  |
| static

Referenced by main().

## ◆ preventThreadStarvationInTests()

void clang::clangd::preventThreadStarvationInTests | ( |  | ) |

Definition at line 142 of file Threading.cpp.

Referenced by main().

## ◆ printingPolicyForDecls()

static PrintingPolicy clang::clangd::printingPolicyForDecls | ( | PrintingPolicy | Base | ) |
| static

Definition at line 460 of file XRefs.cpp.

Referenced by getHoverContents(), namedDeclQualifiedName(), and typeDeclToString().

## ◆ printName()

std::string clang::clangd::printName | ( | const ASTContext & | Ctx,
|  | const NamedDecl & | ND
| ) |  |

Prints unqualified name of the decl for the purpose of displaying it to the user.

Anonymous decls return names of the form "(anonymous {kind})", e.g. "(anonymous struct)" or "(anonymous namespace)".

Definition at line 80 of file AST.cpp.

References Name.

## ◆ printNamespaceScope()

std::string clang::clangd::printNamespaceScope | ( | const DeclContext & | DC | ) |

Returns the first enclosing namespace scope starting from `DC`.

Definition at line 109 of file AST.cpp.

References Ctx, and printQualifiedName().

## ◆ printQualifiedName()

std::string clang::clangd::printQualifiedName | ( | const NamedDecl & | ND | ) |

Returns the qualified name of ND.

The scope doesn't contain unwritten scopes like inline namespaces.

Definition at line 54 of file AST.cpp.

Referenced by printNamespaceScope().

## ◆ quality()

float clang::clangd::quality | ( | const Symbol & | S | ) |

Definition at line 69 of file Index.cpp.

References clang::clangd::detail::log(), and clang::clangd::Symbol::References.

Referenced by visitStrings().

## ◆ readIndexFile()

llvm::Expected< IndexFileIn > clang::clangd::readIndexFile | ( | llvm::StringRef | Data | ) |

Definition at line 540 of file Serialization.cpp.

References clang::clangd::riff::makeError(), readYAML(), and clang::tidy::cppcoreguidelines::toString().

## ◆ readYAML()

llvm::Expected< IndexFileIn > clang::clangd::readYAML | ( | llvm::StringRef | Data | ) |

Definition at line 310 of file YAMLSerialization.cpp.

Referenced by readIndexFile().

## ◆ replacementsToEdits() [1/2]

std::vector<TextEdit> clang::clangd::replacementsToEdits | ( | StringRef | Code,
|  | const tooling::Replacements & | Repls
| ) |  |

## ◆ replacementsToEdits() [2/2]

std::vector<TextEdit> clang::clangd::replacementsToEdits | ( | llvm::StringRef | Code,
|  | const tooling::Replacements & | Repls
| ) |  |

Definition at line 179 of file SourceCode.cpp.

## ◆ replacementToEdit() [1/2]

TextEdit clang::clangd::replacementToEdit | ( | StringRef | Code,
|  | const tooling::Replacement & | R
| ) |  |

## ◆ replacementToEdit() [2/2]

TextEdit clang::clangd::replacementToEdit | ( | llvm::StringRef | Code,
|  | const tooling::Replacement & | R
| ) |  |

Definition at line 171 of file SourceCode.cpp.

References offsetToPosition().

## ◆ ResourceDir()

static llvm::cl::opt<Path> clang::clangd::ResourceDir | ( | "resource-dir" | ,
|  | llvm::cl::desc("Directory for system clang headers") | ,
|  | llvm::cl::init("") | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

Referenced by clang::clangd::ClangdServer::dynamicIndex().

## ◆ runAsync()

template<typename T >

std::future<T> clang::clangd::runAsync | ( | llvm::unique_function< T()> | Action | ) |

Runs `Action` asynchronously with a new std::thread.

The context will be propagated.

Definition at line 228 of file TUScheduler.h.

References Action, clang::clangd::Context::clone(), Ctx, and clang::clangd::Context::current().

Referenced by clang::clangd::AsyncTaskRunner::wait().

## ◆ RunSynchronously()

static llvm::cl::opt<bool> clang::clangd::RunSynchronously | ( | "run-synchronously" | ,
|  | llvm::cl::desc("Parse on main thread. If set, -j is ignored") | ,
|  | llvm::cl::init(false) | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

Referenced by main().

## ◆ scopeBoost()

static float clang::clangd::scopeBoost | ( | ScopeDistance & | Distance,
|  | llvm::Optional< llvm::StringRef > | SymbolScope
| ) |  |
| static

Definition at line 329 of file Quality.cpp.

References D, clang::clangd::ScopeDistance::distance(), and clang::clangd::FileDistance::Unreachable.

Referenced by clang::clangd::SymbolRelevanceSignals::evaluate(), and operator<<().

## ◆ scopeToPath()

static std::pair<std::string, int> clang::clangd::scopeToPath | ( | llvm::StringRef | Scope | ) |
| static

Definition at line 180 of file FileDistance.cpp.

References clang::tidy::cppcoreguidelines::join().

Referenced by clang::clangd::ScopeDistance::distance().

## ◆ setCurrentThreadPriority()

void clang::clangd::setCurrentThreadPriority | ( | ThreadPriority | Priority | ) |

Definition at line 118 of file Threading.cpp.

References Low.

Referenced by clang::clangd::BackgroundIndex::stop().

## ◆ ShowOrigins()

static llvm::cl::opt<bool> clang::clangd::ShowOrigins | ( | "debug-origin" | ,
|  | llvm::cl::desc("Show origins of completion items") | ,
|  | llvm::cl::init(CodeCompleteOptions().ShowOrigins) | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

## ◆ signatureHelp() [1/2]

SignatureHelp clang::clangd::signatureHelp | ( | PathRef | FileName,
|  | const tooling::CompileCommand & | Command,
|  | const PreambleData * | Preamble,
|  | StringRef | Contents,
|  | Position | Pos,
|  | IntrusiveRefCntPtr< llvm::vfs::FileSystem > | VFS,
|  | std::shared_ptr< PCHContainerOperations > | PCHs,
|  | const SymbolIndex * | Index
| ) |  |

Get signature help at a specified `Pos` in `FileName`.

## ◆ signatureHelp() [2/2]

SignatureHelp clang::clangd::signatureHelp | ( | PathRef | FileName,
|  | const tooling::CompileCommand & | Command,
|  | const PreambleData * | Preamble,
|  | llvm::StringRef | Contents,
|  | Position | Pos,
|  | llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > | VFS,
|  | std::shared_ptr< PCHContainerOperations > | PCHs,
|  | const SymbolIndex * | Index
| ) |  |

Definition at line 1628 of file CodeComplete.cpp.

References Command, Contents, FileName, Pos, Preamble, and Result.

Referenced by clang::clangd::ClangdServer::signatureHelp().

## ◆ sortText()

std::string clang::clangd::sortText | ( | float | Score,
|  | llvm::StringRef | Tiebreak = `""`
| ) |  |

Returns a string that sorts in the same order as (-Score, Tiebreak), for LSP.

(The highest score compares smallest so it sorts at the top).

Definition at line 452 of file Quality.cpp.

References encodeFloat(), Lower, and Name.

Referenced by clang::clangd::TopN< T, Compare >::items().

## ◆ sourceLocToPosition()

Position clang::clangd::sourceLocToPosition | ( | const SourceManager & | SM,
|  | SourceLocation | Loc
| ) |  |

Turn a SourceLocation into a [line, column] pair.

FIXME: This should return an error if the location is invalid.

Definition at line 128 of file SourceCode.cpp.

## ◆ speculateCompletionFilter()

llvm::Expected< llvm::StringRef > clang::clangd::speculateCompletionFilter | ( | llvm::StringRef | Content,
|  | Position | Pos
| ) |  |

Retrives a speculative code completion filter text before the cursor.

Exposed for testing only.

Definition at line 1592 of file CodeComplete.cpp.

References positionToOffset().

## ◆ splitQualifiedName()

std::pair< llvm::StringRef, llvm::StringRef > clang::clangd::splitQualifiedName | ( | llvm::StringRef | QName | ) |

From "a::b::c", return {"a::b::", "c"}.

Scope is empty if there's no qualifier.

Definition at line 164 of file SourceCode.cpp.

References Pos.

## ◆ Test()

static llvm::cl::opt<bool> clang::clangd::Test | ( | "lit-test" | ,
|  | llvm::cl::desc("Abbreviation for -input-style=delimited -pretty " "-run-synchronously -enable-test-scheme. " "Intended to simplify lit tests.") | ,
|  | llvm::cl::init(false) | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

Referenced by main().

## ◆ timeoutSeconds()

Deadline clang::clangd::timeoutSeconds | ( | llvm::Optional< double > | Seconds | ) |

Makes a deadline from a timeout in seconds. None means wait forever.

Definition at line 99 of file Threading.cpp.

References clang::clangd::Deadline::infinity().

Referenced by clang::clangd::BackgroundIndex::blockUntilIdleForTest(), clang::clangd::ClangdServer::blockUntilIdleForTest(), and clang::clangd::Deadline::operator==().

## ◆ toCodeAction()

CodeAction clang::clangd::toCodeAction | ( | const Fix & | F,
|  | const URIForFile & | File
| ) |  |

Convert from Fix to LSP CodeAction.

Definition at line 232 of file Diagnostics.cpp.

References Action, clang::clangd::CodeAction::edit, clang::clangd::Fix::Edits, clang::clangd::CodeAction::kind, clang::clangd::Fix::Message, clang::clangd::CodeAction::QUICKFIX_KIND, clang::clangd::CodeAction::title, and clang::clangd::URIForFile::uri().

Referenced by asCommand().

## ◆ toJSON() [1/25]

llvm::json::Value clang::clangd::toJSON | ( | const URIForFile & | U | ) |

Serialize/deserialize `URIForFile` to/from a string URI.

Definition at line 77 of file Protocol.cpp.

References clang::clangd::URIForFile::uri().

## ◆ toJSON() [2/25]

llvm::json::Value clang::clangd::toJSON | ( | const TextDocumentIdentifier & | R | ) |

Definition at line 83 of file Protocol.cpp.

References clang::clangd::TextDocumentIdentifier::uri.

## ◆ toJSON() [3/25]

llvm::json::Value clang::clangd::toJSON | ( | const Position & | P | ) |

Definition at line 97 of file Protocol.cpp.

References clang::clangd::Position::character, and clang::clangd::Position::line.

## ◆ toJSON() [4/25]

llvm::json::Value clang::clangd::toJSON | ( | const Range & | P | ) |

Definition at line 113 of file Protocol.cpp.

References clang::clangd::Range::end, and clang::clangd::Range::start.

## ◆ toJSON() [5/25]

llvm::json::Value clang::clangd::toJSON | ( | const Location & | P | ) |

Definition at line 124 of file Protocol.cpp.

References clang::clangd::Location::range, and clang::clangd::Location::uri.

## ◆ toJSON() [6/25]

llvm::json::Value clang::clangd::toJSON | ( | const TextEdit & | P | ) |

Definition at line 146 of file Protocol.cpp.

References clang::clangd::TextEdit::newText, and clang::clangd::TextEdit::range.

## ◆ toJSON() [7/25]

llvm::json::Value clang::clangd::toJSON | ( | const FuzzyFindRequest & | Request | ) |

Definition at line 189 of file Index.cpp.

References clang::clangd::FuzzyFindRequest::AnyScope, clang::clangd::FuzzyFindRequest::Limit, clang::clangd::FuzzyFindRequest::ProximityPaths, clang::clangd::FuzzyFindRequest::Query, clang::clangd::FuzzyFindRequest::RestrictForCodeCompletion, and clang::clangd::FuzzyFindRequest::Scopes.

Referenced by clang::clangd::Range::contains(), clang::clangd::FuzzyFindRequest::operator!=(), operator<<(), clang::clangd::TextEdit::operator==(), and toJSON().

## ◆ toJSON() [8/25]

llvm::json::Value clang::clangd::toJSON | ( | const FormattingOptions & | P | ) |

Definition at line 330 of file Protocol.cpp.

References clang::clangd::FormattingOptions::insertSpaces, and clang::clangd::FormattingOptions::tabSize.

## ◆ toJSON() [9/25]

llvm::json::Value clang::clangd::toJSON | ( | const Diagnostic & | D | ) |

Definition at line 363 of file Protocol.cpp.

References clang::clangd::Diagnostic::category, clang::clangd::Diagnostic::codeActions, clang::clangd::Diagnostic::message, clang::clangd::Diagnostic::range, and clang::clangd::Diagnostic::severity.

## ◆ toJSON() [10/25]

llvm::json::Value clang::clangd::toJSON | ( | const SymbolInformation & | P | ) |

Definition at line 438 of file Protocol.cpp.

References clang::clangd::SymbolInformation::containerName, clang::clangd::SymbolInformation::kind, clang::clangd::SymbolInformation::location, and clang::clangd::SymbolInformation::name.

## ◆ toJSON() [11/25]

llvm::json::Value clang::clangd::toJSON | ( | const SymbolDetails & | P | ) |

Definition at line 458 of file Protocol.cpp.

References clang::clangd::SymbolDetails::containerName, clang::clangd::SymbolDetails::ID, clang::clangd::SymbolDetails::name, and clang::clangd::SymbolDetails::USR.

## ◆ toJSON() [12/25]

llvm::json::Value clang::clangd::toJSON | ( | const Command & | C | ) |

Definition at line 497 of file Protocol.cpp.

References clang::clangd::CodeAction::QUICKFIX_KIND.

## ◆ toJSON() [13/25]

llvm::json::Value clang::clangd::toJSON | ( | const CodeAction & | CA | ) |

Definition at line 506 of file Protocol.cpp.

References clang::clangd::CodeAction::command, clang::clangd::CodeAction::diagnostics, clang::clangd::CodeAction::edit, clang::clangd::CodeAction::kind, and clang::clangd::CodeAction::title.

## ◆ toJSON() [14/25]

llvm::json::Value clang::clangd::toJSON | ( | const DocumentSymbol & | S | ) |

Definition at line 523 of file Protocol.cpp.

References clang::clangd::DocumentSymbol::children, clang::clangd::DocumentSymbol::deprecated, clang::clangd::DocumentSymbol::detail, clang::clangd::DocumentSymbol::kind, clang::clangd::DocumentSymbol::name, clang::clangd::DocumentSymbol::range, Result, and clang::clangd::DocumentSymbol::selectionRange.

## ◆ toJSON() [15/25]

llvm::json::Value clang::clangd::toJSON | ( | const WorkspaceEdit & | WE | ) |

Definition at line 539 of file Protocol.cpp.

References clang::clangd::WorkspaceEdit::changes.

## ◆ toJSON() [16/25]

llvm::json::Value clang::clangd::toJSON | ( | const ApplyWorkspaceEditParams & | Params | ) |

Definition at line 548 of file Protocol.cpp.

References clang::clangd::ApplyWorkspaceEditParams::edit.

## ◆ toJSON() [17/25]

llvm::json::Value clang::clangd::toJSON | ( | const MarkupContent & | MC | ) |

Definition at line 591 of file Protocol.cpp.

References clang::clangd::MarkupContent::kind, toTextKind(), and clang::clangd::MarkupContent::value.

## ◆ toJSON() [18/25]

llvm::json::Value clang::clangd::toJSON | ( | const Hover & | H | ) |

Definition at line 601 of file Protocol.cpp.

References clang::clangd::Hover::contents, clang::clangd::Hover::range, Result, and toJSON().

## ◆ toJSON() [19/25]

llvm::json::Value clang::clangd::toJSON | ( | const CompletionItem & | CI | ) |

Definition at line 655 of file Protocol.cpp.

References clang::clangd::CompletionItem::additionalTextEdits, clang::clangd::CompletionItem::deprecated, clang::clangd::CompletionItem::detail, clang::clangd::CompletionItem::documentation, clang::clangd::CompletionItem::filterText, clang::clangd::CompletionItem::insertText, clang::clangd::CompletionItem::insertTextFormat, clang::clangd::CompletionItem::kind, clang::clangd::CompletionItem::label, Missing, Result, clang::clangd::CompletionItem::sortText, and clang::clangd::CompletionItem::textEdit.

## ◆ toJSON() [20/25]

llvm::json::Value clang::clangd::toJSON | ( | const CompletionList & | L | ) |

Definition at line 691 of file Protocol.cpp.

References clang::clangd::CompletionList::isIncomplete, and clang::clangd::CompletionList::items.

## ◆ toJSON() [21/25]

llvm::json::Value clang::clangd::toJSON | ( | const ParameterInformation & | PI | ) |

Definition at line 698 of file Protocol.cpp.

References clang::clangd::ParameterInformation::documentation, clang::clangd::ParameterInformation::label, and Result.

## ◆ toJSON() [22/25]

llvm::json::Value clang::clangd::toJSON | ( | const SignatureInformation & | SI | ) |

Definition at line 706 of file Protocol.cpp.

References clang::clangd::SignatureInformation::documentation, clang::clangd::SignatureInformation::label, clang::clangd::SignatureInformation::parameters, and Result.

## ◆ toJSON() [23/25]

llvm::json::Value clang::clangd::toJSON | ( | const SignatureHelp & | SH | ) |

Definition at line 723 of file Protocol.cpp.

References clang::clangd::SignatureHelp::activeParameter, clang::clangd::SignatureHelp::activeSignature, and clang::clangd::SignatureHelp::signatures.

## ◆ toJSON() [24/25]

llvm::json::Value clang::clangd::toJSON | ( | const DocumentHighlight & | DH | ) |

Definition at line 741 of file Protocol.cpp.

References clang::clangd::DocumentHighlight::kind, clang::clangd::DocumentHighlight::range, and toJSON().

## ◆ toJSON() [25/25]

llvm::json::Value clang::clangd::toJSON | ( | const FileStatus & | FStatus | ) |

Definition at line 748 of file Protocol.cpp.

References clang::clangd::FileStatus::state, and clang::clangd::FileStatus::uri.

## ◆ toLSPDiags()

void clang::clangd::toLSPDiags | ( | const Diag & | D,
|  | const URIForFile & | File,
|  | const ClangdDiagnosticOptions & | Opts,
|  | llvm::function_ref< void(clangd::Diagnostic, llvm::ArrayRef< Fix >)> | OutFn
| ) |  |

Conversion to LSP diagnostics.

Formats the error message of each diagnostic to include all its notes. Notes inside main file are also provided as separate diagnostics with their corresponding fixits. Notes outside main file do not have a corresponding LSP diagnostic, but can still be included as part of their main diagnostic's message.

Definition at line 242 of file Diagnostics.cpp.

## ◆ toTextEdit()

TextEdit clang::clangd::toTextEdit | ( | const FixItHint & | FixIt,
|  | const SourceManager & | M,
|  | const LangOptions & | L
| ) |  |

Definition at line 226 of file SourceCode.cpp.

References halfOpenToRange(), clang::clangd::TextEdit::newText, clang::clangd::TextEdit::range, and Result.

Referenced by clang::clangd::StoreDiags::HandleDiagnostic().

## ◆ toTextKind()

static llvm::StringRef clang::clangd::toTextKind | ( | MarkupKind | Kind | ) |
| static

Definition at line 581 of file Protocol.cpp.

References Markdown, and PlainText.

Referenced by toJSON().

## ◆ toYAML() [1/3]

std::string clang::clangd::toYAML | ( | const Symbol & | S | ) |

Definition at line 338 of file YAMLSerialization.cpp.

Referenced by clang::clangd::IndexFileOut::IndexFileOut().

## ◆ toYAML() [2/3]

std::string clang::clangd::toYAML | ( | const std::pair< SymbolID, ArrayRef< Ref >> & |  | ) |

## ◆ toYAML() [3/3]

std::string clang::clangd::toYAML | ( | const std::pair< SymbolID, llvm::ArrayRef< Ref >> & | Data | ) |

Definition at line 349 of file YAMLSerialization.cpp.

## ◆ typeDeclToString()

static std::string clang::clangd::typeDeclToString | ( | const TypeDecl * | TD | ) |
| static

Return a string representation (e.g.

"class MyNamespace::MyClass") of the type declaration `TD`.

Definition at line 474 of file XRefs.cpp.

References Name, and printingPolicyForDecls().

Referenced by getScopeName().

## ◆ uriProximity()

static std::pair<float, unsigned> clang::clangd::uriProximity | ( | llvm::StringRef | SymbolURI,
|  | URIDistance * | D
| ) |  |
| static

Definition at line 320 of file Quality.cpp.

References clang::clangd::URIDistance::distance(), and clang::tidy::bugprone::f().

Referenced by clang::clangd::SymbolRelevanceSignals::evaluate(), and operator<<().

## ◆ UseDex()

static llvm::cl::opt<bool> clang::clangd::UseDex | ( | "use-dex-index" | ,
|  | llvm::cl::desc("Use experimental Dex dynamic index.") | ,
|  | llvm::cl::init(false) | ,
|  | llvm::cl::Hidden |
| ) |  |
| static

Referenced by clang::clangd::IndexFileOut::IndexFileOut().

## ◆ visitStrings()

template<typename Callback >

void clang::clangd::visitStrings | ( | Symbol & | S,
|  | const Callback & | CB
| ) |  |

Definition at line 263 of file Index.h.

References clang::clangd::Symbol::CanonicalDeclaration, clang::clangd::Symbol::CompletionSnippetSuffix, clang::clangd::Symbol::Definition, clang::clangd::Symbol::Documentation, clang::clangd::SymbolLocation::FileURI, clang::clangd::Symbol::IncludeHeaders, clang::clangd::Symbol::Name, quality(), clang::clangd::Symbol::ReturnType, clang::clangd::Symbol::Scope, clang::clangd::Symbol::Signature, and clang::clangd::Symbol::Type.

Referenced by own().

## ◆ vlog()

template<typename... Ts>

void clang::clangd::vlog | ( | const char * | Fmt,
|  | Ts &&... | Vals
| ) |  |

Definition at line 68 of file Logger.h.

References clang::clangd::detail::log(), and clang::clangd::Logger::Verbose.

Referenced by buildPreamble().

## ◆ wait() [1/2]

template<typename Func >

LLVM_NODISCARD bool clang::clangd::wait | ( | std::unique_lock< std::mutex > & | Lock,
|  | std::condition_variable & | CV,
|  | Deadline | D,
|  | Func | F
| ) |  |

Waits on a condition variable until F() is true or D expires.

Definition at line 92 of file Threading.h.

References clang::clangd::Deadline::expired(), and clang::clangd::Notification::wait().

## ◆ wait() [2/2]

void clang::clangd::wait | ( | std::unique_lock< std::mutex > & | Lock,
|  | std::condition_variable & | CV,
|  | Deadline | D
| ) |  |

Wait once on CV for the specified duration.

Definition at line 107 of file Threading.cpp.

References clang::clangd::Deadline::infinity(), clang::clangd::Deadline::time(), and clang::clangd::Deadline::zero().

Referenced by clang::clangd::BackgroundIndex::blockUntilIdleForTest(), clang::clangd::AsyncTaskRunner::wait(), and clang::clangd::AsyncTaskRunner::~AsyncTaskRunner().

## ◆ WorkerThreadsCount()

static llvm::cl::opt<unsigned> clang::clangd::WorkerThreadsCount | ( | "j" | ,
|  | llvm::cl::desc("Number of async workers used by clangd") | ,
|  | llvm::cl::init(getDefaultAsyncThreadsCount()) |
| ) |  |
| static

Referenced by main().

## ◆ writeYAML()

void clang::clangd::writeYAML | ( | const IndexFileOut & | O,
|  | llvm::raw_ostream & | OS
| ) |  |

Definition at line 295 of file YAMLSerialization.cpp.

References clang::clangd::IndexFileOut::Refs, and clang::clangd::IndexFileOut::Symbols.

Referenced by operator<<().

## ◆ xpcToJson()

llvm::json::Value clang::clangd::xpcToJson | ( | const xpc_object_t & | XPCObject | ) |

Definition at line 27 of file Conversion.cpp.

References elog(), and clang::tidy::cppcoreguidelines::toString().

Referenced by dumpXPCObject().

## Variable Documentation

## ◆ AvoidThreadStarvation

std::atomic<bool> clang::clangd::AvoidThreadStarvation = {false}
| static

Definition at line 116 of file Threading.cpp.

## ◆ AwfulScore

constexpr int clang::clangd::AwfulScore = -(1 << 13)
| static

Definition at line 73 of file FuzzyMatch.cpp.

Referenced by calculateRoles(), and clang::clangd::FuzzyMatcher::FuzzyMatcher().

## ◆ CharRoles

constexpr uint8_t clang::clangd::CharRoles[]
| static

Initial value:
= {
0x00, 0xaa, 0xaa, 0xff,
0x00, 0x55, 0xaa, 0xff,
0x00, 0x55, 0x59, 0xff,
0x00, 0xaa, 0xaa, 0xff,
}

Definition at line 142 of file FuzzyMatch.cpp.

Referenced by calculateRoles().

## ◆ CharTypes

constexpr uint8_t clang::clangd::CharTypes[]
| static

Initial value:
= {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff,
0x55, 0x55, 0xf5, 0xff,
0xab, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xea, 0xff,
0x57, 0x55, 0x55, 0x55,
0x55, 0x55, 0xd5, 0x3f,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
}

Definition at line 115 of file FuzzyMatch.cpp.

Referenced by calculateRoles().

## ◆ CompletionItemKindMax

constexpr auto clang::clangd::CompletionItemKindMax

Initial value:
=
static_cast<size_t>(CompletionItemKind::TypeParameter)

Definition at line 290 of file Protocol.h.

## ◆ CompletionItemKindMin

constexpr auto clang::clangd::CompletionItemKindMin

Initial value:
=
static_cast<size_t>(CompletionItemKind::Text)

Definition at line 288 of file Protocol.h.

Referenced by adjustKindToCapability().

## ◆ FlagKey

Key<std::shared_ptr<std::atomic<bool> > > clang::clangd::FlagKey
| static

Definition at line 17 of file Cancellation.cpp.

## ◆ kFileBeingProcessed

clang::clangd::Key<std::string> clang::clangd::kFileBeingProcessed
| static

Definition at line 67 of file TUScheduler.cpp.

## ◆ PerfectBonus

constexpr int clang::clangd::PerfectBonus = 3
| static

Definition at line 75 of file FuzzyMatch.cpp.

## ◆ SymbolKindMax

constexpr auto clang::clangd::SymbolKindMax = static_cast<size_t>(SymbolKind::TypeParameter)

Definition at line 329 of file Protocol.h.

## ◆ SymbolKindMin

constexpr auto clang::clangd::SymbolKindMin = static_cast<size_t>(SymbolKind::File)

Definition at line 328 of file Protocol.h.

Referenced by adjustKindToCapability().