Skip to content

Commit 0b9312d

Browse files
author
Amritpan Kaur
committed
[ConstraintSystem] Convert atomic literal kinds to string for printing.
1 parent bee4eae commit 0b9312d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,23 @@ unsigned BindingSet::getNumViableLiteralBindings() const {
16051605
});
16061606
}
16071607

1608+
/// Return string for atomic literal kinds (integer, string, & boolean) for
1609+
/// printing in debug output.
1610+
static std::string getAtomLiteralAsString(ExprKind EK) {
1611+
#define ENTRY(Kind, String) \
1612+
case ExprKind::Kind: \
1613+
return String
1614+
switch (EK) {
1615+
ENTRY(IntegerLiteral, "integer");
1616+
ENTRY(StringLiteral, "string");
1617+
ENTRY(BooleanLiteral, "boolean");
1618+
ENTRY(NilLiteral, "nil");
1619+
default:
1620+
return "";
1621+
}
1622+
#undef ENTRY
1623+
}
1624+
16081625
void BindingSet::dump(TypeVariableType *typeVar, llvm::raw_ostream &out,
16091626
unsigned indent) const {
16101627
out.indent(indent);

0 commit comments

Comments
 (0)