clang-tools 20.0.0git
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.
 

Static Public Member Functions

static std::optional< OpaqueTypefromCompletionResult (ASTContext &Ctx, const CodeCompletionResult &R)
 Create a type from a code completion result.
 
static std::optional< OpaqueTypefromType (ASTContext &Ctx, QualType Type)
 Construct an instance from a clang::QualType.
 

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()

std::optional< OpaqueType > clang::clangd::OpaqueType::fromCompletionResult ( ASTContext &  Ctx,
const CodeCompletionResult &  R 
)
static

Create a type from a code completion result.

Definition at line 84 of file ExpectedTypes.cpp.

◆ fromType()

std::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 79 of file ExpectedTypes.cpp.

References Type.

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