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

Namespaces

 detail
 
 dex
 
 riff
 
 trace
 

Classes

class  Annotations
 Same as llvm::Annotations, but adjusts functions to LSP-specific types for positions and ranges. More...
 
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  BackgroundIndexRebuilder
 
class  BackgroundIndexRebuilderTest
 
class  BackgroundIndexStorage
 
class  BackgroundIndexTest
 
class  BackgroundQueue
 
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  CheapUnresolvedName
 
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  CompletionPrefix
 
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  DefinedMacro
 
struct  Diag
 A top-level diagnostic that may have Notes and Fixes. More...
 
struct  DiagBase
 Contains basic information about a diagnostic. More...
 
struct  Diagnostic
 
struct  DiagnosticRelatedInformation
 Represents a related message and source code location for a diagnostic. More...
 
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...
 
class  FormattedString
 A structured string representation that could be converted to markdown or plaintext upon requrest. More...
 
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  HighlightingToken
 
struct  Hover
 
struct  HoverInfo
 Contains detailed information about a Symbol. More...
 
class  IgnoreDiagnostics
 
class  IncludeFixer
 Attempts to recover from error diagnostics by suggesting include insertion fixes. More...
 
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  LoadedShard
 Represents a shard loaded from storage, stores contents in Shard and metadata about the source file that generated this shard. More...
 
struct  LocatedSymbol
 
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  MemoryShardStorage
 
class  MergedIndex
 
class  MockCompilationDatabase
 
class  MockFSProvider
 
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  OptionalMatcher
 
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...
 
struct  ParseOptions
 
class  ParsingCallbacks
 
class  PolySubsequenceMatcher
 
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
 Represents a symbol occurrence in the source file. More...
 
struct  ReferenceParams
 
class  RefSlab
 An efficient structure of storing large set of symbol references in memory. More...
 
struct  RefsRequest
 
struct  Relation
 Represents a relation between two symbols. More...
 
class  RelationSlab
 
struct  RelationsRequest
 
struct  RenameParams
 
struct  ResolveTypeHierarchyItemParams
 Parameters for the typeHierarchy/resolve request. More...
 
class  ScopeDistance
 Support lookups like FileDistance, but the lookup keys are symbol scopes. More...
 
class  SelectionTree
 
struct  SemanticHighlightingInformation
 Represents a semantic highlighting information that has to be applied on a specific line of the text document. More...
 
struct  SemanticHighlightingParams
 Parameters for the semantic highlighting (server-side) push notification. More...
 
class  Semaphore
 Limits the number of threads that can acquire the lock at the same time. More...
 
struct  ShowMessageParams
 The show message notification is sent from a server to a client to ask the client to display a particular message in the user interface. 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  SubsequenceMatcher
 
class  SwapIndex
 
struct  Symbol
 The class presents a C++ symbol, e.g. More...
 
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
 An immutable symbol container that stores a set of symbols. More...
 
class  TestScheme
 unittest: is a scheme that refers to files relative to testRoot(). More...
 
struct  TestTU
 
struct  TextDocumentContentChangeEvent
 
struct  TextDocumentIdentifier
 
struct  TextDocumentItem
 
struct  TextDocumentPositionParams
 
struct  TextEdit
 
class  ThreadingTest
 
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  Tweak
 An interface base for small context-sensitive refactoring actions. More...
 
struct  TweakArgs
 Arguments for the 'applyTweak' command. More...
 
struct  TypeHierarchyItem
 
struct  TypeHierarchyParams
 The type hierarchy params is an extension of the TextDocumentPositionsParams with optional properties which can be used to eagerly resolve the item when requesting from the server. More...
 
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 ClangTidyOptionsBuilder = std::function< tidy::ClangTidyOptions(llvm::vfs::FileSystem &, llvm::StringRef)>
 When set, used by ClangdServer to get clang-tidy options for each particular file. More...
 
using PreambleParsedCallback = std::function< void(ASTContext &, std::shared_ptr< clang::Preprocessor >, const CanonicalIncludes &)>
 
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 SlabTuple = std::tuple< SymbolSlab, RefSlab, RelationSlab >
 
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 >
 
typedef llvm::Registry< TweakTweakRegistry
 A handy typedef to save some typing. More...
 
using FileDigest = std::array< uint8_t, 8 >
 
typedef llvm::Registry< URISchemeURISchemeRegistry
 By default, a "file" scheme is supported where URI paths are always absolute in the file system. More...
 
using RecursionProtectionSet = llvm::SmallSet< const CXXRecordDecl *, 4 >
 

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  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
}
 Describes the kind of a cross-reference. More...
 
enum  IndexFileFormat { IndexFileFormat::RIFF, IndexFileFormat::YAML }
 
enum  RelationKind : uint8_t { RelationKind::BaseOf }
 
enum  SymbolOrigin : uint8_t {
  SymbolOrigin::Unknown = 0, SymbolOrigin::AST = 1 << 0, SymbolOrigin::Dynamic = 1 << 1, SymbolOrigin::Static = 1 << 2,
  SymbolOrigin::Merge = 1 << 3, SymbolOrigin::Identifier = 1 << 4
}
 
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  OffsetEncoding { OffsetEncoding::UnsupportedEncoding, OffsetEncoding::UTF16, OffsetEncoding::UTF8, OffsetEncoding::UTF32 }
 
enum  MarkupKind { MarkupKind::PlainText, MarkupKind::Markdown }
 
enum  MessageType { MessageType::Error = 1, MessageType::Warning = 2, MessageType::Info = 3, MessageType::Log = 4 }
 
enum  FileChangeType { FileChangeType::Created = 1, FileChangeType::Changed = 2, FileChangeType::Deleted = 3 }
 
enum  CompletionTriggerKind { CompletionTriggerKind::Invoked = 1, CompletionTriggerKind::TriggerCharacter = 2, CompletionTriggerKind::TriggerTriggerForIncompleteCompletions = 3 }
 
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  TypeHierarchyDirection { TypeHierarchyDirection::Children = 0, TypeHierarchyDirection::Parents = 1, TypeHierarchyDirection::Both = 2 }
 
enum  HighlightingKind {
  HighlightingKind::Variable = 0, HighlightingKind::Function, HighlightingKind::Method, HighlightingKind::Field,
  HighlightingKind::Class, HighlightingKind::Enum, HighlightingKind::EnumConstant, HighlightingKind::Namespace,
  HighlightingKind::TemplateParameter, HighlightingKind::NumKinds
}
 
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...
 
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 printTemplateSpecializationArgs (const NamedDecl &ND)
 Prints template arguments of a decl as written in the source code, including enclosing '<' and '>', e.g for a partial specialization like: template <typename u>=""> struct Foo<int, U> will return '<int, U>'. More...
 
std::string printNamespaceScope (const DeclContext &DC)
 Returns the first enclosing namespace scope starting from DC. More...
 
llvm::Optional< SymbolIDgetSymbolID (const Decl *D)
 Gets the symbol ID for a declaration, if possible. More...
 
llvm::Optional< SymbolIDgetSymbolID (const IdentifierInfo &II, const MacroInfo *MI, const SourceManager &SM)
 Gets the symbol ID for a macro, if possible. More...
 
std::string shortenNamespace (const llvm::StringRef OriginalName, const llvm::StringRef CurrentNamespace)
 Try to shorten the OriginalName by removing namespaces from the left of the string that are redundant in the CurrentNamespace. More...
 
std::string printType (const QualType QT, const DeclContext &Context)
 Returns a QualType as string. More...
 
std::pair< Context, CancelercancelableTask ()
 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< SymbolInformationflattenSymbolHierarchy (llvm::ArrayRef< DocumentSymbol > Symbols, const URIForFile &FileURI)
 The functions constructs a flattened view of the DocumentSymbol hierarchy. More...
 
static llvm::Optional< CommandasCommand (const CodeAction &Action)
 
static LocationgetToggle (const TextDocumentPositionParams &Point, LocatedSymbol &Sym)
 
static llvm::Expected< Tweak::SelectiontweakSelection (const Range &Sel, const InputsAndAST &AST)
 
void dumpAST (ParsedAST &AST, llvm::raw_ostream &OS)
 For testing/debugging purposes. More...
 
std::shared_ptr< const PreambleDatabuildPreamble (PathRef FileName, CompilerInvocation &CI, std::shared_ptr< const PreambleData > OldPreamble, const tooling::CompileCommand &OldCompileCommand, const ParseInputs &Inputs, bool StoreInMemory, PreambleParsedCallback PreambleCallback)
 Rebuild the preamble for the new inputs unless the old one can be reused. More...
 
llvm::Optional< ParsedASTbuildAST (PathRef FileName, std::unique_ptr< CompilerInvocation > Invocation, const ParseInputs &Inputs, std::shared_ptr< const PreambleData > Preamble)
 Build an AST from provided user inputs. More...
 
SourceLocation getBeginningOfIdentifier (const ParsedAST &Unit, const Position &Pos, const FileID FID)
 Get the beginning SourceLocation at a specified Pos. More...
 
CompletionPrefix guessCompletionPrefix (llvm::StringRef Content, unsigned Offset)
 
CodeCompleteResult codeComplete (PathRef FileName, const tooling::CompileCommand &Command, const PreambleData *Preamble, llvm::StringRef Contents, Position Pos, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, 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, 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, CodeCompleteOptions Opts, SpeculativeFuzzyFind *SpecFuzzyFind=nullptr)
 Gets 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, 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, bool CompletingPattern=false)
 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< CompilerInvocation > buildCompilerInvocation (const ParseInputs &Inputs)
 Builds compiler invocation that could be used to build AST or preamble. More...
 
std::unique_ptr< CompilerInstance > prepareCompilerInstance (std::unique_ptr< clang::CompilerInvocation > CI, const PrecompiledPreamble *Preamble, std::unique_ptr< llvm::MemoryBuffer > Buffer, 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, IntrusiveRefCntPtr< llvm::vfs::FileSystem >, DiagnosticConsumer &)
 Creates a compiler instance, configured so that: More...
 
static ContextcurrentContext ()
 
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 void writeCodeToFixMessage (llvm::raw_ostream &OS, llvm::StringRef Code)
 Sanitizes a piece for presenting it in a synthesized fix message. 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< LocationsymbolToLocation (const Symbol &Sym, llvm::StringRef HintPath)
 Helper function for deriving an LSP Location for a Symbol. More...
 
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...
 
std::vector< tooling::Replacement > formatIncremental (llvm::StringRef Code, unsigned Cursor, llvm::StringRef InsertedText, format::FormatStyle Style)
 Applies limited formatting around new InsertedText. More...
 
unsigned transformCursorPosition (unsigned Offset, const std::vector< tooling::Replacement > &Replacements)
 Determine the new cursor position after applying Replacements. More...
 
Path removeDots (PathRef File)
 Returns a version of File that doesn't contain dots and dot dots. 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 ()
 
static std::string maybeCaseFoldPath (PathRef Path)
 
static bool pathEqual (PathRef A, PathRef B)
 
std::unique_ptr< GlobalCompilationDatabasegetQueryDriverDatabase (llvm::ArrayRef< std::string > QueryDriverGlobs, std::unique_ptr< GlobalCompilationDatabase > Base)
 Extracts system include search path from drivers matching QueryDriverGlobs and adds them to the compile flags. More...
 
bool isLiteralInclude (llvm::StringRef Include)
 Returns true if Include is literal include like "path" or <path>. More...
 
llvm::Expected< HeaderFiletoHeaderFile (llvm::StringRef Header, llvm::StringRef HintPath)
 Creates a HeaderFile from Header which can be either a URI or a literal include. More...
 
llvm::SmallVector< llvm::StringRef, 1 > getRankedIncludes (const Symbol &Sym)
 
std::unique_ptr< PPCallbackscollectIncludeStructureCallback (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)
 
IncludeGraphNode::SourceFlag operator| (IncludeGraphNode::SourceFlag A, IncludeGraphNode::SourceFlag B)
 
bool operator & (IncludeGraphNode::SourceFlag A, IncludeGraphNode::SourceFlag B)
 
IncludeGraphNode::SourceFlagoperator|= (IncludeGraphNode::SourceFlag &A, IncludeGraphNode::SourceFlag B)
 
llvm::Optional< std::string > qualifiedByUnresolved (const SourceManager &SM, SourceLocation Loc, const LangOptions &LangOpts)
 
llvm::Optional< CheapUnresolvedNameextractUnresolvedNameCheaply (const SourceManager &SM, const DeclarationNameInfo &Unresolved, CXXScopeSpec *SS, const LangOptions &LangOpts, bool UnresolvedIsSpecifier)
 
static llvm::StringRef filenameWithoutExtension (llvm::StringRef Path)
 
std::vector< LoadedShardloadIndexShards (llvm::ArrayRef< Path > MainFiles, BackgroundIndexStorage::Factory &IndexStorageFactory, const GlobalCompilationDatabase &CDB)
 Loads all shards for the TU MainFile from Storage. More...
 
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, const LangOptions &Language)
 Adds mapping for system headers and some special symbols (e.g. More...
 
static SlabTuple indexSymbols (ASTContext &AST, std::shared_ptr< Preprocessor > PP, llvm::ArrayRef< Decl *> DeclsToIndex, const CanonicalIncludes &Includes, bool IsIndexMainAST)
 
SlabTuple indexMainDecls (ParsedAST &AST)
 Retrieves symbols and refs of local top level decls in AST (i.e. More...
 
SlabTuple indexHeaderSymbols (ASTContext &AST, std::shared_ptr< Preprocessor > PP, const CanonicalIncludes &Includes)
 Idex declarations from AST and macros from PP that are declared in included headers. More...
 
bool fromJSON (const llvm::json::Value &Parameters, FuzzyFindRequest &Request)
 
llvm::json::Value toJSON (const FuzzyFindRequest &Request)
 
std::unique_ptr< FrontendAction > createStaticIndexingAction (SymbolCollector::Options Opts, std::function< void(SymbolSlab)> SymbolsCallback, std::function< void(RefSlab)> RefsCallback, std::function< void(RelationSlab)> RelationsCallback, std::function< void(IncludeGraph)> IncludeGraphCallback)
 
bool prefer (const SymbolLocation &L, const SymbolLocation &R)
 
Symbol mergeSymbol (const Symbol &L, const Symbol &R)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, RefKind K)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const Ref &R)
 
