clang-tools  14.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. More...
 

Static Public Member Functions

static llvm::Optional< OpaqueTypefromCompletionResult (ASTContext &Ctx, const CodeCompletionResult &R)
 Create a type from a code completion result. More...
 
static llvm::Optional< OpaqueTypefromType (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 34 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 87 of file ExpectedTypes.cpp.

References Ctx.

◆ 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 81 of file ExpectedTypes.cpp.

References Ctx, and 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 47 of file ExpectedTypes.h.

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 52 of file ExpectedTypes.h.

◆ operator==

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

Definition at line 49 of file ExpectedTypes.h.


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