clang-tools 10.0.0

Namespaces | Macros | Enumerations | Functions | Variables
SourceCode.cpp File Reference
`#include "SourceCode.h"`
`#include "Context.h"`
`#include "FuzzyMatch.h"`
`#include "Logger.h"`
`#include "Protocol.h"`
`#include "refactor/Tweak.h"`
`#include "clang/AST/ASTContext.h"`
`#include "clang/Basic/LangOptions.h"`
`#include "clang/Basic/SourceLocation.h"`
`#include "clang/Basic/SourceManager.h"`
`#include "clang/Basic/TokenKinds.h"`
`#include "clang/Driver/Types.h"`
`#include "clang/Format/Format.h"`
`#include "clang/Lex/Lexer.h"`
`#include "clang/Lex/Preprocessor.h"`
`#include "clang/Lex/Token.h"`
`#include "clang/Tooling/Core/Replacement.h"`
`#include "llvm/ADT/ArrayRef.h"`
`#include "llvm/ADT/None.h"`
`#include "llvm/ADT/STLExtras.h"`
`#include "llvm/ADT/StringExtras.h"`
`#include "llvm/ADT/StringMap.h"`
`#include "llvm/ADT/StringRef.h"`
`#include "llvm/Support/Compiler.h"`
`#include "llvm/Support/Errc.h"`
`#include "llvm/Support/Error.h"`
`#include "llvm/Support/ErrorHandling.h"`
`#include "llvm/Support/LineIterator.h"`
`#include "llvm/Support/MemoryBuffer.h"`
`#include "llvm/Support/Path.h"`
`#include "llvm/Support/SHA1.h"`
`#include "llvm/Support/VirtualFileSystem.h"`
`#include "llvm/Support/xxhash.h"`
`#include <algorithm>`
`#include <cstddef>`
`#include <string>`
`#include <vector>`
`#include "clang/Basic/OperatorKinds.def"`
Include dependency graph for SourceCode.cpp:

Go to the source code of this file.

## Namespaces
| clang
| ===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
| clang::clangd

## Macros
#define | OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemOnly) case tok::Token:
#define | OVERLOADED_OPERATOR_MULTI(Name, Spelling, Unary, Binary, MemOnly)

## Enumerations
enum | clang::clangd::@771::TokenFlavor