RefKind operator| (RefKind L, RefKind R)
 
RefKindoperator|= (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)
 
RelationKind symbolRoleToRelationKind (index::SymbolRole Role)
 
index::SymbolRole relationKindToSymbolRole (RelationKind Kind)
 
void writeYAML (const IndexFileOut &, llvm::raw_ostream &)
 
llvm::Expected< IndexFileInreadYAML (llvm::StringRef)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const IndexFileOut &O)
 
llvm::Expected< IndexFileInreadIndexFile (llvm::StringRef Data)
 
std::unique_ptr< SymbolIndexloadIndex (llvm::StringRef SymbolFilename, bool UseDex)
 
std::string toYAML (const Symbol &)
 
std::string toYAML (const std::pair< SymbolID, ArrayRef< Ref >> &)
 
std::string toYAML (const Relation &)
 
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)
 Computes query-independent quality score for a Symbol. More...
 
static void own (Symbol &S, llvm::UniqueStringSaver &Strings)
 
Symbol::SymbolFlag operator| (Symbol::SymbolFlag A, Symbol::SymbolFlag B)
 
Symbol::SymbolFlagoperator|= (Symbol::SymbolFlag &A, Symbol::SymbolFlag B)
 
template<typename Callback >
void visitStrings (Symbol &S, const Callback &CB)
 Invokes Callback with each StringRef& contained in the Symbol. More...
 
static bool isIf (llvm::StringRef Line)
 
static bool isErrorAboutInclude (llvm::StringRef Line)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const SymbolID &ID)
 
llvm::hash_code hash_value (const SymbolID &ID)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const SymbolLocation &L)
 
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)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, SymbolOrigin O)
 
SymbolOrigin operator| (SymbolOrigin A, SymbolOrigin B)
 
SymbolOriginoperator|= (SymbolOrigin &A, SymbolOrigin B)
 
SymbolOrigin operator & (SymbolOrigin A, SymbolOrigin B)
 
std::string toYAML (const std::pair< SymbolID, llvm::ArrayRef< Ref >> &Data)
 
std::unique_ptr< TransportnewJSONTransport (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)
 
SymbolKind indexSymbolKindToSymbolKind (index::SymbolKind Kind)
 
bool fromJSON (const llvm::json::Value &Params, ClientCapabilities &R)
 
bool fromJSON (const llvm::json::Value &Params, InitializeParams &R)
 
llvm::json::Value toJSON (const MessageType &R)
 
llvm::json::Value toJSON (const ShowMessageParams &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, 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 DiagnosticRelatedInformation &DRI)
 
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)
 
bool fromJSON (const llvm::json::Value &Params, TweakArgs &A)
 
llvm::json::Value toJSON (const TweakArgs &A)
 
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)
 
bool fromJSON (const llvm::json::Value &V, MarkupKind &K)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, MarkupKind K)
 
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 &E, TypeHierarchyDirection &Out)
 
bool fromJSON (const llvm::json::Value &Params, TypeHierarchyParams &R)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &O, const TypeHierarchyItem &I)
 
llvm::json::Value toJSON (const TypeHierarchyItem &I)
 
bool fromJSON (const llvm::json::Value &Params, TypeHierarchyItem &I)
 
bool fromJSON (const llvm::json::Value &Params, ResolveTypeHierarchyItemParams &P)
 
bool fromJSON (const llvm::json::Value &Params, ReferenceParams &R)
 
static const char * toString (OffsetEncoding OE)
 
llvm::json::Value toJSON (const OffsetEncoding &OE)
 
bool fromJSON (const llvm::json::Value &V, OffsetEncoding &OE)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, OffsetEncoding Enc)
 
bool operator== (const SemanticHighlightingInformation &Lhs, const SemanticHighlightingInformation &Rhs)
 
llvm::json::Value toJSON (const SemanticHighlightingInformation &Highlighting)
 
llvm::json::Value toJSON (const SemanticHighlightingParams &Highlighting)
 
bool operator== (const TextEdit &L, const TextEdit &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)
 
static llvm::Optional< llvm::StringRef > wordMatching (llvm::StringRef Name, const llvm::StringSet<> *ContextWords)
 
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)
 
llvm::Expected< tooling::Replacements > renameWithinFile (ParsedAST &AST, llvm::StringRef File, Position Pos, llvm::StringRef NewName, const SymbolIndex *Index=nullptr)
 Renames all occurrences of the symbol at Pos to NewName. More...
 
std::vector< std::unique_ptr< Tweak > > prepareTweaks (const Tweak::Selection &S, llvm::function_ref< bool(const Tweak &)> Filter)
 Calls prepare() on all tweaks that satisfy the filter, returning those that can run on the selection. More...
 
llvm::Expected< std::unique_ptr< Tweak > > prepareTweak (StringRef ID, const Tweak::Selection &S)
 
static std::pair< unsigned, unsigned > pointBounds (unsigned Offset, FileID FID, ASTContext &AST)
 
bool operator== (const HighlightingToken &Lhs, const HighlightingToken &Rhs)
 
std::vector< HighlightingTokengetSemanticHighlightings (ParsedAST &AST)
 
std::vector< SemanticHighlightingInformationtoSemanticHighlightingInformation (llvm::ArrayRef< HighlightingToken > Tokens)
 
