clang: lib/AST/ASTConcept.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

17#include "llvm/ADT/StringExtras.h"

18

19using namespace clang;

20

21static void

25 if (auto *E = dyn_cast<Expr *>(Detail))

27 else {

28 auto &SubstitutionDiagnostic =

29 *cast<std::pair<SourceLocation, StringRef> *>(Detail);

30 StringRef Message = C.backupStr(SubstitutionDiagnostic.second);

31 auto *NewSubstDiag = new (C) std::pair<SourceLocation, StringRef>(

32 SubstitutionDiagnostic.first, Message);

34 }

35}

36

39 : NumRecords{Satisfaction.Details.size()},

40 IsSatisfied{Satisfaction.IsSatisfied}, ContainsErrors{

41 Satisfaction.ContainsErrors} {

42 for (unsigned I = 0; I < NumRecords; ++I)

45 getTrailingObjects() + I);

46}

47

50 : NumRecords{Satisfaction.NumRecords},

51 IsSatisfied{Satisfaction.IsSatisfied},

52 ContainsErrors{Satisfaction.ContainsErrors} {

53 for (unsigned I = 0; I < NumRecords; ++I)

55 C, *(Satisfaction.begin() + I),

56 getTrailingObjects() + I);

57}

58

62 std::size_t size =

63 totalSizeToAlloc(

64 Satisfaction.Details.size());

67}

68

71 std::size_t size =

72 totalSizeToAlloc(Satisfaction.NumRecords);

75}

76

78 llvm::FoldingSetNodeID &ID, const ASTContext &C,

80 ID.AddPointer(ConstraintOwner);

81 ID.AddInteger(TemplateArgs.size());

82 for (auto &Arg : TemplateArgs)

83 Arg.Profile(ID, C);

84}

85

92 return new (C) ConceptReference(NNS, TemplateKWLoc, ConceptNameInfo,

93 FoundDecl, NamedConcept, ArgsAsWritten);

94}

95

98 if (NestedNameSpec)

100 ConceptName.printName(OS, Policy);

102 OS << "<";

103 llvm::ListSeparator Sep(", ");

104

105 for (auto &ArgLoc : ArgsAsWritten->arguments()) {

106 OS << Sep;

107 ArgLoc.getArgument().print(Policy, OS, false);

108 }

109 OS << ">";

110 }

111}

static void CreateUnsatisfiedConstraintRecord(const ASTContext &C, const UnsatisfiedConstraintRecord &Detail, UnsatisfiedConstraintRecord *TrailingObject)

This file provides AST data structures related to concepts.

Defines the clang::ASTContext interface.

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 ...

static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)

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

The result of a constraint satisfaction check, containing the necessary information to diagnose an un...

void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C)

llvm::SmallVector< Detail, 4 > Details

The substituted constraint expr, if the template arguments could be substituted into them,...

This represents a decl that may have a name.

A C++ nested-name-specifier augmented with source location information.

NestedNameSpecifier * getNestedNameSpecifier() const

Retrieve the nested-name-specifier to which this instance refers.

void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) const

Print this nested name specifier to the given output stream.

Encodes a location in the source.

The JSON file list parser is used to communicate input to InstallAPI.

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...

static ASTConstraintSatisfaction * Rebuild(const ASTContext &C, const ASTConstraintSatisfaction &Satisfaction)

ASTConstraintSatisfaction(const ASTContext &C, const ConstraintSatisfaction &Satisfaction)

const UnsatisfiedConstraintRecord * begin() const

static ASTConstraintSatisfaction * Create(const ASTContext &C, const ConstraintSatisfaction &Satisfaction)

Represents an explicit template argument list in C++, e.g., the "" in "sort".

llvm::ArrayRef< TemplateArgumentLoc > arguments() const

DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...

void printName(raw_ostream &OS, PrintingPolicy Policy) const

printName - Print the human-readable name to a stream.

Describes how types, statements, expressions, and declarations should be printed.