14#ifndef LLVM_CLANG_AST_ASTCONCEPT_H
15#define LLVM_CLANG_AST_ASTCONCEPT_H
21#include "llvm/ADT/FoldingSet.h"
22#include "llvm/ADT/PointerUnion.h"
23#include "llvm/ADT/SmallVector.h"
38 const NamedDecl *ConstraintOwner =
nullptr;
47 : ConstraintOwner(ConstraintOwner), TemplateArgs(TemplateArgs) {}
50 using Detail = llvm::PointerUnion<Expr *, SubstitutionDiagnostic *>;
81 llvm::PointerUnion<Expr *, std::pair<SourceLocation, StringRef> *>;
88 llvm::TrailingObjects<ASTConstraintSatisfaction,
89 UnsatisfiedConstraintRecord> {
95 return getTrailingObjects<UnsatisfiedConstraintRecord>();
99 return getTrailingObjects<UnsatisfiedConstraintRecord>() +
NumRecords;
152 : NestedNameSpec(NNS), TemplateKWLoc(TemplateKWLoc),
153 ConceptName(ConceptNameInfo), FoundDecl(FoundDecl),
154 NamedConcept(NamedConcept), ArgsAsWritten(ArgsAsWritten) {}
164 return NestedNameSpec;
180 return QualifierLoc.getBeginLoc();
204 return ArgsAsWritten;
210 return ArgsAsWritten !=
nullptr;
215 void dump(llvm::raw_ostream &)
const;
230 Expr *ImmediatelyDeclaredConstraint =
nullptr;
235 Expr *ImmediatelyDeclaredConstraint)
236 : ImmediatelyDeclaredConstraint(ImmediatelyDeclaredConstraint),
237 ConceptRef(ConceptRef) {}
243 return ImmediatelyDeclaredConstraint;
279 ConceptRef->
print(OS, Policy);
Defines the clang::SourceLocation class and associated facilities.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Declaration of a C++20 concept.
A reference to a concept and its template args, as it appears in the code.
bool hasExplicitTemplateArgs() const
Whether or not template arguments were explicitly specified in the concept reference (they might not ...
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
NamedDecl * getFoundDecl() const
const DeclarationNameInfo & getConceptNameInfo() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation getConceptNameLoc() const
ConceptDecl * getNamedConcept() const
SourceLocation getLocation() const
SourceLocation getBeginLoc() const LLVM_READONLY
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
SourceLocation getEndLoc() const LLVM_READONLY
void dump(llvm::raw_ostream &) const
SourceLocation getTemplateKWLoc() const
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
llvm::PointerUnion< Expr *, SubstitutionDiagnostic * > Detail
ConstraintSatisfaction(const NamedDecl *ConstraintOwner, ArrayRef< TemplateArgument > TemplateArgs)
std::pair< SourceLocation, StringRef > SubstitutionDiagnostic
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C)
ConstraintSatisfaction()=default
llvm::SmallVector< Detail, 4 > Details
The substituted constraint expr, if the template arguments could be substituted into them,...
bool HasSubstitutionFailure()
This represents one expression.
This represents a decl that may have a name.
A C++ nested-name-specifier augmented with source location information.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const
ConceptDecl * getNamedConcept() const
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
NamedDecl * getFoundDecl() const
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
const DeclarationNameInfo & getConceptNameInfo() const
bool hasExplicitTemplateArgs() const
SourceLocation getConceptNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeConstraint(ConceptReference *ConceptRef, Expr *ImmediatelyDeclaredConstraint)
ConceptReference * getConceptReference() const
The JSON file list parser is used to communicate input to InstallAPI.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
llvm::PointerUnion< Expr *, std::pair< SourceLocation, StringRef > * > UnsatisfiedConstraintRecord
Pairs of unsatisfied atomic constraint expressions along with the substituted constraint expr,...
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
const UnsatisfiedConstraintRecord * end() const
static ASTConstraintSatisfaction * Rebuild(const ASTContext &C, const ASTConstraintSatisfaction &Satisfaction)
const UnsatisfiedConstraintRecord * begin() const
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
SourceLocation getRAngleLoc() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
SourceLocation getEndLoc() const LLVM_READONLY
Describes how types, statements, expressions, and declarations should be printed.