llvm::StringRef toTextMateScope (HighlightingKind Kind)
 Converts a HighlightingKind to a corresponding TextMate scope (https://manual.macromates.com/en/language_grammars). More...
 
template<typename Callback >
static bool iterateCodepoints (llvm::StringRef U8, const Callback &CB)
 
static size_t measureUnits (llvm::StringRef U8, int Units, OffsetEncoding Enc, bool &Valid)
 
static OffsetEncoding lspEncoding ()
 
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...
 
llvm::Optional< RangegetTokenRange (const SourceManager &SM, const LangOptions &LangOpts, SourceLocation TokLoc)
 Returns the taken range at TokLoc. More...
 
bool isValidFileRange (const SourceManager &Mgr, SourceRange R)
 Returns true iff all of the following conditions hold: More...
 
bool halfOpenRangeContains (const SourceManager &Mgr, SourceRange R, SourceLocation L)
 Returns true iff L is contained in R. More...
 
bool halfOpenRangeTouches (const SourceManager &Mgr, SourceRange R, SourceLocation L)
 Returns true iff L is contained in R or L is equal to the end point of R. More...
 
static unsigned getTokenLengthAtLoc (SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
 
static SourceLocation getLocForTokenEnd (SourceLocation BeginLoc, const SourceManager &SM, const LangOptions &LangOpts)
 
static SourceLocation getLocForTokenBegin (SourceLocation EndLoc, const SourceManager &SM, const LangOptions &LangOpts)
 
static SourceRange toTokenRange (CharSourceRange Range, const SourceManager &SM, const LangOptions &LangOpts)
 
static SourceRange unionTokenRange (SourceRange R1, SourceRange R2, const SourceManager &SM, const LangOptions &LangOpts)
 
static SourceRange getTokenFileRange (SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
 
llvm::Optional< SourceRange > toHalfOpenFileRange (const SourceManager &Mgr, const LangOptions &LangOpts, SourceRange R)
 Turns a token range into a half-open range and checks its correctness. More...
 
llvm::StringRef toSourceCode (const SourceManager &SM, SourceRange R)
 Returns the source code covered by the source range. More...
 
llvm::Expected< SourceLocation > sourceLocationInMainFile (const SourceManager &SM, Position P)
 Return the file location, corresponding to P. More...
 
Range halfOpenToRange (const SourceManager &SM, CharSourceRange R)
 
std::pair< size_t, size_t > offsetToClangLineColumn (llvm::StringRef Code, size_t Offset)
 
std::pair< StringRef, StringRef > splitQualifiedName (StringRef QName)
 
TextEdit replacementToEdit (llvm::StringRef Code, const tooling::Replacement &R)
 
std::vector< TextEditreplacementsToEdits (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< FileDigestdigestFile (const SourceManager &SM, FileID FID)
 
format::FormatStyle getFormatStyleForFile (llvm::StringRef File, llvm::StringRef Content, llvm::vfs::FileSystem *FS)
 Choose the clang-format style we should apply to a certain file. More...
 
llvm::Expected< tooling::Replacements > cleanupAndFormat (StringRef Code, const tooling::Replacements &Replaces, const format::FormatStyle &Style)
 
template<typename Action >
static void lex (llvm::StringRef Code, const format::FormatStyle &Style, Action A)
 
llvm::StringMap< unsigned > collectIdentifiers (llvm::StringRef Content, const format::FormatStyle &Style)
 Collects identifiers with counts in the source code. More...
 
std::vector< std::string > visibleNamespaces (llvm::StringRef Code, const format::FormatStyle &Style)
 Heuristically determine namespaces visible at a point, without parsing Code. More...
 
llvm::StringSet collectWords (llvm::StringRef Content)
 Collects words from the source code. More...
 
llvm::Optional< DefinedMacrolocateMacroAt (SourceLocation Loc, Preprocessor &PP)
 
FileDigest digest (StringRef Content)
 
size_t lspLength (StringRef Code)
 
std::pair< llvm::StringRef, llvm::StringRef > splitQualifiedName (llvm::StringRef QName)
 From "a::b::c", return {"a::b::", "c"}. More...
 
TextEdit replacementToEdit (StringRef Code, const tooling::Replacement &R)
 
std::vector< TextEditreplacementsToEdits (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...
 
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...
 
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...
 
static clangd::Range toLSPRange (llvm::StringRef Code, Annotations::Range R)
 
 MATCHER_P (Named, N, "")
 
 MATCHER (Declared, "")
 
 MATCHER (Defined, "")
 
 MATCHER_P (FileURI, F, "")
 
::testing::Matcher< const RefSlab & > RefsAre (std::vector<::testing::Matcher< Ref >> Matchers)
 
 MATCHER (EmptyIncludeNode, "")
 
 MATCHER (HadErrors, "")
 
 MATCHER_P (NumReferences, N, "")
 
 TEST_F (BackgroundIndexTest, NoCrashOnErrorFile)
 
 TEST_F (BackgroundIndexTest, IndexTwoFiles)
 
 TEST_F (BackgroundIndexTest, ShardStorageTest)
 
 TEST_F (BackgroundIndexTest, DirectIncludesTest)
 
 TEST_F (BackgroundIndexTest, ShardStorageLoad)
 
 TEST_F (BackgroundIndexTest, ShardStorageEmptyFile)
 
 TEST_F (BackgroundIndexTest, NoDotsInAbsPath)
 
 TEST_F (BackgroundIndexTest, UncompilableFiles)
 
 TEST_F (BackgroundIndexTest, CmdLineHash)
 
 TEST_F (BackgroundIndexRebuilderTest, IndexingTUs)
 
 TEST_F (BackgroundIndexRebuilderTest, LoadingShards)
 
 TEST (BackgroundQueueTest, Priority)
 
 TEST (BackgroundQueueTest, Boost)
 
 TEST (ContextTests, Simple)
 
 TEST (ContextTests, MoveOps)
 
 TEST (ContextTests, Builders)
 
 TEST_F (WorkspaceSymbolsTest, Macros)
 
 TEST_F (WorkspaceSymbolsTest, NoLocals)
 
 TEST_F (WorkspaceSymbolsTest, Globals)
 
 TEST_F (WorkspaceSymbolsTest, Unnamed)
 
 TEST_F (WorkspaceSymbolsTest, InMainFile)
 
 TEST_F (WorkspaceSymbolsTest, Namespaces)
 
 TEST_F (WorkspaceSymbolsTest, AnonymousNamespace)
 
 TEST_F (WorkspaceSymbolsTest, MultiFile)
 
 TEST_F (WorkspaceSymbolsTest, GlobalNamespaceQueries)
 
 TEST_F (WorkspaceSymbolsTest, Enums)
 
 TEST_F (WorkspaceSymbolsTest, Ranking)
 
 TEST_F (WorkspaceSymbolsTest, WithLimit)
 
 TEST_F (WorkspaceSymbolsTest, TempSpecs)
 
 TEST_F (DocumentSymbolsTest, BasicSymbols)
 
 TEST_F (DocumentSymbolsTest, DeclarationDefinition)
 
 TEST_F (DocumentSymbolsTest, ExternSymbol)
 
 TEST_F (DocumentSymbolsTest, NoLocals)
 
 TEST_F (DocumentSymbolsTest, Unnamed)
 
 TEST_F (DocumentSymbolsTest, InHeaderFile)
 
 TEST_F (DocumentSymbolsTest, Template)
 
 TEST_F (DocumentSymbolsTest, Namespaces)
 
 TEST_F (DocumentSymbolsTest, Enums)
 
 TEST_F (DocumentSymbolsTest, FromMacro)
 
 TEST_F (DocumentSymbolsTest, FuncTemplates)
 
 TEST_F (DocumentSymbolsTest, UsingDirectives)
 
 TEST_F (DocumentSymbolsTest, TempSpecs)
 
template<typename... Args>
PolySubsequenceMatcher< Args... > HasSubsequence (Args &&... M)
 
template<typename InnerMatcher >
OptionalMatcher< InnerMatcher > HasValue (const InnerMatcher &inner_matcher)
 
void runAddDocument (ClangdServer &Server, PathRef File, llvm::StringRef Contents, WantDiagnostics WantDiags)
 
llvm::Expected< CodeCompleteResultrunCodeComplete (ClangdServer &Server, PathRef File, Position Pos, clangd::CodeCompleteOptions Opts)
 
llvm::Expected< SignatureHelprunSignatureHelp (ClangdServer &Server, PathRef File, Position Pos)
 
llvm::Expected< std::vector< LocatedSymbol > > runLocateSymbolAt (ClangdServer &Server, PathRef File, Position Pos)
 
llvm::Expected< std::vector< DocumentHighlight > > runFindDocumentHighlights (ClangdServer &Server, PathRef File, Position Pos)
 
llvm::Expected< std::vector< TextEdit > > runRename (ClangdServer &Server, PathRef File, Position Pos, llvm::StringRef NewName)
 
std::string runDumpAST (ClangdServer &Server, PathRef File)
 
llvm::Expected< std::vector< SymbolInformation > > runWorkspaceSymbols (ClangdServer &Server, llvm::StringRef Query, int Limit)
 
llvm::Expected< std::vector< DocumentSymbol > > runDocumentSymbols (ClangdServer &Server, PathRef File)
 
SymbolSlab runFuzzyFind (const SymbolIndex &Index, llvm::StringRef Query)
 
SymbolSlab runFuzzyFind (const SymbolIndex &Index, const FuzzyFindRequest &Req)
 
RefSlab getRefs (const SymbolIndex &Index, SymbolID ID)
 
void runAddDocument (ClangdServer &Server, PathRef File, StringRef Contents, WantDiagnostics WantDiags=WantDiagnostics::Auto)
 
llvm::Expected< std::vector< TextEdit > > runRename (ClangdServer &Server, PathRef File, Position Pos, StringRef NewName)
 
llvm::Expected< std::vector< SymbolInformation > > runWorkspaceSymbols (ClangdServer &Server, StringRef Query, int Limit)
 
SymbolSlab runFuzzyFind (const SymbolIndex &Index, StringRef Query)
 
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > buildTestFS (llvm::StringMap< std::string > const &Files, llvm::StringMap< time_t > const &Timestamps)
 
const char * testRoot ()
 
std::string testPath (PathRef File)
 
static URISchemeRegistry::Add< TestScheme > X (TestScheme::Scheme, "Test schema")
 
Symbol symbol (llvm::StringRef QName)
 
static std::string replace (llvm::StringRef Haystack, llvm::StringRef Needle, llvm::StringRef Repl)
 
Symbol sym (llvm::StringRef QName, index::SymbolKind Kind, llvm::StringRef USRFormat)
 
Symbol func (llvm::StringRef Name)
 
Symbol cls (llvm::StringRef Name)
 
Symbol var (llvm::StringRef Name)
 
Symbol ns (llvm::StringRef Name)
 
SymbolSlab generateSymbols (std::vector< std::string > QualifiedNames)
 
SymbolSlab generateNumSymbols (int Begin, int End)
 
std::string getQualifiedName (const Symbol &Sym)
 
std::vector< std::string > match (const SymbolIndex &I, const FuzzyFindRequest &Req, bool *Incomplete)
 
std::vector< std::string > lookup (const SymbolIndex &I, llvm::ArrayRef< SymbolID > IDs)
 
const SymbolfindSymbol (const SymbolSlab &Slab, llvm::StringRef QName)
 
const NamedDecl & findDecl (ParsedAST &AST, llvm::StringRef QName)
 
const NamedDecl & findDecl (ParsedAST &AST, std::function< bool(const NamedDecl &)> Filter)
 
const NamedDecl & findUnqualifiedDecl (ParsedAST &AST, llvm::StringRef Name)
 
 TEST_F (ThreadingTest, TaskRunner)
 
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< TransportnewXPCTransport ()
 
std::vector< LocatedSymbollocateSymbolAt (ParsedAST &AST, Position Pos, const SymbolIndex *Index=nullptr)
 Get definition of symbol at a specified Pos. More...
 
std::vector< DocumentHighlightfindDocumentHighlights (ParsedAST &AST, Position Pos)
 Returns highlights for all usages of a symbol at Pos. More...
 
static PrintingPolicy printingPolicyForDecls (PrintingPolicy Base)
 
static std::string getLocalScope (const Decl *D)
 Given a declaration D, return a human-readable string representing the local scope in which it is declared, i.e. More...
 
static std::string getNamespaceScope (const Decl *D)
 Returns the human-readable representation for namespace containing the declaration D. More...
 
static std::string printDefinition (const Decl *D)
 
static void printParams (llvm::raw_ostream &OS, const std::vector< HoverInfo::Param > &Params)
 
static std::vector< HoverInfo::ParamfetchTemplateParameters (const TemplateParameterList *Params, const PrintingPolicy &PP)
 
static const FunctionDecl * getUnderlyingFunction (const Decl *D)
 
static void enhanceFromIndex (HoverInfo &Hover, const Decl *D, const SymbolIndex *Index)
 
static HoverInfo getHoverContents (const Decl *D, const SymbolIndex *Index)
 Generate a Hover object given the declaration D. More...
 
static HoverInfo getHoverContents (QualType T, const Decl *D, ASTContext &ASTCtx, const SymbolIndex *Index)
 Generate a Hover object given the type T. More...
 
static HoverInfo getHoverContents (const DefinedMacro &Macro, ParsedAST &AST)
 Generate a Hover object given the macro MacroDecl. More...
 
llvm::Optional< QualType > getDeducedType (ParsedAST &AST, SourceLocation SourceLocationBeg)
 Retrieves the deduced type at a given location (auto, decltype). More...
 
bool hasDeducedType (ParsedAST &AST, SourceLocation SourceLocationBeg)
 Retrieves the deduced type at a given location (auto, decltype). More...
 
llvm::Optional< HoverInfogetHover (ParsedAST &AST, Position Pos, format::FormatStyle Style, const SymbolIndex *Index)
 Get the hover information when hovering at Pos. More...
 
std::vector< LocationfindReferences (ParsedAST &AST, Position Pos, uint32_t Limit, const SymbolIndex *Index=nullptr)
 Returns reference locations of the symbol at a specified Pos. More...
 
std::vector< SymbolDetailsgetSymbolInfo (ParsedAST &AST, Position Pos)
 Get info about symbols at Pos. More...
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const LocatedSymbol &S)
 
static llvm::Optional< TypeHierarchyItemdeclToTypeHierarchyItem (ASTContext &Ctx, const NamedDecl &ND)
 
static Optional< TypeHierarchyItemsymbolToTypeHierarchyItem (const Symbol &S, const SymbolIndex *Index, PathRef TUPath)
 
static void fillSubTypes (const SymbolID &ID, std::vector< TypeHierarchyItem > &SubTypes, const SymbolIndex *Index, int Levels, PathRef TUPath)
 
static void fillSuperTypes (const CXXRecordDecl &CXXRD, ASTContext &ASTCtx, std::vector< TypeHierarchyItem > &SuperTypes, RecursionProtectionSet &RPSet)
 
const CXXRecordDecl * findRecordTypeAt (ParsedAST &AST, Position Pos)
 Find the record type references at Pos. More...
 
std::vector< const CXXRecordDecl * > typeParents (const CXXRecordDecl *CXXRD)
 Given a record type declaration, find its base (parent) types. More...
 
llvm::Optional< TypeHierarchyItemgetTypeHierarchy (ParsedAST &AST, Position Pos, int Resolve, TypeHierarchyDirection Direction, const SymbolIndex *Index=nullptr, PathRef TUPath=PathRef{})
 Get type hierarchy information at Pos. More...
 
void resolveTypeHierarchy (TypeHierarchyItem &Item, int ResolveLevels, TypeHierarchyDirection Direction, const SymbolIndex *Index)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const HoverInfo::Param &P)
 
bool operator== (const HoverInfo::Param &LHS, const HoverInfo::Param &RHS)
 

Variables

static Key< std::shared_ptr< std::atomic< bool > > > FlagKey
 
static constexpr int AwfulScore = -(1 << 13)
 
static constexpr int PerfectBonus = 4
 
static constexpr uint8_t CharTypes []
 
static constexpr uint8_t CharRoles []
 
static std::atomic< bool > PreventStarvation = {false}
 
constexpr auto CompletionItemKindMin
 
constexpr auto CompletionItemKindMax
 
constexpr auto SymbolKindMin = static_cast<size_t>(SymbolKind::File)
 
constexpr auto SymbolKindMax = static_cast<size_t>(SymbolKind::TypeParameter)
 
Key< OffsetEncodingkCurrentOffsetEncoding
 
static clang::clangd::Key< std::string > kFileBeingProcessed
 
static int LLVM_ATTRIBUTE_UNUSED UnittestSchemeAnchorDest
 
volatile int UnittestSchemeAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED UnittestSchemeAnchorDest
 

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 28 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 70 of file Cancellation.h.

◆ CharTypeSet

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

Definition at line 49 of file FuzzyMatch.h.

◆ ClangTidyOptionsBuilder

using clang::clangd::ClangTidyOptionsBuilder = typedef std::function<tidy::ClangTidyOptions( llvm::vfs::FileSystem &, llvm::StringRef )>

When set, used by ClangdServer to get clang-tidy options for each particular file.

Must be thread-safe. We use this instead of ClangTidyOptionsProvider to allow reading tidy configs from the VFS used for parsing.

Definition at line 64 of file ClangdServer.h.

◆ CompletionItemKindBitset

Definition at line 292 of file Protocol.h.

◆ ExitParams

Definition at line 242 of file Protocol.h.

◆ FileDigest

using clang::clangd::FileDigest = typedef std::array<uint8_t, 8>

Definition at line 35 of file SourceCode.h.

◆ IncludeGraph

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

Definition at line 82 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 20 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 23 of file Path.h.

◆ PreambleParsedCallback

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

Definition at line 157 of file ClangdUnit.h.

◆ RecursionProtectionSet

using clang::clangd::RecursionProtectionSet = typedef llvm::SmallSet<const CXXRecordDecl *, 4>

Definition at line 1133 of file XRefs.cpp.

◆ ShutdownParams

Definition at line 241 of file Protocol.h.

◆ SlabTuple

Definition at line 134 of file FileIndex.h.

◆ SymbolKindBitset

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

Definition at line 330 of file Protocol.h.

◆ TweakRegistry

typedef llvm::Registry<Tweak> clang::clangd::TweakRegistry

A handy typedef to save some typing.

Definition at line 23 of file Tweak.cpp.

◆ URISchemeRegistry

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

Definition at line 127 of file URI.h.

Enumeration Type Documentation

◆ CharRole

enum clang::clangd::CharRole : unsigned char
Enumerator
Unknown 
Tail 
Head 
Separator 

Definition at line 55 of file FuzzyMatch.h.

◆ CharType

enum clang::clangd::CharType : unsigned char
Enumerator
Empty 
Lower 
Upper 
Punctuation 

Definition at line 41 of file FuzzyMatch.h.

◆ CompletionItemKind

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.

◆ CompletionTriggerKind

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 881 of file Protocol.h.

◆ DocumentHighlightKind

Enumerator
Text 
Read 
Write 

Definition at line 1075 of file Protocol.h.

◆ DuplicateHandling

How to handle duplicated symbols across multiple files.

Enumerator
PickOne 
Merge 

Definition at line 39 of file FileIndex.h.

◆ ErrorCode

Enumerator
ParseError 
InvalidRequest 
MethodNotFound 
InvalidParams 
InternalError 
ServerNotInitialized 
UnknownErrorCode 
RequestCancelled 

Definition at line 39 of file Protocol.h.

◆ FileChangeType

Enumerator
Created 

The file got created.

Changed 

The file got changed.

Deleted 

The file got deleted.

Definition at line 560 of file Protocol.h.

◆ HighlightingKind

Enumerator
Variable 
Function 
Method 
Field 
Class 
Enum 
EnumConstant 
Namespace 
TemplateParameter 
NumKinds 

Definition at line 26 of file SemanticHighlighting.h.

◆ IndexFileFormat

Enumerator
RIFF 
YAML 

Definition at line 36 of file Serialization.h.

◆ IndexType

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

Enumerator
Light 
Heavy 

Definition at line 31 of file FileIndex.h.

◆ InsertTextFormat

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 924 of file Protocol.h.

◆ JSONStreamStyle

Enumerator
Standard 
Delimited 

Definition at line 65 of file Transport.h.

◆ MarkupKind

Enumerator
PlainText 
Markdown 

Definition at line 358 of file Protocol.h.

◆ MessageType

Enumerator
Error 

An error message.

Warning 

A warning message.

Info 

An information message.

Log 

A log message.

Definition at line 497 of file Protocol.h.

◆ OffsetEncoding

Enumerator
UnsupportedEncoding 
UTF16 
UTF8 
UTF32 

Definition at line 342 of file Protocol.h.

◆ RefKind

enum clang::clangd::RefKind : uint8_t
strong

Describes the kind of a cross-reference.

This is a bitfield which can be combined from different kinds.

Enumerator
Unknown 
Declaration 
Definition 
Reference 
All 

Definition at line 28 of file Ref.h.

◆ RelationKind

enum clang::clangd::RelationKind : uint8_t
strong
Enumerator
BaseOf 

Definition at line 87 of file Serialization.h.

◆ SymbolKind

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 
Identifier 

Definition at line 21 of file SymbolOrigin.h.

◆ TextDocumentSyncKind

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.

◆ TraceLevel

Enumerator
Off 
Messages 
Verbose 

Definition at line 232 of file Protocol.h.

◆ TypeHierarchyDirection

Enumerator
Children 
Parents 
Both 

Definition at line 1103 of file Protocol.h.

◆ WantDiagnostics

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 43 of file TUScheduler.h.

Function Documentation

◆ addSystemHeadersMapping()

void clang::clangd::addSystemHeadersMapping ( CanonicalIncludes Includes,
const LangOptions &  Language 
)

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 89 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.

◆ adjustKindToCapability() [2/2]

CompletionItemKind clang::clangd::adjustKindToCapability ( CompletionItemKind  Kind,
CompletionItemKindBitset SupportedCompletionItemKinds 
)

Definition at line 760 of file Protocol.cpp.

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

◆ asCommand()

static llvm::Optional<Command> clang::clangd::asCommand ( const CodeAction Action)
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 81 of file Function.h.

Referenced by clang::clangd::ClangdServer::documentSymbols(), clang::clangd::ClangdServer::dumpAST(), clang::clangd::ClangdServer::enumerateTweaks(), clang::clangd::ClangdServer::findDocumentHighlights(), clang::clangd::ClangdServer::findReferences(), flattenSymbolHierarchy(), clang::clangd::ClangdServer::locateSymbolAt(), clang::clangd::ClangdServer::signatureHelp(), clang::clangd::ClangdServer::symbolInfo(), and clang::clangd::ClangdServer::typeHierarchy().

◆ buildAST()

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

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 639 of file ClangdUnit.cpp.

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

◆ 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 44 of file Compiler.cpp.

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

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

◆ 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,
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 567 of file ClangdUnit.cpp.

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

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

◆ buildTestFS()

llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > clang::clangd::buildTestFS ( llvm::StringMap< std::string > const &  Files,
llvm::StringMap< time_t > const &  Timestamps 
)

◆ calculateRoles()

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

◆ 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 18 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

◆ categorize() [1/3]

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

◆ categorize() [2/3]

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

◆ categorize() [3/3]

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

◆ cleanupAndFormat()

llvm::Expected< tooling::Replacements > clang::clangd::cleanupAndFormat ( StringRef  Code,
const tooling::Replacements &  Replaces,
const format::FormatStyle Style 
)

Definition at line 499 of file SourceCode.cpp.

◆ cls()

Symbol clang::clangd::cls ( llvm::StringRef  Name)

Definition at line 64 of file TestIndex.cpp.

References sym().

◆ 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,
CodeCompleteOptions  Opts,
SpeculativeFuzzyFind SpecFuzzyFind = nullptr 
)

Gets code completions at a specified Pos in FileName.

If Preamble is nullptr, this runs code completion without compiling the code.

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,
CodeCompleteOptions  Opts,
SpeculativeFuzzyFind SpecFuzzyFind 
)

Definition at line 1729 of file CodeComplete.cpp.

◆ collectIdentifiers()

llvm::StringMap< unsigned > clang::clangd::collectIdentifiers ( llvm::StringRef  Content,
const format::FormatStyle Style 
)

Collects identifiers with counts in the source code.

Definition at line 522 of file SourceCode.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 113 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 64 of file CanonicalIncludes.cpp.

◆ collectWords()

llvm::StringSet clang::clangd::collectWords ( llvm::StringRef  Content)

Collects words from the source code.

Unlike collectIdentifiers:

  • also finds text in comments:
  • splits text into words
  • drops stopwords like "get" and "for"

Definition at line 713 of file SourceCode.cpp.

References calculateRoles(), Head, Result, Separator, Tail, Unknown, and Word.

◆ computeScope()

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

◆ createScopeFileDistance()

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

Definition at line 186 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(RelationSlab)>  RelationsCallback,
std::function< void(IncludeGraph)>  IncludeGraphCallback 
)

