summaryrefslogtreecommitdiff
path: root/deps/v8/src/torque/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/torque/utils.h')
-rw-r--r--deps/v8/src/torque/utils.h45
1 files changed, 44 insertions, 1 deletions
diff --git a/deps/v8/src/torque/utils.h b/deps/v8/src/torque/utils.h
index 7fe6ffdbcc..59379fa526 100644
--- a/deps/v8/src/torque/utils.h
+++ b/deps/v8/src/torque/utils.h
@@ -17,7 +17,7 @@ namespace torque {
typedef std::vector<std::string> NameVector;
-void ReportError(const std::string& error);
+[[noreturn]] void ReportError(const std::string& error);
std::string CamelifyString(const std::string& underscore_string);
std::string DashifyString(const std::string& underscore_string);
@@ -36,6 +36,49 @@ class Deduplicator {
std::unordered_set<T, base::hash<T>> storage_;
};
+template <class C, class T>
+void PrintCommaSeparatedList(std::ostream& os, const T& list, C transform) {
+ bool first = true;
+ for (auto& e : list) {
+ if (first) {
+ first = false;
+ } else {
+ os << ", ";
+ }
+ os << transform(e);
+ }
+}
+
+template <class T,
+ typename std::enable_if<
+ std::is_pointer<typename T::value_type>::value, int>::type = 0>
+void PrintCommaSeparatedList(std::ostream& os, const T& list) {
+ bool first = true;
+ for (auto& e : list) {
+ if (first) {
+ first = false;
+ } else {
+ os << ", ";
+ }
+ os << *e;
+ }
+}
+
+template <class T,
+ typename std::enable_if<
+ !std::is_pointer<typename T::value_type>::value, int>::type = 0>
+void PrintCommaSeparatedList(std::ostream& os, const T& list) {
+ bool first = true;
+ for (auto& e : list) {
+ if (first) {
+ first = false;
+ } else {
+ os << ", ";
+ }
+ os << e;
+ }
+}
+
} // namespace torque
} // namespace internal
} // namespace v8