clang 22.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)
ExprgetImmediatelyDeclaredConstraint () 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.
ConceptReferencegetConceptReference () const
UnsignedOrNone getArgPackSubstIndex () const
TemplateDeclgetNamedConcept () const
SourceLocation getConceptNameLoc () const
bool hasExplicitTemplateArgs () const
const ASTTemplateArgumentListInfogetTemplateArgsAsWritten () const
SourceLocation getTemplateKWLoc () const
NamedDeclgetFoundDecl () const
const NestedNameSpecifierLocgetNestedNameSpecifierLoc () const
const DeclarationNameInfogetConceptNameInfo () 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 223 of file ASTConcept.h.

Constructor & Destructor Documentation

◆ TypeConstraint()

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

Definition at line 231 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 276 of file ASTConcept.h.

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

◆ getConceptNameLoc()

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

Definition at line 254 of file ASTConcept.h.

◆ getConceptReference()

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

◆ getFoundDecl()

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

Definition at line 270 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 240 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()

TemplateDecl * clang::TypeConstraint::getNamedConcept ( ) const
inline

◆ getNestedNameSpecifierLoc()

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

Definition at line 272 of file ASTConcept.h.

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

◆ getTemplateArgsAsWritten()

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

Definition at line 262 of file ASTConcept.h.

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

◆ getTemplateKWLoc()

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

Definition at line 266 of file ASTConcept.h.

◆ hasExplicitTemplateArgs()

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

Definition at line 258 of file ASTConcept.h.

◆ print()

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

Definition at line 280 of file ASTConcept.h.


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