DLA: make TypeLinkTag serializable to Loggers

This commit is contained in:
Pietro Fezzardi
2022-06-08 14:11:55 +02:00
parent 5a37fe8a84
commit 9898c980d7
2 changed files with 23 additions and 2 deletions
+20 -2
View File
@@ -93,8 +93,8 @@ static_assert(sizeof(DoRet) == (str_len(DoRet) + 1));
static_assert(sizeof(NoRet) == (str_len(NoRet) + 1));
static constexpr const char Equal[] = "Equal";
static constexpr const char Instance[] = "Has Instance of: ";
static constexpr const char Pointer[] = "Points to ";
static constexpr const char Instance[] = "Instance of: ";
static constexpr const char Pointer[] = "Points to: ";
static constexpr const char Unexpected[] = "Unexpected!";
static_assert(sizeof(Equal) == (str_len(Equal) + 1));
static_assert(sizeof(Instance) == (str_len(Instance) + 1));
@@ -702,4 +702,22 @@ void TSDebugPrinter::printNodeContent(const LayoutTypeSystem &TS,
File << "]" << DoRet;
}
void writeToLog(Logger<true> &Log, const TypeLinkTag &Tag, int /* Ignore */) {
switch (Tag.getKind()) {
case TypeLinkTag::LK_Equality: {
Log << Equal;
} break;
case TypeLinkTag::LK_Instance: {
Log << Instance << dumpToString(Tag.getOffsetExpr());
} break;
case TypeLinkTag::LK_Pointer: {
Log << Pointer;
} break;
default: {
Log << Unexpected;
} break;
}
}
} // end namespace dla