14#ifndef LLVM_CLANG_AST_ASTCONCEPT_H
15#define LLVM_CLANG_AST_ASTCONCEPT_H
22#include "llvm/ADT/FoldingSet.h"
23#include "llvm/ADT/PointerUnion.h"
24#include "llvm/ADT/SmallVector.h"
50 const NamedDecl *ConstraintOwner =
nullptr;
59 : ConstraintOwner(ConstraintOwner), TemplateArgs(TemplateArgs) {}
70 Profile(ID,
C, ConstraintOwner, TemplateArgs);
78 for (
const auto &Detail :
Details)
90 llvm::TrailingObjects<ASTConstraintSatisfaction,
91 UnsatisfiedConstraintRecord> {
97 return getTrailingObjects();
215 void dump(llvm::raw_ostream &)
const;
230 Expr *ImmediatelyDeclaredConstraint =
nullptr;
236 Expr *ImmediatelyDeclaredConstraint,
238 : ImmediatelyDeclaredConstraint(ImmediatelyDeclaredConstraint),
239 ConceptRef(ConceptRef), ArgPackSubstIndex(ArgPackSubstIndex) {}
245 return ImmediatelyDeclaredConstraint;
255 return ConceptRef->getNamedConcept();
259 return ConceptRef->getConceptNameLoc();
263 return ConceptRef->hasExplicitTemplateArgs();
267 return ConceptRef->getTemplateArgsAsWritten();
271 return ConceptRef->getTemplateKWLoc();
277 return ConceptRef->getNestedNameSpecifierLoc();
281 return ConceptRef->getConceptNameInfo();
285 ConceptRef->print(OS, Policy);
291const StreamingDiagnostic &
operator<<(
const StreamingDiagnostic &DB,
292 const ConceptReference *
C);
Defines the clang::SourceLocation class and associated facilities.
Defines clang::UnsignedOrNone.
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.
NestedNameSpecifierLoc NestedNameSpec
bool hasExplicitTemplateArgs() const
Whether or not template arguments were explicitly specified in the concept reference (they might not ...
DeclarationNameInfo ConceptName
The concept name used.
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
NamedDecl * getFoundDecl() const
const DeclarationNameInfo & getConceptNameInfo() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation getConceptNameLoc() const
SourceLocation TemplateKWLoc
The location of the template keyword, if specified when naming the concept.
TemplateDecl * NamedConcept
The concept named.
SourceLocation getLocation() const
SourceLocation getBeginLoc() const LLVM_READONLY
const ASTTemplateArgumentListInfo * ArgsAsWritten
The template argument list source info used to specialize the concept.
NamedDecl * FoundDecl
The declaration found by name lookup when the expression was created.
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
SourceLocation getEndLoc() const LLVM_READONLY
ConceptReference(NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
void dump(llvm::raw_ostream &) const
TemplateDecl * getNamedConcept() const
SourceLocation getTemplateKWLoc() const
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
ConstraintSatisfaction(const NamedDecl *ConstraintOwner, ArrayRef< TemplateArgument > TemplateArgs)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C)
ConstraintSatisfaction()=default
bool HasSubstitutionFailure()
llvm::SmallVector< UnsatisfiedConstraintRecord, 4 > Details
The substituted constraint expr, if the template arguments could be substituted into them,...
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.
The base class of all kinds of template declarations (e.g., class, function, etc.).
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const
UnsignedOrNone getArgPackSubstIndex() const
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
NamedDecl * getFoundDecl() const
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
TemplateDecl * getNamedConcept() const
TypeConstraint(ConceptReference *ConceptRef, Expr *ImmediatelyDeclaredConstraint, UnsignedOrNone ArgPackSubstIndex)
const DeclarationNameInfo & getConceptNameInfo() const
bool hasExplicitTemplateArgs() const
SourceLocation getConceptNameLoc() const
SourceLocation getTemplateKWLoc() const
ConceptReference * getConceptReference() const
The JSON file list parser is used to communicate input to InstallAPI.
llvm::PointerUnion< const Expr *, const ConceptReference *, const ConstraintSubstitutionDiagnostic * > UnsatisfiedConstraintRecord
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
std::pair< SourceLocation, StringRef > ConstraintSubstitutionDiagnostic
Unsatisfied constraint expressions if the template arguments could be substituted into them,...
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
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)
ASTConstraintSatisfaction(const ASTContext &C, const ConstraintSatisfaction &Satisfaction)
const UnsatisfiedConstraintRecord * begin() const
ArrayRef< UnsatisfiedConstraintRecord > records() 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 getEndLoc() const LLVM_READONLY
Describes how types, statements, expressions, and declarations should be printed.