clang-tools 8.0.0

Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::clangd::OpaqueType Class Reference

A representation of a type that can be computed based on clang AST and compared for equality. More...

`#include <ExpectedTypes.h>`

## Public Member Functions
llvm::StringRef | raw () const
| Get the raw byte representation of the type. More...

## Static Public Member Functions
static llvm::Optional< OpaqueType > | fromCompletionResult (ASTContext &Ctx, const CodeCompletionResult &R)
| Create a type from a code completion result. More...
static llvm::Optional< OpaqueType > | fromType (ASTContext &Ctx, QualType Type)
| Construct an instance from a clang::QualType. More...

## Friends
bool | operator== (const OpaqueType &L, const OpaqueType &R)
bool | operator!= (const OpaqueType &L, const OpaqueType &R)

## Detailed Description

A representation of a type that can be computed based on clang AST and compared for equality.

The encoding is stable between different ASTs, this allows the representation to be stored in the index and compared with types coming from a different AST later. OpaqueType is a strongly-typedefed std::string, you can get the underlying string with raw().

Definition at line 35 of file ExpectedTypes.h.

## Member Function Documentation

## ◆ fromCompletionResult()

llvm::Optional< OpaqueType > clang::clangd::OpaqueType::fromCompletionResult | ( | ASTContext & | Ctx,
|  | const CodeCompletionResult & | R
| ) |  |
| static

Create a type from a code completion result.

Definition at line 73 of file ExpectedTypes.cpp.

## ◆ fromType()

llvm::Optional< OpaqueType > clang::clangd::OpaqueType::fromType | ( | ASTContext & | Ctx,
|  | QualType | Type
| ) |  |
| static

Construct an instance from a clang::QualType.

This is usually a PreferredType from a clang's completion context.

Definition at line 67 of file ExpectedTypes.cpp.

## ◆ raw()

llvm::StringRef clang::clangd::OpaqueType::raw | ( |  | ) | const
| inline

Get the raw byte representation of the type.

You can only rely on the types being equal iff their raw representation is the same. The particular details of the used encoding might change over time and one should not rely on it.

Definition at line 48 of file ExpectedTypes.h.

## Friends And Related Function Documentation

## ◆ operator!=

bool operator!= | ( | const OpaqueType & | L,
|  | const OpaqueType & | R
| ) |  |
| friend

Definition at line 53 of file ExpectedTypes.h.

## ◆ operator==

bool operator== | ( | const OpaqueType & | L,
|  | const OpaqueType & | R
| ) |  |
| friend

Definition at line 50 of file ExpectedTypes.h.

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

- ExpectedTypes.h
- ExpectedTypes.cpp