jasonmolenda added a comment. Like reading third-party/unittest/googletest/include/gtest/gtest-printers.h, I thought I could add a static PrintTo method? but
index 6eb5b805d9d..93d98baa5be 100644 --- a/lldb/include/lldb/Utility/FileSpec.h +++ b/lldb/include/lldb/Utility/FileSpec.h @@ -12,4 +12,5 @@ #include <functional> #include <optional> +#include <ostream> #include <string> @@ -198,4 +199,8 @@ public: static std::optional<Style> GuessPathStyle(llvm::StringRef absolute_path); + /// Print the file path in a FileSpec to the ostream, for gtest-printers unit + /// test failure printing. + static void PrintTo(const FileSpec &fspec, std::ostream *ostr); + /// Case sensitivity of path. /// diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp index eb34ef97cea..6f09c8448df 100644 --- a/lldb/source/Utility/FileSpec.cpp +++ b/lldb/source/Utility/FileSpec.cpp @@ -320,4 +320,8 @@ FileSpec::GuessPathStyle(llvm::StringRef absolute_path) { } +void FileSpec::PrintTo(const FileSpec &fspec, std::ostream *ostr) { + *ostr << fspec.GetPath(); +} + // Dump the object to the supplied stream. If the object contains a valid // directory name, it will be displayed followed by a directory delimiter, and and making one of the FileSpecs not match, I still get the "24-byte object" printed for the ASSERT_EQ mismatch. I must have misunderstood the header. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155333/new/ https://reviews.llvm.org/D155333 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits