Skip to content

Commit 943d891

Browse files
committed
[ConstraintLocator] NFC: Add isForGenericParameter accessor
1 parent 3acd050 commit 943d891

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/Sema/ConstraintLocator.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ bool ConstraintLocator::isForKeyPathComponent() const {
165165
});
166166
}
167167

168+
bool ConstraintLocator::isForGenericParameter() const {
169+
auto path = getPath();
170+
return !path.empty() &&
171+
path.back().getKind() == ConstraintLocator::GenericParameter;
172+
}
173+
168174
void ConstraintLocator::dump(SourceManager *sm) {
169175
dump(sm, llvm::errs());
170176
llvm::errs() << "\n";

lib/Sema/ConstraintLocator.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ class ConstraintLocator : public llvm::FoldingSetNode {
564564
/// components.
565565
bool isForKeyPathComponent() const;
566566

567+
/// Determine whether this locator points to the generic parameter.
568+
bool isForGenericParameter() const;
569+
567570
/// Produce a profile of this locator, for use in a folding set.
568571
static void Profile(llvm::FoldingSetNodeID &id, Expr *anchor,
569572
ArrayRef<PathElement> path);

0 commit comments

Comments
 (0)