clang 20.0.0git
Public Member Functions | List of all members
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)
 
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
 
ConceptDeclgetNamedConcept () 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 227 of file ASTConcept.h.

Constructor & Destructor Documentation

◆ TypeConstraint()

clang::TypeConstraint::TypeConstraint ( ConceptReference ConceptRef,
Expr ImmediatelyDeclaredConstraint 
)
inline

Definition at line 234 of file ASTConcept.h.

Member Function Documentation

◆ getConceptNameInfo()

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

◆ getConceptNameLoc()

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

Definition at line 252 of file ASTConcept.h.

References clang::ConceptReference::getConceptNameLoc().

◆ getConceptReference()

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

◆ getFoundDecl()

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

Definition at line 268 of file ASTConcept.h.

References clang::ConceptReference::getFoundDecl().

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

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

◆ getNestedNameSpecifierLoc()

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

◆ getTemplateArgsAsWritten()

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

◆ getTemplateKWLoc()

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

Definition at line 264 of file ASTConcept.h.

References clang::ConceptReference::getTemplateKWLoc().

◆ hasExplicitTemplateArgs()

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

Definition at line 256 of file ASTConcept.h.

References clang::ConceptReference::hasExplicitTemplateArgs().

◆ print()

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

Definition at line 278 of file ASTConcept.h.

References clang::ConceptReference::print().


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