clang 24.0.0git
clang::TypeConstraint Class Reference

Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string> T> void print(T object); ~~~~~~~~~~~~~~~~~~~~~~ Semantically, this adds an "immediately-declared constraint" with extra arg: requires convertible_to<T, string> More...

#include "clang/AST/ASTConcept.h"

Public Member Functions

 TypeConstraint (ConceptReference *ConceptRef, Expr *ImmediatelyDeclaredConstraint, UnsignedOrNone ArgPackSubstIndex)
Expr * getImmediatelyDeclaredConstraint () const
 Get the immediately-declared constraint expression introduced by this type-constraint, that is - the constraint expression that is added to the associated constraints of the enclosing declaration in practice.
ConceptReference * getConceptReference () const
UnsignedOrNone getArgPackSubstIndex () const
TemplateName getNamedConcept () const
SourceLocation getConceptNameLoc () const
bool hasExplicitTemplateArgs () const
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten () const
SourceLocation getTemplateKWLoc () const
NamedDecl * getFoundDecl () const
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc () const
const DeclarationNameInfo & getConceptNameInfo () const
void print (llvm::raw_ostream &OS, const PrintingPolicy &Policy) const

Detailed Description

Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string> T> void print(T object); ~~~~~~~~~~~~~~~~~~~~~~ Semantically, this adds an "immediately-declared constraint" with extra arg: requires convertible_to<T, string>

In the C++ grammar, a type-constraint is also used for auto types: convertible_to<string> auto X = ...; We do not model these as TypeConstraints, but AutoType(Loc) directly.

Definition at line 227 of file ASTConcept.h.

Constructor & Destructor Documentation

◆ TypeConstraint()

clang::TypeConstraint::TypeConstraint ( ConceptReference * ConceptRef,
Expr * ImmediatelyDeclaredConstraint,
UnsignedOrNone ArgPackSubstIndex )
inline

Definition at line 235 of file ASTConcept.h.

Member Function Documentation

◆ getArgPackSubstIndex()

UnsignedOrNone clang::TypeConstraint::getArgPackSubstIndex ( ) const
inline

◆ getConceptNameInfo()

const DeclarationNameInfo & clang::TypeConstraint::getConceptNameInfo ( ) const
inline

Definition at line 278 of file ASTConcept.h.

Referenced by clang::Sema::SubstTypeConstraint().

◆ getConceptNameLoc()

SourceLocation clang::TypeConstraint::getConceptNameLoc ( ) const
inline

Definition at line 256 of file ASTConcept.h.

◆ getConceptReference()

ConceptReference * clang::TypeConstraint::getConceptReference ( ) const
inline

◆ getFoundDecl()

NamedDecl * clang::TypeConstraint::getFoundDecl ( ) const
inline

Definition at line 272 of file ASTConcept.h.

◆ getImmediatelyDeclaredConstraint()

Expr * clang::TypeConstraint::getImmediatelyDeclaredConstraint ( ) const
inline

Get the immediately-declared constraint expression introduced by this type-constraint, that is - the constraint expression that is added to the associated constraints of the enclosing declaration in practice.

Definition at line 244 of file ASTConcept.h.

Referenced by clang::Sema::BuildExprRequirement(), clang::ASTContext::isSameTypeConstraint(), clang::concepts::ExprRequirement::ReturnTypeRequirement::ReturnTypeRequirement(), clang::Sema::SubstTypeConstraint(), and clang::ASTDeclWriter::VisitTemplateTypeParmDecl().

◆ getNamedConcept()

TemplateName clang::TypeConstraint::getNamedConcept ( ) const
inline

◆ getNestedNameSpecifierLoc()

const NestedNameSpecifierLoc & clang::TypeConstraint::getNestedNameSpecifierLoc ( ) const
inline

Definition at line 274 of file ASTConcept.h.

Referenced by clang::Sema::SubstTypeConstraint().

◆ getTemplateArgsAsWritten()

const ASTTemplateArgumentListInfo * clang::TypeConstraint::getTemplateArgsAsWritten ( ) const
inline

Definition at line 264 of file ASTConcept.h.

Referenced by clang::Sema::SubstTypeConstraint().

◆ getTemplateKWLoc()

SourceLocation clang::TypeConstraint::getTemplateKWLoc ( ) const
inline

Definition at line 268 of file ASTConcept.h.

◆ hasExplicitTemplateArgs()

bool clang::TypeConstraint::hasExplicitTemplateArgs ( ) const
inline

Definition at line 260 of file ASTConcept.h.

◆ print()

void clang::TypeConstraint::print ( llvm::raw_ostream & OS,
const PrintingPolicy & Policy ) const
inline

Definition at line 282 of file ASTConcept.h.


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