clang-tools 8.0.0

Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::clangd::URIForFile Struct Reference

`#include <Protocol.h>`

## Public Member Functions
| URIForFile ()=default
llvm::StringRef | file () const
| Retrieves absolute path to the file. More...
| operator bool () const
std::string | uri () const

## Static Public Member Functions
static URIForFile | canonicalize (llvm::StringRef AbsPath, llvm::StringRef TUPath)
| Canonicalizes `AbsPath` via URI. More...
static llvm::Expected< URIForFile > | fromURI (const URI &U, llvm::StringRef HintPath)

## Friends
bool | operator== (const URIForFile &LHS, const URIForFile &RHS)
bool | operator!= (const URIForFile &LHS, const URIForFile &RHS)
bool | operator< (const URIForFile &LHS, const URIForFile &RHS)

## Detailed Description

Definition at line 71 of file Protocol.h.

## Constructor & Destructor Documentation

## ◆ URIForFile()

clang::clangd::URIForFile::URIForFile | ( |  | ) |
| default

Referenced by canonicalize().

## Member Function Documentation

## ◆ canonicalize()

URIForFile clang::clangd::URIForFile::canonicalize | ( | llvm::StringRef | AbsPath,
|  | llvm::StringRef | TUPath
| ) |  |
| static

Canonicalizes `AbsPath` via URI.

File paths in URIForFile can come from index or local AST. Path from index goes through URI transformation, and the final path is resolved by URI scheme and could potentially be different from the original path. Hence, we do the same transformation for all paths.

Files can be referred to by several paths (e.g. in the presence of links). Which one we prefer may depend on where we're coming from. `TUPath` is a hint, and should usually be the main entrypoint file we're processing.

Definition at line 32 of file Protocol.cpp.

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

Referenced by clang::clangd::TUStatus::render().

## ◆ file()

llvm::StringRef clang::clangd::URIForFile::file | ( |  | ) | const
| inline

Retrieves absolute path to the file.

Definition at line 91 of file Protocol.h.

References clang::clangd::File.

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

## ◆ fromURI()

llvm::Expected< URIForFile > clang::clangd::URIForFile::fromURI | ( | const URI & | U,
|  | llvm::StringRef | HintPath
| ) |  |
| static

Definition at line 45 of file Protocol.cpp.

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

## ◆ operator bool()

clang::clangd::URIForFile::operator bool | ( |  | ) | const
| inline explicit

Definition at line 93 of file Protocol.h.

References clang::clangd::File.

## ◆ uri()

std::string clang::clangd::URIForFile::uri | ( |  | ) | const
| inline

Definition at line 94 of file Protocol.h.

References clang::clangd::URI::createFile(), clang::clangd::File, and clang::clangd::URI::toString().

Referenced by clang::clangd::operator<<(), clang::clangd::toCodeAction(), and clang::clangd::toJSON().

## Friends And Related Function Documentation

## ◆ operator!=

bool operator!= | ( | const URIForFile & | LHS,
|  | const URIForFile & | RHS
| ) |  |
| friend

Definition at line 100 of file Protocol.h.

## ◆ operator<

bool operator< | ( | const URIForFile & | LHS,
|  | const URIForFile & | RHS
| ) |  |
| friend

Definition at line 104 of file Protocol.h.

## ◆ operator==

bool operator== | ( | const URIForFile & | LHS,
|  | const URIForFile & | RHS
| ) |  |
| friend

Definition at line 96 of file Protocol.h.

The documentation for this struct was generated from the following files:

- Protocol.h
- Protocol.cpp