Implement pretty for several more types Change-Id: I47ca96f5d8183de90cbd26e1386001536a6a6964 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/26201 Reviewed-by: Takuto Ikuta <tikuta@google.com> Commit-Queue: Matt Stark <msta@google.com>
diff --git a/src/gn/output_file.cc b/src/gn/output_file.cc index 6a159ea..745eb0b 100644 --- a/src/gn/output_file.cc +++ b/src/gn/output_file.cc
@@ -36,3 +36,7 @@ NormalizePath(&path); return SourceDir(std::move(path)); } + +std::string Pretty(const OutputFile& file) { + return std::string(file.value()); +}
diff --git a/src/gn/output_file.h b/src/gn/output_file.h index 30d3a12..d3f19f2 100644 --- a/src/gn/output_file.h +++ b/src/gn/output_file.h
@@ -7,6 +7,7 @@ #include <stddef.h> +#include <string> #include <string_view> #include "gn/string_atom.h" @@ -41,6 +42,8 @@ StringAtom value_; }; +std::string Pretty(const OutputFile& file); + namespace std { template <>
diff --git a/src/gn/source_dir.cc b/src/gn/source_dir.cc index f34a637..87fa669 100644 --- a/src/gn/source_dir.cc +++ b/src/gn/source_dir.cc
@@ -141,3 +141,7 @@ base::FilePath SourceDir::Resolve(const base::FilePath& source_root) const { return ResolvePath(value_.str(), false, source_root); } + +std::string Pretty(const SourceDir& dir) { + return dir.value(); +}
diff --git a/src/gn/source_dir.h b/src/gn/source_dir.h index 2a694cf..b01ef02 100644 --- a/src/gn/source_dir.h +++ b/src/gn/source_dir.h
@@ -135,6 +135,8 @@ StringAtom value_; }; +std::string Pretty(const SourceDir& dir); + namespace std { template <>
diff --git a/src/gn/source_file.cc b/src/gn/source_file.cc index ecc2d1e..195f0fb 100644 --- a/src/gn/source_file.cc +++ b/src/gn/source_file.cc
@@ -235,3 +235,7 @@ return allowlist->find(range.begin().file()->name()) != allowlist->end(); } + +std::string Pretty(const SourceFile& file) { + return file.value(); +}
diff --git a/src/gn/source_file.h b/src/gn/source_file.h index f63c5dc..c7a6c80 100644 --- a/src/gn/source_file.h +++ b/src/gn/source_file.h
@@ -137,6 +137,8 @@ StringAtom value_; }; +std::string Pretty(const SourceFile& file); + namespace std { template <>