Definition at line 185 of file IndexAction.cpp.

◆ currentContext()

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

◆ declToTypeHierarchyItem()

static llvm::Optional<TypeHierarchyItem> clang::clangd::declToTypeHierarchyItem ( ASTContext &  Ctx,
const NamedDecl &  ND 
)
static

Definition at line 1045 of file XRefs.cpp.

Referenced by getTypeHierarchy().

◆ digest() [1/2]

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

◆ digest() [2/2]

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

Definition at line 467 of file SourceCode.cpp.

References Result.

◆ digestFile()

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

Definition at line 477 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 282 of file ClangdUnit.cpp.

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

◆ elog()

template<typename... Ts>
void clang::clangd::elog ( const char *  Fmt,
Ts &&...  Vals 
)

◆ encodeFloat()

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

Definition at line 470 of file Quality.cpp.

◆ enhanceFromIndex()

static void clang::clangd::enhanceFromIndex ( HoverInfo Hover,
const Decl *  D,
const SymbolIndex Index 
)
static

◆ evaluateSymbolAndRelevance()

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

Combine symbol quality and relevance into a single score.

Definition at line 464 of file Quality.cpp.

◆ extractUnresolvedNameCheaply()

llvm::Optional<CheapUnresolvedName> clang::clangd::extractUnresolvedNameCheaply ( const SourceManager &  SM,
const DeclarationNameInfo &  Unresolved,
CXXScopeSpec *  SS,
const LangOptions &  LangOpts,
bool  UnresolvedIsSpecifier 
)

◆ fetchTemplateParameters()

static std::vector<HoverInfo::Param> clang::clangd::fetchTemplateParameters ( const TemplateParameterList *  Params,
const PrintingPolicy &  PP 
)
static

◆ filenameWithoutExtension()

static llvm::StringRef clang::clangd::filenameWithoutExtension ( llvm::StringRef  Path)
static

◆ fillSubTypes()

static void clang::clangd::fillSubTypes ( const SymbolID ID,
std::vector< TypeHierarchyItem > &  SubTypes,
const SymbolIndex Index,
int  Levels,
PathRef  TUPath 
)
static

Definition at line 1115 of file XRefs.cpp.

◆ fillSuperTypes()

static void clang::clangd::fillSuperTypes ( const CXXRecordDecl &  CXXRD,
ASTContext &  ASTCtx,
std::vector< TypeHierarchyItem > &  SuperTypes,
RecursionProtectionSet RPSet 
)
static

Definition at line 1135 of file XRefs.cpp.

Referenced by getTypeHierarchy().

◆ findDecl() [1/2]

const NamedDecl & clang::clangd::findDecl ( ParsedAST AST,
llvm::StringRef  QName 
)

Definition at line 114 of file TestTU.cpp.

References Ctx, clang::clangd::ParsedAST::getASTContext(), and Name.

Referenced by findUnqualifiedDecl().

◆ findDecl() [2/2]

const NamedDecl & clang::clangd::findDecl ( ParsedAST AST,
std::function< bool(const NamedDecl &)>  Filter 
)

Definition at line 135 of file TestTU.cpp.

◆ findDocumentHighlights()

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

Returns highlights for all usages of a symbol at Pos.

Definition at line 436 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 67 of file AST.cpp.

◆ findRecordTypeAt()

const CXXRecordDecl * clang::clangd::findRecordTypeAt ( ParsedAST AST,
Position  Pos 
)

Find the record type references at Pos.

Definition at line 1164 of file XRefs.cpp.

References D, getBeginningOfIdentifier(), clang::clangd::ParsedAST::getSourceManager(), Method, and Symbols.

Referenced by getTypeHierarchy().

◆ 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 935 of file XRefs.cpp.

References Results.

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

◆ findSymbol()

const Symbol & clang::clangd::findSymbol ( const SymbolSlab Slab,
llvm::StringRef  QName 
)

Definition at line 93 of file TestTU.cpp.

References Result.

◆ findUnqualifiedDecl()

const NamedDecl & clang::clangd::findUnqualifiedDecl ( ParsedAST AST,
llvm::StringRef  Name 
)

Definition at line 155 of file TestTU.cpp.

References findDecl().

◆ flattenSymbolHierarchy()

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

◆ 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
DocCommentis a documentation comment for the original declaration, it should be obtained via getDocComment or getParameterDocComment.

Definition at line 190 of file CodeCompletionStrings.cpp.

References Result.

◆ formatIncremental()

std::vector< tooling::Replacement > clang::clangd::formatIncremental ( llvm::StringRef  Code,
unsigned  Cursor,
llvm::StringRef  InsertedText,
format::FormatStyle  Style 
)

Applies limited formatting around new InsertedText.

The Code already contains the updated text before Cursor, and may have had additional / characters (such as indentation) inserted by the editor.

Example breaking a line (^ is the cursor): === before newline is typed === if(1){^} === after newline is typed and editor indents === if(1){ ^} === after formatIncremental(InsertedText="\n") === if (1) { ^ }

We return sorted vector<tooling::Replacement>, not tooling::Replacements! We may insert text both before and after the cursor. tooling::Replacements would merge these, and thus lose information about cursor position.

Definition at line 246 of file Format.cpp.

References Incremental, and Range.

◆ fromJSON() [1/48]

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

◆ fromJSON() [2/48]

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

Definition at line 53 of file Protocol.cpp.

◆ fromJSON() [3/48]

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

Definition at line 87 of file Protocol.cpp.

◆ fromJSON() [4/48]

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

Definition at line 92 of file Protocol.cpp.

◆ fromJSON() [5/48]

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

Definition at line 108 of file Protocol.cpp.

◆ fromJSON() [6/48]

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

Definition at line 135 of file Protocol.cpp.

◆ fromJSON() [7/48]

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

Definition at line 141 of file Protocol.cpp.

◆ fromJSON() [8/48]

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

Definition at line 159 of file Protocol.cpp.

◆ fromJSON() [9/48]

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

Definition at line 175 of file Protocol.cpp.

◆ fromJSON() [10/48]

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

Definition at line 186 of file Protocol.cpp.

◆ fromJSON() [11/48]

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

Definition at line 240 of file Protocol.h.

◆ fromJSON() [12/48]

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

Definition at line 271 of file Protocol.cpp.

◆ fromJSON() [13/48]

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

Definition at line 354 of file Protocol.cpp.

◆ fromJSON() [14/48]

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

Definition at line 377 of file Protocol.cpp.

◆ fromJSON() [15/48]

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

Definition at line 382 of file Protocol.cpp.

◆ fromJSON() [16/48]

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

Definition at line 387 of file Protocol.cpp.

◆ fromJSON() [17/48]

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

Definition at line 394 of file Protocol.cpp.

◆ fromJSON() [18/48]

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

Definition at line 405 of file Protocol.cpp.

◆ fromJSON() [19/48]

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

Definition at line 410 of file Protocol.cpp.

◆ fromJSON() [20/48]

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

Definition at line 415 of file Protocol.cpp.

◆ fromJSON() [21/48]

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

Definition at line 422 of file Protocol.cpp.

◆ fromJSON() [22/48]

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

Definition at line 428 of file Protocol.cpp.

◆ fromJSON() [23/48]

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

Definition at line 435 of file Protocol.cpp.

◆ fromJSON() [24/48]

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

Definition at line 440 of file Protocol.cpp.

◆ fromJSON() [25/48]

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

Definition at line 471 of file Protocol.cpp.

◆ fromJSON() [26/48]

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

Definition at line 482 of file Protocol.cpp.

◆ fromJSON() [27/48]

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

Definition at line 509 of file Protocol.cpp.

◆ fromJSON() [28/48]

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

Definition at line 515 of file Protocol.cpp.

◆ fromJSON() [29/48]

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

Definition at line 525 of file Protocol.cpp.

◆ fromJSON() [30/48]

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

Definition at line 594 of file Protocol.cpp.

◆ fromJSON() [31/48]

bool clang::clangd::fromJSON ( const llvm::json::Value &  Params,
TweakArgs A 
)

Definition at line 654 of file Protocol.cpp.

◆ fromJSON() [32/48]

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

Definition at line 669 of file Protocol.cpp.

◆ fromJSON() [33/48]

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

Definition at line 675 of file Protocol.cpp.

◆ fromJSON() [34/48]

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

Definition at line 690 of file Protocol.cpp.

◆ fromJSON() [35/48]

bool clang::clangd::fromJSON ( const llvm::json::Value &  V,
MarkupKind K 
)

Definition at line 708 of file Protocol.cpp.

◆ fromJSON() [36/48]

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

Definition at line 748 of file Protocol.cpp.

◆ fromJSON() [37/48]

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

Definition at line 781 of file Protocol.cpp.

◆ fromJSON() [38/48]

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

Definition at line 879 of file Protocol.cpp.

◆ fromJSON() [39/48]

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

Definition at line 909 of file Protocol.cpp.

◆ fromJSON() [40/48]

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

Definition at line 915 of file Protocol.cpp.

◆ fromJSON() [41/48]

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

Definition at line 922 of file Protocol.cpp.

◆ fromJSON() [42/48]

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

Definition at line 930 of file Protocol.cpp.

◆ fromJSON() [43/48]

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

Definition at line 942 of file Protocol.cpp.

◆ fromJSON() [44/48]

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

Definition at line 953 of file Protocol.cpp.

◆ fromJSON() [45/48]

bool clang::clangd::fromJSON ( const llvm::json::Value &  Params,
TypeHierarchyItem I 
)

Definition at line 985 of file Protocol.cpp.

◆ fromJSON() [46/48]

bool clang::clangd::fromJSON ( const llvm::json::Value &  Params,
ResolveTypeHierarchyItemParams P 
)

Definition at line 1005 of file Protocol.cpp.

◆ fromJSON() [47/48]

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

Definition at line 1012 of file Protocol.cpp.

◆ fromJSON() [48/48]

bool clang::clangd::fromJSON ( const llvm::json::Value &  V,
OffsetEncoding OE 
)

Definition at line 1031 of file Protocol.cpp.

◆ func()

Symbol clang::clangd::func ( llvm::StringRef  Name)

Definition at line 60 of file TestIndex.cpp.

References sym().

◆ generateNumSymbols()

SymbolSlab clang::clangd::generateNumSymbols ( int  Begin,
int  End 
)

Definition at line 83 of file TestIndex.cpp.

◆ generateSymbols()

SymbolSlab clang::clangd::generateSymbols ( std::vector< std::string >  QualifiedNames)

Definition at line 76 of file TestIndex.cpp.

References clang::clangd::SymbolSlab::Builder::insert(), QName, and symbol().

◆ getBeginningOfIdentifier()

SourceLocation clang::clangd::getBeginningOfIdentifier ( const 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 660 of file ClangdUnit.cpp.

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

Referenced by findRecordTypeAt().

◆ 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 414 of file SourceCode.cpp.

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

◆ 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 58 of file CodeCompletionStrings.cpp.

Referenced by getDocComment(), and getHoverContents().

◆ getDeducedType()

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

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

SourceLocationBeg must point to the first character of the token

Retuns None unless SourceLocationBeg starts an auto/decltype token. It will return the underlying type.

Definition at line 874 of file XRefs.cpp.

Referenced by hasDeducedType().

◆ 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 801 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 46 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 276 of file FindSymbols.cpp.

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

◆ getFallbackClangPath()

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

◆ getFormatStyleForFile()

format::FormatStyle clang::clangd::getFormatStyleForFile ( llvm::StringRef  File,
llvm::StringRef  Content,
llvm::vfs::FileSystem *  FS 
)

Choose the clang-format style we should apply to a certain file.

This will usually use FS to look for .clang-format directories. FIXME: should we be caching the .clang-format file search? This uses format::DefaultFormatStyle and format::DefaultFallbackStyle, though the latter may have been overridden in main()!

Definition at line 485 of file SourceCode.cpp.

◆ getHover()

llvm::Optional< HoverInfo > clang::clangd::getHover ( ParsedAST AST,
Position  Pos,
format::FormatStyle  Style,
const SymbolIndex Index 
)

Get the hover information when hovering at Pos.

Definition at line 899 of file XRefs.cpp.

Referenced by operator==().

◆ getHoverContents() [1/3]

static HoverInfo clang::clangd::getHoverContents ( const Decl *  D,
const SymbolIndex Index 
)
static

◆ getHoverContents() [2/3]

static HoverInfo clang::clangd::getHoverContents ( QualType  T,
const Decl *  D,
ASTContext &  ASTCtx,
const SymbolIndex Index 
)
static

Generate a Hover object given the type T.

Definition at line 730 of file XRefs.cpp.

◆ getHoverContents() [3/3]

static HoverInfo clang::clangd::getHoverContents ( const DefinedMacro Macro,
ParsedAST AST 
)
static

Generate a Hover object given the macro MacroDecl.

Definition at line 745 of file XRefs.cpp.

◆ getLocalScope()

static std::string clang::clangd::getLocalScope ( const Decl *  D)
static

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

class(es) and method name. Returns an empty string if it is not local.

Definition at line 477 of file XRefs.cpp.

Referenced by getHoverContents().

◆ getLocForTokenBegin()

static SourceLocation clang::clangd::getLocForTokenBegin ( SourceLocation  EndLoc,
const SourceManager &  SM,
const LangOptions &  LangOpts 
)
static

Definition at line 273 of file SourceCode.cpp.

◆ getLocForTokenEnd()

static SourceLocation clang::clangd::getLocForTokenEnd ( SourceLocation  BeginLoc,
const SourceManager &  SM,
const LangOptions &  LangOpts 
)
static

Definition at line 265 of file SourceCode.cpp.

◆ getNamespaceScope()

static std::string clang::clangd::getNamespaceScope ( const Decl *  D)
static

Returns the human-readable representation for namespace containing the declaration D.

Returns empty if it is contained global namespace.

Definition at line 502 of file XRefs.cpp.

Referenced by getHoverContents().

◆ getQualifiedName()

std::string clang::clangd::getQualifiedName ( const Symbol Sym)

◆ getQueryDriverDatabase()

std::unique_ptr< GlobalCompilationDatabase > clang::clangd::getQueryDriverDatabase ( llvm::ArrayRef< std::string >  QueryDriverGlobs,
std::unique_ptr< GlobalCompilationDatabase Base 
)

Extracts system include search path from drivers matching QueryDriverGlobs and adds them to the compile flags.

Base may not be nullptr. Returns Base when QueryDriverGlobs is empty.

Definition at line 273 of file QueryDriverDatabase.cpp.

◆ getRankedIncludes()

llvm::SmallVector< llvm::StringRef, 1 > clang::clangd::getRankedIncludes ( const Symbol Sym)

Definition at line 97 of file Headers.cpp.

◆ getRefs()

RefSlab clang::clangd::getRefs ( const SymbolIndex Index,
SymbolID  ID 
)

Definition at line 142 of file SyncAPI.cpp.

◆ 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 220 of file CodeCompletionStrings.cpp.

◆ getSemanticHighlightings()

std::vector< HighlightingToken > clang::clangd::getSemanticHighlightings ( ParsedAST AST)

Definition at line 269 of file SemanticHighlighting.cpp.

◆ getSeverity()

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

Convert from clang diagnostic level to LSP severity.

Definition at line 370 of file Diagnostics.cpp.

References Error, and Warning.

Referenced by toLSPDiags().

◆ getSignature()

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

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 = "(${1: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.

When CompletingPattern is true, the last placeholder will be of the form ${0:…}, indicating the cursor should stay there.

Definition at line 77 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 154 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 161 of file AST.cpp.

◆ getSymbolInfo()

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

Get info about symbols at Pos.

Definition at line 992 of file XRefs.cpp.

Referenced by getHoverContents(), and clang::clangd::ClangdServer::symbolInfo().

◆ getToggle()

static Location* clang::clangd::getToggle ( const TextDocumentPositionParams Point,
LocatedSymbol Sym 
)
static

◆ getTokenFileRange()

static SourceRange clang::clangd::getTokenFileRange ( SourceLocation  Loc,
const SourceManager &  SM,
const LangOptions &  LangOpts 
)
static

Definition at line 309 of file SourceCode.cpp.

◆ getTokenLengthAtLoc()

static unsigned clang::clangd::getTokenLengthAtLoc ( SourceLocation  Loc,
const SourceManager &  SM,
const LangOptions &  LangOpts 
)
static

Definition at line 249 of file SourceCode.cpp.

◆ getTokenRange()

llvm::Optional< Range > clang::clangd::getTokenRange ( const SourceManager &  SM,
const LangOptions &  LangOpts,
SourceLocation  TokLoc 
)

◆ getTypeHierarchy()

llvm::Optional< TypeHierarchyItem > clang::clangd::getTypeHierarchy ( ParsedAST AST,
Position  Pos,
int  ResolveLevels,
TypeHierarchyDirection  Direction,
const SymbolIndex Index,
PathRef  TUPath 
)

◆ getUnderlyingFunction()

static const FunctionDecl* clang::clangd::getUnderlyingFunction ( const Decl *  D)
static

Definition at line 588 of file XRefs.cpp.

Referenced by getHoverContents().

◆ 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 74 of file FindSymbols.cpp.

◆ guessCompletionPrefix()

CompletionPrefix clang::clangd::guessCompletionPrefix ( llvm::StringRef  Content,
unsigned  Offset 
)

◆ halfOpenRangeContains()

bool clang::clangd::halfOpenRangeContains ( const SourceManager &  Mgr,
SourceRange  R,
SourceLocation  L 
)

Returns true iff L is contained in R.

EXPECTS: isValidFileRange(R) == true, L is a file location.

Definition at line 229 of file SourceCode.cpp.

References isValidFileRange().

Referenced by halfOpenRangeTouches().

◆ halfOpenRangeTouches()

bool clang::clangd::halfOpenRangeTouches ( const SourceManager &  Mgr,
SourceRange  R,
SourceLocation  L 
)

Returns true iff L is contained in R or L is equal to the end point of R.

EXPECTS: isValidFileRange(R) == true, L is a file location.

Definition at line 244 of file SourceCode.cpp.

References halfOpenRangeContains().

◆ halfOpenToRange()

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

Definition at line 373 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().

◆ hasDeducedType()

bool clang::clangd::hasDeducedType ( ParsedAST AST,
SourceLocation  SourceLocationBeg 
)

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

Check if there is a deduced type at a given location (auto, decltype).

SourceLocationBeg must point to the first character of the token

Definition at line 895 of file XRefs.cpp.

References getDeducedType().

◆ hash_value()

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

◆ HasSubsequence()

template<typename... Args>
PolySubsequenceMatcher<Args...> clang::clangd::HasSubsequence ( Args &&...  M)

Definition at line 106 of file clangd/unittests/Matchers.h.

◆ hasUsingDeclInMainFile()

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

Definition at line 52 of file Quality.cpp.

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

◆ HasValue()

template<typename InnerMatcher >
OptionalMatcher<InnerMatcher> clang::clangd::HasValue ( const InnerMatcher &  inner_matcher)
inline

Definition at line 193 of file clangd/unittests/Matchers.h.

◆ indexHeaderSymbols()

SlabTuple clang::clangd::indexHeaderSymbols ( ASTContext &  AST,
std::shared_ptr< Preprocessor >  PP,
const CanonicalIncludes Includes 
)

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

Definition at line 85 of file FileIndex.cpp.

Referenced by clang::clangd::TestTU::headerSymbols().

◆ indexMainDecls()

SlabTuple 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 79 of file FileIndex.cpp.

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

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

◆ indexSymbolKindToSymbolKind()

SymbolKind clang::clangd::indexSymbolKindToSymbolKind ( index::SymbolKind  Kind)

◆ indexSymbols()

static SlabTuple clang::clangd::indexSymbols ( ASTContext &  AST,
std::shared_ptr< Preprocessor >  PP,
llvm::ArrayRef< Decl *>  DeclsToIndex,
const CanonicalIncludes Includes,
bool  IsIndexMainAST 
)
static

Definition at line 31 of file FileIndex.cpp.

Referenced by indexMainDecls().

◆ isAwful()

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

Definition at line 73 of file FuzzyMatch.cpp.

Referenced by 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 26 of file Cancellation.cpp.

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

◆ isErrorAboutInclude()

static bool clang::clangd::isErrorAboutInclude ( llvm::StringRef  Line)
static

Definition at line 723 of file SymbolCollector.cpp.

References isIf(), and Line.

◆ isIf()

static bool clang::clangd::isIf ( llvm::StringRef  Line)
static

Definition at line 715 of file SymbolCollector.cpp.

Referenced by isErrorAboutInclude().

◆ 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 65 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 1772 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 
)

◆ isReserved()

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

Definition at line 36 of file Quality.cpp.

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

◆ isSpelledInSourceCode()

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

Definition at line 51 of file AST.cpp.

Referenced by isImplementationDetail().

◆ isValidFileRange()

bool clang::clangd::isValidFileRange ( const SourceManager &  Mgr,
SourceRange  R 
)

Returns true iff all of the following conditions hold:

  • start and end locations are valid,
  • start and end locations are file locations from the same file (i.e. expansion locations are not taken into account).
  • start offset <= end offset. FIXME: introduce a type for source range with this invariant.

Definition at line 214 of file SourceCode.cpp.

Referenced by halfOpenRangeContains().

◆ iterateCodepoints()

template<typename Callback >
static bool clang::clangd::iterateCodepoints ( llvm::StringRef  U8,
const Callback CB 
)
static

Definition at line 43 of file SourceCode.cpp.

Referenced by lspLength(), and measureUnits().

◆ 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 20 of file Conversion.cpp.

Referenced by main().

◆ lex()

template<typename Action >
static void clang::clangd::lex ( llvm::StringRef  Code,
const format::FormatStyle Style,
Action  A 
)
static

Definition at line 508 of file SourceCode.cpp.

◆ loadIndex()

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

Definition at line 688 of file Serialization.cpp.

References elog(), Refs, Relations, and Symbols.

◆ loadIndexShards()

std::vector< LoadedShard > clang::clangd::loadIndexShards ( llvm::ArrayRef< Path MainFiles,
BackgroundIndexStorage::Factory IndexStorageFactory,
const GlobalCompilationDatabase CDB 
)

Loads all shards for the TU MainFile from Storage.

Definition at line 131 of file BackgroundIndexLoader.cpp.

◆ locateMacroAt()

llvm::Optional< DefinedMacro > clang::clangd::locateMacroAt ( SourceLocation  Loc,
Preprocessor &  PP 
)

Definition at line 751 of file SourceCode.cpp.

◆ locateSymbolAt()

std::vector< LocatedSymbol > clang::clangd::locateSymbolAt ( ParsedAST AST,
Position  Pos,
const SymbolIndex Index = nullptr 
)

Get definition of symbol at a specified Pos.

Multiple locations may be returned, corresponding to distinct symbols.

Definition at line 261 of file XRefs.cpp.

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

◆ log()

template<typename... Ts>
void clang::clangd::log ( const char *  Fmt,
Ts &&...  Vals 
)

◆ lookup()

std::vector< std::string > clang::clangd::lookup ( const SymbolIndex I,
llvm::ArrayRef< SymbolID IDs 
)

◆ lower()

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

◆ lspEncoding()

static OffsetEncoding clang::clangd::lspEncoding ( )
static

◆ lspLength() [1/2]

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

◆ lspLength() [2/2]

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

Definition at line 117 of file SourceCode.cpp.

References iterateCodepoints(), lspEncoding(), UnsupportedEncoding, UTF16, UTF32, and UTF8.

Referenced by offsetToPosition().

◆ match()

std::vector< std::string > clang::clangd::match ( const SymbolIndex I,
const FuzzyFindRequest Req,
bool *  Incomplete 
)

◆ MATCHER() [1/4]

clang::clangd::MATCHER ( Declared  ,
""   
)

Definition at line 27 of file BackgroundIndexTests.cpp.

◆ MATCHER() [2/4]

clang::clangd::MATCHER ( Defined  ,
""   
)

Definition at line 30 of file BackgroundIndexTests.cpp.

◆ MATCHER() [3/4]

clang::clangd::MATCHER ( EmptyIncludeNode  ,
""   
)

Definition at line 37 of file BackgroundIndexTests.cpp.

References clang::clangd::IncludeGraphNode::None.

◆ MATCHER() [4/4]

clang::clangd::MATCHER ( HadErrors  ,
""   
)

◆ MATCHER_P() [1/3]

clang::clangd::MATCHER_P ( Named  ,
,
""   
)

Definition at line 26 of file BackgroundIndexTests.cpp.

◆ MATCHER_P() [2/3]

clang::clangd::MATCHER_P ( FileURI  ,
,
""   
)

Definition at line 31 of file BackgroundIndexTests.cpp.

◆ MATCHER_P() [3/3]

clang::clangd::MATCHER_P ( NumReferences  ,
,
""   
)

Definition at line 46 of file BackgroundIndexTests.cpp.

◆ maybeCaseFoldPath()

static std::string clang::clangd::maybeCaseFoldPath ( PathRef  Path)
static

Definition at line 126 of file GlobalCompilationDatabase.cpp.

Referenced by pathEqual().

◆ measureUnits()

static size_t clang::clangd::measureUnits ( llvm::StringRef  U8,
int  Units,
OffsetEncoding  Enc,
bool &  Valid 
)
static

Definition at line 73 of file SourceCode.cpp.

References iterateCodepoints(), Result, UnsupportedEncoding, UTF16, UTF32, and UTF8.

Referenced by positionToOffset().

◆ mergeSymbol()

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

◆ 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 292 of file JSONTransport.cpp.

◆ newXPCTransport()

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

Definition at line 211 of file XPCTransport.cpp.

◆ ns()

Symbol clang::clangd::ns ( llvm::StringRef  Name)

Definition at line 72 of file TestIndex.cpp.

References sym().

◆ offsetToClangLineColumn()

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

Definition at line 381 of file SourceCode.cpp.

References Lines, and Offset.

◆ 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 174 of file SourceCode.cpp.

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

Referenced by clang::clangd::Annotations::point(), clang::clangd::Annotations::points(), replacementToEdit(), and toLSPRange().

◆ operator &() [1/3]

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

Definition at line 38 of file SymbolOrigin.h.

References operator<<().

◆ operator &() [2/3]

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

Definition at line 41 of file Ref.h.

References operator<<().

◆ operator &() [3/3]

bool clang::clangd::operator& ( IncludeGraphNode::SourceFlag  A,
IncludeGraphNode::SourceFlag  B 
)
inline

Definition at line 90 of file Headers.h.

◆ operator<() [1/4]

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

Definition at line 58 of file Ref.h.

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

◆ operator<() [2/4]

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

◆ operator<() [3/4]

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

◆ operator<() [4/4]

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

◆ operator<<() [1/36]

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

Definition at line 14 of file Ref.cpp.

◆ operator<<() [2/36]

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

Definition at line 14 of file Symbol.cpp.

◆ operator<<() [3/36]

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

Definition at line 14 of file SymbolOrigin.cpp.

◆ operator<<() [4/36]

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

Definition at line 25 of file Symbol.cpp.

◆ operator<<() [5/36]

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

Definition at line 30 of file Ref.cpp.

◆ operator<<() [6/36]

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

Definition at line 32 of file SymbolLocation.cpp.

◆ operator<<() [7/36]

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

Definition at line 46 of file SymbolID.cpp.

◆ operator<<() [8/36]

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

Definition at line 79 of file Protocol.cpp.

◆ operator<<() [9/36]

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

Definition at line 104 of file Protocol.cpp.

◆ operator<<() [10/36]

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

Definition at line 120 of file Protocol.cpp.

◆ operator<<() [11/36]

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

Definition at line 131 of file Protocol.cpp.

◆ operator<<() [12/36]

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

Definition at line 153 of file Protocol.cpp.

◆ operator<<() [13/36]

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

◆ operator<<() [14/36]

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

◆ operator<<() [15/36]

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

Definition at line 228 of file Headers.cpp.

◆ operator<<() [16/36]

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

Definition at line 251 of file Quality.cpp.

◆ operator<<() [17/36]

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

◆ operator<<() [18/36]

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

Definition at line 268 of file Diagnostics.cpp.

◆ operator<<() [19/36]

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

Definition at line 278 of file Diagnostics.cpp.

References D, Fix(), clang::clangd::Diag::Fixes, and clang::clangd::Diag::Notes.

◆ operator<<() [20/36]

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

Definition at line 425 of file Quality.cpp.

◆ operator<<() [21/36]

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

Definition at line 487 of file Protocol.cpp.

◆ operator<<() [22/36]

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

Definition at line 494 of file Quality.cpp.

◆ operator<<() [23/36]

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

◆ operator<<() [24/36]

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

◆ operator<<() [25/36]

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

Definition at line 625 of file Protocol.cpp.

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

◆ operator<<() [26/36]

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

Definition at line 665 of file Serialization.cpp.

◆ operator<<() [27/36]

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

Definition at line 725 of file Protocol.cpp.

◆ operator<<() [28/36]

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

Definition at line 819 of file Protocol.cpp.

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

◆ operator<<() [29/36]

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

Definition at line 861 of file Protocol.cpp.

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

◆ operator<<() [30/36]

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

◆ operator<<() [31/36]

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

Definition at line 960 of file Protocol.cpp.

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

◆ operator<<() [32/36]

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

Definition at line 1036 of file XRefs.cpp.

◆ operator<<() [33/36]

llvm::raw_ostream & clang::clangd::operator<< ( llvm::raw_ostream &  OS,
OffsetEncoding  Enc 
)

Definition at line 1042 of file Protocol.cpp.

◆ operator<<() [34/36]

llvm::raw_ostream & clang::clangd::operator<< ( llvm::raw_ostream &  OS,
const HoverInfo::Param P 
)

Definition at line 1299 of file XRefs.cpp.

◆ operator<<() [35/36]

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

◆ operator<<() [36/36]

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

Definition at line 1853 of file CodeComplete.cpp.

◆ operator==() [1/8]

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

Definition at line 61 of file Ref.h.

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

◆ operator==() [2/8]

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

◆ operator==() [3/8]

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

◆ operator==() [4/8]

bool clang::clangd::operator== ( const HoverInfo::Param LHS,
const HoverInfo::Param RHS 
)
inline

◆ operator==() [5/8]

bool clang::clangd::operator== ( const TextEdit L,
const TextEdit R 
)
inline

◆ operator==() [6/8]

bool clang::clangd::operator== ( const HighlightingToken Lhs,
const HighlightingToken Rhs 
)

◆ operator==() [7/8]

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

◆ operator==() [8/8]

bool clang::clangd::operator== ( const SemanticHighlightingInformation Lhs,
const SemanticHighlightingInformation Rhs 
)

◆ operator|() [1/4]

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

Definition at line 31 of file SymbolOrigin.h.

◆ operator|() [2/4]

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

Definition at line 36 of file Ref.h.

◆ operator|() [3/4]

Definition at line 84 of file Headers.h.

◆ operator|() [4/4]

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

Definition at line 132 of file Symbol.h.

◆ operator|=() [1/4]

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

Definition at line 35 of file SymbolOrigin.h.

◆ operator|=() [2/4]

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

Definition at line 40 of file Ref.h.

◆ operator|=() [3/4]

Definition at line 96 of file Headers.h.

◆ operator|=() [4/4]

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

Definition at line 137 of file Symbol.h.

References operator<<().

◆ own()

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

◆ packedLookup()

template<typename T >
static T clang::clangd::packedLookup ( const uint8_t *  Data,
int  I 
)
static

Definition at line 151 of file FuzzyMatch.cpp.

◆ pathEqual()

static bool clang::clangd::pathEqual ( PathRef  A,
PathRef  B 
)
static

◆ pointBounds()

static std::pair<unsigned, unsigned> clang::clangd::pointBounds ( unsigned  Offset,
FileID  FID,
ASTContext &  AST 
)
static

Definition at line 323 of file Selection.cpp.

References Offset.

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

◆ 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 141 of file SourceCode.cpp.

References clang::clangd::Position::character, clang::clangd::Position::line, Line, lspEncoding(), and measureUnits().

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

◆ prefer()

bool clang::clangd::prefer ( const SymbolLocation L,
const SymbolLocation R 
)

Definition at line 150 of file Merge.cpp.

References Loc.

Referenced by mergeSymbol().

◆ prepareCompilerInstance() [1/2]

