diff --git a/include/revng-c/DataLayoutAnalysis/DLATypeSystem.h b/include/revng-c/DataLayoutAnalysis/DLATypeSystem.h index f2153e11d..fca7bc092 100644 --- a/include/revng-c/DataLayoutAnalysis/DLATypeSystem.h +++ b/include/revng-c/DataLayoutAnalysis/DLATypeSystem.h @@ -102,6 +102,9 @@ public: } std::strong_ordering operator<=>(const TypeLinkTag &Other) const = default; + + friend void + writeToLog(Logger &L, const dla::TypeLinkTag &T, int /* Ignore */); }; // end class TypeLinkTag class LayoutTypeSystem; diff --git a/lib/DataLayoutAnalysis/DLATypeSystem.cpp b/lib/DataLayoutAnalysis/DLATypeSystem.cpp index aa7a1bb0c..793af1f82 100644 --- a/lib/DataLayoutAnalysis/DLATypeSystem.cpp +++ b/lib/DataLayoutAnalysis/DLATypeSystem.cpp @@ -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 &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