## Functions
template<typename Callback >
static bool | clang::clangd::iterateCodepoints (llvm::StringRef U8, const Callback &CB)
static size_t | clang::clangd::measureUnits (llvm::StringRef U8, int Units, OffsetEncoding Enc, bool &Valid)
static OffsetEncoding | clang::clangd::lspEncoding ()
size_t | clang::clangd::lspLength (llvm::StringRef Code)
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. More...
Position | clang::clangd::offsetToPosition (llvm::StringRef Code, size_t Offset)
| Turn an offset in Code into a [line, column] pair. More...
Position | clang::clangd::sourceLocToPosition (const SourceManager &SM, SourceLocation Loc)
| Turn a SourceLocation into a [line, column] pair. More...
bool | clang::clangd::isSpelledInSource (SourceLocation Loc, const SourceManager &SM)
| Returns true if the token at Loc is spelled in the source code. More...
llvm::Optional< Range > | clang::clangd::getTokenRange (const SourceManager &SM, const LangOptions &LangOpts, SourceLocation TokLoc)
| Returns the taken range at `TokLoc`. More...
SourceLocation | clang::clangd::getBeginningOfIdentifier (const Position &Pos, const SourceManager &SM, const LangOptions &LangOpts)
| Get the beginning SourceLocation at a specified `Pos` in the main file. More...
bool | clang::clangd::isValidFileRange (const SourceManager &Mgr, SourceRange R)
| Returns true iff all of the following conditions hold: More...
bool | clang::clangd::halfOpenRangeContains (const SourceManager &Mgr, SourceRange R, SourceLocation L)
| Returns true iff `L` is contained in `R`. More...
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`. More...
SourceLocation | clang::clangd::includeHashLoc (FileID IncludedFile, const SourceManager &SM)
| Returns the #include location through which IncludedFIle was loaded. More...
static unsigned | clang::clangd::getTokenLengthAtLoc (SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
static SourceLocation | clang::clangd::getLocForTokenEnd (SourceLocation BeginLoc, const SourceManager &SM, const LangOptions &LangOpts)
static SourceLocation | clang::clangd::getLocForTokenBegin (SourceLocation EndLoc, const SourceManager &SM, const LangOptions &LangOpts)
static SourceRange | clang::clangd::toTokenRange (CharSourceRange Range, const SourceManager &SM, const LangOptions &LangOpts)
static SourceRange | clang::clangd::unionTokenRange (SourceRange R1, SourceRange R2, const SourceManager &SM, const LangOptions &LangOpts)
static SourceRange | clang::clangd::rangeInCommonFile (SourceRange R, const SourceManager &SM, const LangOptions &LangOpts)
static SourceRange | clang::clangd::getExpansionTokenRangeInSameFile (SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
static SourceRange | clang::clangd::getTokenFileRange (SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
bool | clang::clangd::isInsideMainFile (SourceLocation Loc, const SourceManager &SM)
| Returns true iff `Loc` is inside the main file. More...
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. More...
llvm::StringRef | clang::clangd::toSourceCode (const SourceManager &SM, SourceRange R)
| Returns the source code covered by the source range. More...
llvm::Expected< SourceLocation > | clang::clangd::sourceLocationInMainFile (const SourceManager &SM, Position P)
| Return the file location, corresponding to `P`. More...
Range | clang::clangd::halfOpenToRange (const SourceManager &SM, CharSourceRange R)
std::pair< size_t, size_t > | clang::clangd::offsetToClangLineColumn (llvm::StringRef Code, size_t Offset)
std::pair< StringRef, StringRef > | clang::clangd::splitQualifiedName (StringRef QName)
TextEdit | clang::clangd::replacementToEdit (llvm::StringRef Code, const tooling::Replacement &R)
std::vector< TextEdit > | clang::clangd::replacementsToEdits (llvm::StringRef Code, const tooling::Replacements &Repls)
llvm::Optional< std::string > | clang::clangd::getCanonicalPath (const FileEntry *F, const SourceManager &SourceMgr)
| Get the canonical path of `F`. More...
TextEdit | clang::clangd::toTextEdit (const FixItHint &FixIt, const SourceManager &M, const LangOptions &L)
bool | clang::clangd::isRangeConsecutive (const Range &Left, const Range &Right)
FileDigest | clang::clangd::digest (llvm::StringRef Content)
llvm::Optional< FileDigest > | clang::clangd::digestFile (const SourceManager &SM, FileID FID)
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. More...
llvm::Expected< tooling::Replacements > | clang::clangd::cleanupAndFormat (StringRef Code, const tooling::Replacements &Replaces, const format::FormatStyle &Style)
| Cleanup and format the given replacements. More...
static void | clang::clangd::lex (llvm::StringRef Code, const LangOptions &LangOpts, llvm::function_ref< void(const clang::Token &, const SourceManager &SM)> Action)
llvm::StringMap< unsigned > | clang::clangd::collectIdentifiers (llvm::StringRef Content, const format::FormatStyle &Style)
| Collects identifiers with counts in the source code. More...
std::vector< Range > | clang::clangd::collectIdentifierRanges (llvm::StringRef Identifier, llvm::StringRef Content, const LangOptions &LangOpts)
| Collects all ranges of the given identifier in the source code. More...
std::vector< std::string > | clang::clangd::visibleNamespaces (llvm::StringRef Code, const format::FormatStyle &Style)
| Heuristically determine namespaces visible at a point, without parsing Code. More...
llvm::StringSet | clang::clangd::collectWords (llvm::StringRef Content)
| Collects words from the source code. More...
llvm::Optional< DefinedMacro > | clang::clangd::locateMacroAt (SourceLocation Loc, Preprocessor &PP)
| Gets the macro at a specified `Loc`. More...
llvm::Error | clang::clangd::reformatEdit (Edit &E, const format::FormatStyle &Style)
| Formats the edits and code around it according to Style. More...
EligibleRegion | clang::clangd::getEligiblePoints (llvm::StringRef Code, llvm::StringRef FullyQualifiedName, const format::FormatStyle &Style)
| Returns most eligible region to insert a definition for `FullyQualifiedName` in the `Code`. More...
bool | clang::clangd::isHeaderFile (llvm::StringRef FileName, llvm::Optional< LangOptions > LangOpts=llvm::None)
| Infers whether this is a header from the FileName and LangOpts (if presents). More...

## Variables
Key< OffsetEncoding > | clang::clangd::kCurrentOffsetEncoding

## Macro Definition Documentation

## ◆ OVERLOADED_OPERATOR

#define OVERLOADED_OPERATOR | ( |  | Name,
|  |  | Spelling,
|  |  | Token,
|  |  | Unary,
|  |  | Binary,
|  |  | MemOnly
| ) |  | case tok::Token:

## ◆ OVERLOADED_OPERATOR_MULTI

#define OVERLOADED_OPERATOR_MULTI | ( |  | Name,
|  |  | Spelling,
|  |  | Unary,
|  |  | Binary,
|  |  | MemOnly
| ) |  |

## Enumeration Type Documentation

## ◆ TokenFlavor

enum clang::clangd::@771::TokenFlavor

Definition at line 240 of file SourceCode.cpp.

## Variable Documentation

## ◆ Payload

std::string Payload

Definition at line 771 of file SourceCode.cpp.

Referenced by clang::clangd::dex::Dex::Dex(), and clang::clangd::MemIndex::MemIndex().

## ◆ Pos

Position Pos

Definition at line 772 of file SourceCode.cpp.

Referenced by clang::query::QueryParser::complete(), llvm::yaml::NormalizedPosition::denormalize(), clang::clangd::ClangdServer::findDocumentHighlights(), clang::clangd::ClangdServer::findHover(), clang::clangd::ClangdServer::findReferences(), clang::find_all_symbols::PragmaCommentHandler::HandleComment(), clang::clangd::ClangdServer::locateSymbolAt(), clang::clangd::offsetToPosition(), clang::clangd::operator==(), clang::clangd::URI::parse(), clang::clangd::ClangdServer::prepareRename(), clang::clangd::ClangdServer::rename(), clang::clangd::ClangdServer::semanticRanges(), clang::clangd::ClangdServer::signatureHelp(), clang::clangd::splitQualifiedName(), clang::clangd::sym(), clang::clangd::symbol(), clang::clangd::ClangdServer::symbolInfo(), and clang::clangd::ClangdServer::typeHierarchy().

## ◆ Trigger

enum { ... } Trigger