std::unique_ptr<CompilerInstance> clang::clangd::prepareCompilerInstance ( std::unique_ptr< clang::CompilerInvocation >  ,
const PrecompiledPreamble *  ,
std::unique_ptr< llvm::MemoryBuffer >  MainFile,
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.

◆ prepareCompilerInstance() [2/2]

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

Definition at line 72 of file Compiler.cpp.

References VFS.

◆ prepareTweak()

llvm::Expected< std::unique_ptr< Tweak > > clang::clangd::prepareTweak ( StringRef  ID,
const Tweak::Selection S 
)

Definition at line 69 of file Tweak.cpp.

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

◆ prepareTweaks()

std::vector< std::unique_ptr< Tweak > > clang::clangd::prepareTweaks ( const Tweak::Selection S,
llvm::function_ref< bool(const Tweak &)>  Filter 
)

Calls prepare() on all tweaks that satisfy the filter, returning those that can run on the selection.

Definition at line 51 of file Tweak.cpp.

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

◆ printDefinition()

static std::string clang::clangd::printDefinition ( const Decl *  D)
static

Definition at line 515 of file XRefs.cpp.

References Definition.

◆ printingPolicyForDecls()

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

Definition at line 462 of file XRefs.cpp.

Referenced by getHoverContents().

◆ 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 90 of file AST.cpp.

References Name.

Referenced by getHoverContents().

◆ printNamespaceScope()

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

Returns the first enclosing namespace scope starting from DC.

Definition at line 146 of file AST.cpp.

References Ctx, and printQualifiedName().

◆ printParams()

static void clang::clangd::printParams ( llvm::raw_ostream &  OS,
const std::vector< HoverInfo::Param > &  Params 
)
static

Definition at line 525 of file XRefs.cpp.

◆ 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 75 of file AST.cpp.

References QName.

Referenced by clang::clangd::IncludeFixer::fix(), and printNamespaceScope().

◆ printTemplateSpecializationArgs()

std::string clang::clangd::printTemplateSpecializationArgs ( const NamedDecl &  ND)

Prints template arguments of a decl as written in the source code, including enclosing '<' and '>', e.g for a partial specialization like: template <typename u>=""> struct Foo<int, U> will return '<int, U>'.

Returns an empty string if decl is not a template specialization.

Definition at line 117 of file AST.cpp.

◆ printType()

std::string clang::clangd::printType ( const QualType  QT,
const DeclContext &  Context 
)

Returns a QualType as string.

Definition at line 193 of file AST.cpp.

◆ qualifiedByUnresolved()

llvm::Optional<std::string> clang::clangd::qualifiedByUnresolved ( const SourceManager &  SM,
SourceLocation  Loc,
const LangOptions &  LangOpts 
)

Definition at line 195 of file clangd/IncludeFixer.cpp.

◆ quality()

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

Computes query-independent quality score for a Symbol.

This currently falls in the range [1, ln(#indexed documents)]. FIXME: this should probably be split into symbol -> signals and signals -> score, so it can be reused for Sema completions.

Definition at line 29 of file Symbol.cpp.

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

Referenced by visitStrings().

◆ readIndexFile()

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

◆ readYAML()

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

◆ RefsAre()

::testing::Matcher<const RefSlab &> clang::clangd::RefsAre ( std::vector<::testing::Matcher< Ref >>  Matchers)

Definition at line 33 of file BackgroundIndexTests.cpp.

Referenced by MATCHER_P().

◆ relationKindToSymbolRole()

index::SymbolRole clang::clangd::relationKindToSymbolRole ( RelationKind  Kind)

Definition at line 46 of file Serialization.cpp.

References BaseOf.

Referenced by llvm::yaml::NormalizedSymbolRole::denormalize().

◆ removeDots()

Path clang::clangd::removeDots ( PathRef  File)

Returns a version of File that doesn't contain dots and dot dots.

e.g /a/b/../c -> /a/c /a/b/./c -> /a/b/c FIXME: We should avoid encountering such paths in clangd internals by filtering everything we get over LSP, CDB, etc.

Definition at line 114 of file FS.cpp.

Referenced by clang::clangd::OverlayCDB::getCompileCommand(), clang::clangd::OverlayCDB::getProjectInfo(), pathEqual(), and clang::clangd::OverlayCDB::setCompileCommand().

◆ renameWithinFile()

llvm::Expected< tooling::Replacements > clang::clangd::renameWithinFile ( ParsedAST AST,
llvm::StringRef  File,
Position  Pos,
llvm::StringRef  NewName,
const SymbolIndex Index = nullptr 
)

Renames all occurrences of the symbol at Pos to NewName.

Occurrences outside the current file are not modified. Returns an error if rename a symbol that's used in another file (per the index).

Definition at line 161 of file Rename.cpp.

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

◆ replace()

static std::string clang::clangd::replace ( llvm::StringRef  Haystack,
llvm::StringRef  Needle,
llvm::StringRef  Repl 
)
static

◆ 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 406 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 398 of file SourceCode.cpp.

References offsetToPosition().

◆ resolveTypeHierarchy()

void clang::clangd::resolveTypeHierarchy ( TypeHierarchyItem Item,
int  ResolveLevels,
TypeHierarchyDirection  Direction,
const SymbolIndex Index 
)

◆ runAddDocument() [1/2]

void clang::clangd::runAddDocument ( ClangdServer Server,
PathRef  File,
llvm::StringRef  Contents,
WantDiagnostics  WantDiags 
)

◆ runAddDocument() [2/2]

void clang::clangd::runAddDocument ( ClangdServer Server,
PathRef  File,
StringRef  Contents,
WantDiagnostics  WantDiags = WantDiagnostics::Auto 
)

◆ 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 244 of file TUScheduler.h.

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

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

◆ runCodeComplete()

llvm::Expected< CodeCompleteResult > clang::clangd::runCodeComplete ( ClangdServer Server,
PathRef  File,
Position  Pos,
clangd::CodeCompleteOptions  Opts 
)

Definition at line 73 of file SyncAPI.cpp.

◆ runDocumentSymbols()

Expected< std::vector< DocumentSymbol > > clang::clangd::runDocumentSymbols ( ClangdServer Server,
PathRef  File 
)

Definition at line 123 of file SyncAPI.cpp.

References clang::clangd::ClangdServer::documentSymbols(), and Result.

Referenced by TEST_F().

◆ runDumpAST()

std::string clang::clangd::runDumpAST ( ClangdServer Server,
PathRef  File 
)

Definition at line 109 of file SyncAPI.cpp.

References clang::clangd::ClangdServer::dumpAST(), and Result.

◆ runFindDocumentHighlights()

llvm::Expected< std::vector< DocumentHighlight > > clang::clangd::runFindDocumentHighlights ( ClangdServer Server,
PathRef  File,
Position  Pos 
)

Definition at line 95 of file SyncAPI.cpp.

References clang::clangd::ClangdServer::findDocumentHighlights(), and Result.

◆ runFuzzyFind() [1/3]

SymbolSlab clang::clangd::runFuzzyFind ( const SymbolIndex Index,
StringRef  Query 
)

◆ runFuzzyFind() [2/3]

SymbolSlab clang::clangd::runFuzzyFind ( const SymbolIndex Index,
llvm::StringRef  Query 
)

Definition at line 129 of file SyncAPI.cpp.

◆ runFuzzyFind() [3/3]

SymbolSlab clang::clangd::runFuzzyFind ( const SymbolIndex Index,
const FuzzyFindRequest Req 
)

◆ runLocateSymbolAt()

llvm::Expected< std::vector< LocatedSymbol > > clang::clangd::runLocateSymbolAt ( ClangdServer Server,
PathRef  File,
Position  Pos 
)

Definition at line 88 of file SyncAPI.cpp.

References clang::clangd::ClangdServer::locateSymbolAt(), and Result.

◆ runRename() [1/2]

llvm::Expected<std::vector<TextEdit> > clang::clangd::runRename ( ClangdServer Server,
PathRef  File,
Position  Pos,
StringRef  NewName 
)

◆ runRename() [2/2]

llvm::Expected<std::vector<TextEdit> > clang::clangd::runRename ( ClangdServer Server,
PathRef  File,
Position  Pos,
llvm::StringRef  NewName 
)

Definition at line 101 of file SyncAPI.cpp.

References clang::clangd::ClangdServer::rename(), and Result.

◆ runSignatureHelp()

llvm::Expected< SignatureHelp > clang::clangd::runSignatureHelp ( ClangdServer Server,
PathRef  File,
Position  Pos 
)

Definition at line 80 of file SyncAPI.cpp.

References Result, and clang::clangd::ClangdServer::signatureHelp().

◆ runWorkspaceSymbols() [1/2]

llvm::Expected<std::vector<SymbolInformation> > clang::clangd::runWorkspaceSymbols ( ClangdServer Server,
StringRef  Query,
int  Limit 
)

◆ runWorkspaceSymbols() [2/2]

llvm::Expected<std::vector<SymbolInformation> > clang::clangd::runWorkspaceSymbols ( ClangdServer Server,
llvm::StringRef  Query,
int  Limit 
)

Definition at line 116 of file SyncAPI.cpp.

◆ scopeBoost()

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

◆ scopeToPath()

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

◆ shortenNamespace()

std::string clang::clangd::shortenNamespace ( const llvm::StringRef  OriginalName,
const llvm::StringRef  CurrentNamespace 
)

Try to shorten the OriginalName by removing namespaces from the left of the string that are redundant in the CurrentNamespace.

This way the type idenfier become shorter and easier to read. Limitation: It only handles the qualifier of the type itself, not that of templates. FIXME: change type of parameter CurrentNamespace to DeclContext , take in to account using directives etc Example: shortenNamespace("ns1::MyClass<ns1::OtherClass>", "ns1") –> "MyClass<ns1::OtherClass>"

Definition at line 172 of file AST.cpp.

References clang::tidy::cppcoreguidelines::join(), and Result.

◆ 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,
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,
const SymbolIndex Index 
)

◆ 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 482 of file Quality.cpp.

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

◆ sourceLocationInMainFile()

llvm::Expected< SourceLocation > clang::clangd::sourceLocationInMainFile ( const SourceManager &  SM,
Position  P 
)

Return the file location, corresponding to P.

Note that one should take care to avoid comparing the result with expansion locations.

Definition at line 363 of file SourceCode.cpp.

◆ 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 186 of file SourceCode.cpp.

◆ splitQualifiedName() [1/2]

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.

◆ splitQualifiedName() [2/2]

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

Definition at line 391 of file SourceCode.cpp.

◆ sym()

Symbol clang::clangd::sym ( llvm::StringRef  QName,
index::SymbolKind  Kind,
llvm::StringRef  USRFormat 
)

◆ symbol()

Symbol clang::clangd::symbol ( llvm::StringRef  QName)

◆ symbolRoleToRelationKind()

RelationKind clang::clangd::symbolRoleToRelationKind ( index::SymbolRole  Role)

Definition at line 34 of file Serialization.cpp.

References BaseOf.

Referenced by llvm::yaml::NormalizedSymbolRole::NormalizedSymbolRole().

◆ symbolToLocation()

llvm::Expected< Location > clang::clangd::symbolToLocation ( const Symbol Sym,
llvm::StringRef  HintPath 
)

Helper function for deriving an LSP Location for a Symbol.

Definition at line 42 of file FindSymbols.cpp.

Referenced by symbolToTypeHierarchyItem().

◆ symbolToTypeHierarchyItem()

static Optional<TypeHierarchyItem> clang::clangd::symbolToTypeHierarchyItem ( const Symbol S,
const SymbolIndex Index,
PathRef  TUPath 
)
static

◆ TEST() [1/5]

clang::clangd::TEST ( ContextTests  ,
Simple   
)

◆ TEST() [2/5]

clang::clangd::TEST ( ContextTests  ,
MoveOps   
)

◆ TEST() [3/5]

clang::clangd::TEST ( ContextTests  ,
Builders   
)

◆ TEST() [4/5]

clang::clangd::TEST ( BackgroundQueueTest  ,
Priority   
)

◆ TEST() [5/5]

clang::clangd::TEST ( BackgroundQueueTest  ,
Boost   
)

Definition at line 681 of file BackgroundIndexTests.cpp.

◆ TEST_F() [1/38]

clang::clangd::TEST_F ( ThreadingTest  ,
TaskRunner   
)

Definition at line 17 of file ThreadingTests.cpp.

◆ TEST_F() [2/38]

clang::clangd::TEST_F ( BackgroundIndexTest  ,
NoCrashOnErrorFile   
)

Definition at line 88 of file BackgroundIndexTests.cpp.

References clang::clangd::MockFSProvider::Files, FS, and testPath().

◆ TEST_F() [3/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
Macros   
)

Definition at line 90 of file FindSymbolsTests.cpp.

References QName, and String.

◆ TEST_F() [4/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
NoLocals   
)

Definition at line 102 of file FindSymbolsTests.cpp.

◆ TEST_F() [5/38]

clang::clangd::TEST_F ( BackgroundIndexTest  ,
IndexTwoFiles   
)

Definition at line 107 of file BackgroundIndexTests.cpp.

References clang::clangd::MockFSProvider::Files, FS, and testPath().

◆ TEST_F() [6/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
Globals   
)

Definition at line 112 of file FindSymbolsTests.cpp.

References Function, QName, Struct, and Variable.

◆ TEST_F() [7/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
Unnamed   
)

Definition at line 129 of file FindSymbolsTests.cpp.

References Field, QName, and Variable.

◆ TEST_F() [8/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
InMainFile   
)

Definition at line 145 of file FindSymbolsTests.cpp.

◆ TEST_F() [9/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
Namespaces   
)

Definition at line 153 of file FindSymbolsTests.cpp.

References QName.

◆ TEST_F() [10/38]

clang::clangd::TEST_F ( BackgroundIndexTest  ,
ShardStorageTest   
)

Definition at line 177 of file BackgroundIndexTests.cpp.

References clang::clangd::MockFSProvider::Files, FS, and testPath().

◆ TEST_F() [11/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
AnonymousNamespace   
)

Definition at line 181 of file FindSymbolsTests.cpp.

References QName.

◆ TEST_F() [12/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
MultiFile   
)

Definition at line 193 of file FindSymbolsTests.cpp.

References QName.

◆ TEST_F() [13/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
GlobalNamespaceQueries   
)

Definition at line 210 of file FindSymbolsTests.cpp.

References Class, Function, Namespace, and QName.

◆ TEST_F() [14/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
Enums   
)

Definition at line 234 of file FindSymbolsTests.cpp.

References QName.

◆ TEST_F() [15/38]

clang::clangd::TEST_F ( BackgroundIndexTest  ,
DirectIncludesTest   
)

Definition at line 249 of file BackgroundIndexTests.cpp.

References clang::clangd::MockFSProvider::Files, FS, and testPath().

◆ TEST_F() [16/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
Ranking   
)

Definition at line 274 of file FindSymbolsTests.cpp.

References QName.

◆ TEST_F() [17/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
WithLimit   
)

Definition at line 285 of file FindSymbolsTests.cpp.

References Limit, QName, and Variable.

◆ TEST_F() [18/38]

clang::clangd::TEST_F ( BackgroundIndexTest  ,
ShardStorageLoad   
)

Definition at line 300 of file BackgroundIndexTests.cpp.

References clang::clangd::MockFSProvider::Files, FS, and testPath().

◆ TEST_F() [19/38]

clang::clangd::TEST_F ( WorkspaceSymbolsTest  ,
TempSpecs   
)

◆ TEST_F() [20/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
BasicSymbols   
)

Definition at line 346 of file FindSymbolsTests.cpp.

References Children, Class, Function, Method, Namespace, testPath(), and Variable.

◆ TEST_F() [21/38]

clang::clangd::TEST_F ( BackgroundIndexTest  ,
ShardStorageEmptyFile   
)

Definition at line 371 of file BackgroundIndexTests.cpp.

References clang::clangd::MockFSProvider::Files, FS, and testPath().

◆ TEST_F() [22/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
DeclarationDefinition   
)

◆ TEST_F() [23/38]

clang::clangd::TEST_F ( BackgroundIndexTest  ,
NoDotsInAbsPath   
)

Definition at line 439 of file BackgroundIndexTests.cpp.

References FS.

◆ TEST_F() [24/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
ExternSymbol   
)

Definition at line 454 of file FindSymbolsTests.cpp.

References testPath().

◆ TEST_F() [25/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
NoLocals   
)

Definition at line 466 of file FindSymbolsTests.cpp.

References testPath().

◆ TEST_F() [26/38]

clang::clangd::TEST_F ( BackgroundIndexTest  ,
UncompilableFiles   
)

Definition at line 468 of file BackgroundIndexTests.cpp.

References FS.

◆ TEST_F() [27/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
Unnamed   
)

Definition at line 477 of file FindSymbolsTests.cpp.

References Children, Field, Struct, testPath(), and Variable.

◆ TEST_F() [28/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
InHeaderFile   
)

Definition at line 495 of file FindSymbolsTests.cpp.

References testPath().

◆ TEST_F() [29/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
Template   
)

Definition at line 512 of file FindSymbolsTests.cpp.

References Children, Field, Struct, and testPath().

◆ TEST_F() [30/38]

clang::clangd::TEST_F ( BackgroundIndexTest  ,
CmdLineHash   
)

Definition at line 531 of file BackgroundIndexTests.cpp.

References FS.

◆ TEST_F() [31/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
Namespaces   
)

Definition at line 549 of file FindSymbolsTests.cpp.

References Children, and testPath().

◆ TEST_F() [32/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
Enums   
)

Definition at line 587 of file FindSymbolsTests.cpp.

References Children, and testPath().

◆ TEST_F() [33/38]

clang::clangd::TEST_F ( BackgroundIndexRebuilderTest  ,
IndexingTUs   
)

Definition at line 613 of file BackgroundIndexTests.cpp.

◆ TEST_F() [34/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
FromMacro   
)

Definition at line 615 of file FindSymbolsTests.cpp.

References clang::clangd::Annotations::range(), and testPath().

◆ TEST_F() [35/38]

clang::clangd::TEST_F ( BackgroundIndexRebuilderTest  ,
LoadingShards   
)

Definition at line 622 of file BackgroundIndexTests.cpp.

◆ TEST_F() [36/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
FuncTemplates   
)

Definition at line 636 of file FindSymbolsTests.cpp.

References testPath().

◆ TEST_F() [37/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
UsingDirectives   
)

Definition at line 651 of file FindSymbolsTests.cpp.

References testPath().

◆ TEST_F() [38/38]

clang::clangd::TEST_F ( DocumentSymbolsTest  ,
TempSpecs   
)

Definition at line 670 of file FindSymbolsTests.cpp.

References Class.

◆ testPath()

std::string clang::clangd::testPath ( PathRef  File)

Definition at line 82 of file TestFS.cpp.

References File, and testRoot().

Referenced by clang::clangd::TestTU::build(), and TEST_F().

◆ testRoot()

const char * clang::clangd::testRoot ( )

◆ 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::BackgroundQueue::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 300 of file Diagnostics.cpp.

Referenced by toLSPDiags().

◆ toHalfOpenFileRange()

llvm::Optional< SourceRange > clang::clangd::toHalfOpenFileRange ( const SourceManager &  Mgr,
const LangOptions &  LangOpts,
SourceRange  R 
)

Turns a token range into a half-open range and checks its correctness.

The resulting range will have only valid source location on both sides, both of which are file locations.

File locations always point to a particular offset in a file, i.e. they never refer to a location inside a macro expansion. Turning locations from macro expansions into file locations is ambiguous - one can use SourceManager::{getExpansion|getFile|getSpelling}Loc. This function calls SourceManager::getFileLoc on both ends of R to do the conversion.

User input (e.g. cursor position) is expressed as a file location, so this function can be viewed as a way to normalize the ranges used in the clang AST so that they are comparable with ranges coming from the user input.

Definition at line 331 of file SourceCode.cpp.

◆ toHeaderFile()

llvm::Expected< HeaderFile > clang::clangd::toHeaderFile ( llvm::StringRef  Header,
llvm::StringRef  HintPath 
)

Creates a HeaderFile from Header which can be either a URI or a literal include.

Definition at line 77 of file Headers.cpp.

◆ toJSON() [1/32]

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

Definition at line 48 of file Index.cpp.

Referenced by operator<<().

◆ toJSON() [2/32]

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.

◆ toJSON() [3/32]

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

Definition at line 83 of file Protocol.cpp.

◆ toJSON() [4/32]

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

Definition at line 97 of file Protocol.cpp.

◆ toJSON() [5/32]

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

Definition at line 113 of file Protocol.cpp.

◆ toJSON() [6/32]

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

Definition at line 124 of file Protocol.cpp.

◆ toJSON() [7/32]

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

Definition at line 146 of file Protocol.cpp.

◆ toJSON() [8/32]

llvm::json::Value clang::clangd::toJSON ( const MessageType R)

Definition at line 369 of file Protocol.cpp.

◆ toJSON() [9/32]

llvm::json::Value clang::clangd::toJSON ( const ShowMessageParams R)

Definition at line 373 of file Protocol.cpp.

◆ toJSON() [10/32]

llvm::json::Value clang::clangd::toJSON ( const DiagnosticRelatedInformation DRI)

Definition at line 445 of file Protocol.cpp.

◆ toJSON() [11/32]

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

Definition at line 452 of file Protocol.cpp.

◆ toJSON() [12/32]

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

Definition at line 540 of file Protocol.cpp.

◆ toJSON() [13/32]

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

Definition at line 560 of file Protocol.cpp.

◆ toJSON() [14/32]

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

Definition at line 599 of file Protocol.cpp.

◆ toJSON() [15/32]

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

Definition at line 612 of file Protocol.cpp.

◆ toJSON() [16/32]

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

Definition at line 629 of file Protocol.cpp.

◆ toJSON() [17/32]

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

Definition at line 645 of file Protocol.cpp.

◆ toJSON() [18/32]

llvm::json::Value clang::clangd::toJSON ( const TweakArgs A)

Definition at line 660 of file Protocol.cpp.

◆ toJSON() [19/32]

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

Definition at line 665 of file Protocol.cpp.

◆ toJSON() [20/32]

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

Definition at line 729 of file Protocol.cpp.

◆ toJSON() [21/32]

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

Definition at line 739 of file Protocol.cpp.

◆ toJSON() [22/32]

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

Definition at line 793 of file Protocol.cpp.

◆ toJSON() [23/32]

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

Definition at line 829 of file Protocol.cpp.

◆ toJSON() [24/32]

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

Definition at line 836 of file Protocol.cpp.

◆ toJSON() [25/32]

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

Definition at line 850 of file Protocol.cpp.

◆ toJSON() [26/32]

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

Definition at line 867 of file Protocol.cpp.

◆ toJSON() [27/32]

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

Definition at line 885 of file Protocol.cpp.

◆ toJSON() [28/32]

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

Definition at line 892 of file Protocol.cpp.

◆ toJSON() [29/32]

llvm::json::Value clang::clangd::toJSON ( const TypeHierarchyItem I)

Definition at line 965 of file Protocol.cpp.

◆ toJSON() [30/32]

llvm::json::Value clang::clangd::toJSON ( const OffsetEncoding OE)

Definition at line 1030 of file Protocol.cpp.

◆ toJSON() [31/32]

llvm::json::Value clang::clangd::toJSON ( const SemanticHighlightingInformation Highlighting)

Definition at line 1051 of file Protocol.cpp.

◆ toJSON() [32/32]

llvm::json::Value clang::clangd::toJSON ( const SemanticHighlightingParams Highlighting)

Definition at line 1056 of file Protocol.cpp.

◆ toLSPDiags()

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

◆ toLSPRange()

static clangd::Range clang::clangd::toLSPRange ( llvm::StringRef  Code,
Annotations::Range  R 
)
static

◆ toSemanticHighlightingInformation()

std::vector< SemanticHighlightingInformation > clang::clangd::toSemanticHighlightingInformation ( llvm::ArrayRef< HighlightingToken Tokens)

Definition at line 274 of file SemanticHighlighting.cpp.

References Line, and Lines.

◆ toSourceCode()

llvm::StringRef clang::clangd::toSourceCode ( const SourceManager &  SM,
SourceRange  R 
)

Returns the source code covered by the source range.

EXPECTS: isValidFileRange(R) == true.

Definition at line 352 of file SourceCode.cpp.

◆ toString()

static const char* clang::clangd::toString ( OffsetEncoding  OE)
static

Definition at line 1017 of file Protocol.cpp.

References UnsupportedEncoding, UTF16, UTF32, and UTF8.

Referenced by clang::clangd::dex::generateProximityURIs().

◆ toTextEdit()

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

◆ toTextKind()

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

Definition at line 698 of file Protocol.cpp.

References Markdown, and PlainText.

◆ toTextMateScope()

llvm::StringRef clang::clangd::toTextMateScope ( HighlightingKind  Kind)

Converts a HighlightingKind to a corresponding TextMate scope (https://manual.macromates.com/en/language_grammars).

Definition at line 306 of file SemanticHighlighting.cpp.

References Class, Enum, EnumConstant, Field, Function, Method, Namespace, NumKinds, TemplateParameter, and Variable.

◆ toTokenRange()

static SourceRange clang::clangd::toTokenRange ( CharSourceRange  Range,
const SourceManager &  SM,
const LangOptions &  LangOpts 
)
static

Definition at line 281 of file SourceCode.cpp.

◆ toYAML() [1/4]

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

Definition at line 391 of file YAMLSerialization.cpp.

◆ toYAML() [2/4]

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

◆ toYAML() [3/4]

std::string clang::clangd::toYAML ( const Relation R)

Definition at line 413 of file YAMLSerialization.cpp.

◆ toYAML() [4/4]

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

Definition at line 402 of file YAMLSerialization.cpp.

References Refs.

◆ transformCursorPosition()

unsigned clang::clangd::transformCursorPosition ( unsigned  Offset,
const std::vector< tooling::Replacement > &  Replacements 
)

Determine the new cursor position after applying Replacements.

Analogue of tooling::Replacements::getShiftedCodePosition().

Definition at line 352 of file Format.cpp.

◆ tweakSelection()

static llvm::Expected<Tweak::Selection> clang::clangd::tweakSelection ( const Range Sel,
const InputsAndAST AST 
)
static

◆ typeParents()

std::vector< const CXXRecordDecl * > clang::clangd::typeParents ( const CXXRecordDecl *  CXXRD)

Given a record type declaration, find its base (parent) types.

Definition at line 1190 of file XRefs.cpp.

References Base, Result, and Type.

◆ unionTokenRange()

static SourceRange clang::clangd::unionTokenRange ( SourceRange  R1,
SourceRange  R2,
const SourceManager &  SM,
const LangOptions &  LangOpts 
)
static

Definition at line 290 of file SourceCode.cpp.

◆ uriProximity()

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

◆ var()

Symbol clang::clangd::var ( llvm::StringRef  Name)

Definition at line 68 of file TestIndex.cpp.

References sym().

◆ visibleNamespaces()

std::vector< std::string > clang::clangd::visibleNamespaces ( llvm::StringRef  Code,
const format::FormatStyle Style 
)

Heuristically determine namespaces visible at a point, without parsing Code.

This considers using-directives and enclosing namespace-declarations that are visible (and not obfuscated) in the file itself (not headers). Code should be truncated at the point of interest.

The returned vector is always non-empty.

  • The first element is the namespace that encloses the point: a declaration near the point would be within this namespace.
  • The elements are the namespaces in scope at the point: an unqualified lookup would search within these namespaces.

Using directives are resolved against all enclosing scopes, but no other namespace directives.

example: using namespace a; namespace foo { using namespace b;

visibleNamespaces are {"foo::", "", "a::", "b::", "foo::b::"}, not "a::b::".

Definition at line 663 of file SourceCode.cpp.

◆ visitStrings()

template<typename Callback >
void clang::clangd::visitStrings ( Symbol S,
const Callback CB 
)

◆ vlog()

template<typename... Ts>
void clang::clangd::vlog ( const char *  Fmt,
Ts &&...  Vals 
)

Definition at line 67 of file Logger.h.

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

Referenced by buildPreamble(), and toLSPDiags().

◆ 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 91 of file Threading.h.

◆ wait() [2/2]

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

◆ wordMatching()

static llvm::Optional<llvm::StringRef> clang::clangd::wordMatching ( llvm::StringRef  Name,
const llvm::StringSet<> *  ContextWords 
)
static

Definition at line 340 of file Quality.cpp.

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

◆ writeCodeToFixMessage()

static void clang::clangd::writeCodeToFixMessage ( llvm::raw_ostream &  OS,
llvm::StringRef  Code 
)
static

Sanitizes a piece for presenting it in a synthesized fix message.

Ensures the result is not too large and does not contain newlines.

Definition at line 449 of file Diagnostics.cpp.

◆ writeYAML()

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

Definition at line 338 of file YAMLSerialization.cpp.

◆ X()

static URISchemeRegistry::Add<TestScheme> clang::clangd::X ( TestScheme::Scheme  ,
"Test schema"   
)
static

◆ xpcToJson()

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

Definition at line 26 of file Conversion.cpp.

Variable Documentation

◆ AwfulScore

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

Definition at line 72 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 141 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 114 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)
std::string 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 16 of file Cancellation.cpp.

◆ kCurrentOffsetEncoding

Key< OffsetEncoding > clang::clangd::kCurrentOffsetEncoding

Definition at line 110 of file SourceCode.cpp.

◆ kFileBeingProcessed

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

Definition at line 70 of file TUScheduler.cpp.

◆ PerfectBonus

constexpr int clang::clangd::PerfectBonus = 4
static

Definition at line 74 of file FuzzyMatch.cpp.

◆ PreventStarvation

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

Definition at line 14 of file BackgroundQueue.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().

◆ UnittestSchemeAnchorDest [1/2]

int LLVM_ATTRIBUTE_UNUSED clang::clangd::UnittestSchemeAnchorDest
static
Initial value:
=
volatile int UnittestSchemeAnchorSource
Definition: TestFS.cpp:132

Definition at line 19 of file URITests.cpp.

◆ UnittestSchemeAnchorDest [2/2]

int LLVM_ATTRIBUTE_UNUSED clang::clangd::UnittestSchemeAnchorDest
static
Initial value:
=
volatile int UnittestSchemeAnchorSource
Definition: TestFS.cpp:132

Definition at line 36 of file QualityTests.cpp.

◆ UnittestSchemeAnchorSource

volatile int clang::clangd::UnittestSchemeAnchorSource = 0

Definition at line 132 of file TestFS.cpp.