@@ -32,6 +32,14 @@ class Expr;
32
32
class NamedDecl ;
33
33
struct PrintingPolicy ;
34
34
35
+ // / Pairs of unsatisfied atomic constraint expressions along with the
36
+ // / substituted constraint expr, if the template arguments could be
37
+ // / substituted into them, or a diagnostic if substitution resulted in
38
+ // / an invalid expression.
39
+ using UnsatisfiedConstraintRecord =
40
+ llvm::PointerUnion<const Expr *, const ConceptReference *,
41
+ std::pair<SourceLocation, StringRef> *>;
42
+
35
43
// / The result of a constraint satisfaction check, containing the necessary
36
44
// / information to diagnose an unsatisfied constraint.
37
45
class ConstraintSatisfaction : public llvm ::FoldingSetNode {
@@ -50,15 +58,14 @@ class ConstraintSatisfaction : public llvm::FoldingSetNode {
50
58
: ConstraintOwner(ConstraintOwner), TemplateArgs(TemplateArgs) {}
51
59
52
60
using SubstitutionDiagnostic = std::pair<SourceLocation, StringRef>;
53
- using Detail = llvm::PointerUnion<const Expr *, SubstitutionDiagnostic *>;
54
61
55
62
bool IsSatisfied = false ;
56
63
bool ContainsErrors = false ;
57
64
58
65
// / \brief The substituted constraint expr, if the template arguments could be
59
66
// / substituted into them, or a diagnostic if substitution resulted in an
60
67
// / invalid expression.
61
- llvm::SmallVector<Detail , 4 > Details;
68
+ llvm::SmallVector<UnsatisfiedConstraintRecord , 4 > Details;
62
69
63
70
void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &C) {
64
71
Profile (ID, C, ConstraintOwner, TemplateArgs);
@@ -76,13 +83,6 @@ class ConstraintSatisfaction : public llvm::FoldingSetNode {
76
83
}
77
84
};
78
85
79
- // / Pairs of unsatisfied atomic constraint expressions along with the
80
- // / substituted constraint expr, if the template arguments could be
81
- // / substituted into them, or a diagnostic if substitution resulted in
82
- // / an invalid expression.
83
- using UnsatisfiedConstraintRecord =
84
- llvm::PointerUnion<const Expr *, std::pair<SourceLocation, StringRef> *>;
85
-
86
86
// / \brief The result of a constraint satisfaction check, containing the
87
87
// / necessary information to diagnose an unsatisfied constraint.
88
88
// /
@@ -102,6 +102,10 @@ struct ASTConstraintSatisfaction final :
102
102
return getTrailingObjects () + NumRecords;
103
103
}
104
104
105
+ ArrayRef<UnsatisfiedConstraintRecord> records () const {
106
+ return {begin (), end ()};
107
+ }
108
+
105
109
ASTConstraintSatisfaction (const ASTContext &C,
106
110
const ConstraintSatisfaction &Satisfaction);
107
111
ASTConstraintSatisfaction (const ASTContext &C,
@@ -287,6 +291,11 @@ class TypeConstraint {
287
291
}
288
292
};
289
293
294
+ // / Insertion operator for diagnostics. This allows sending TemplateName's
295
+ // / into a diagnostic with <<.
296
+ const StreamingDiagnostic &operator <<(const StreamingDiagnostic &DB,
297
+ const ConceptReference *C);
298
+
290
299
} // clang
291
300
292
301
#endif // LLVM_CLANG_AST_ASTCONCEPT_H
0 commit comments