summaryrefslogtreecommitdiff
path: root/clang-r353983/include/llvm/DebugInfo/CodeView/Formatters.h
diff options
context:
space:
mode:
authorRalf Luther <luther.ralf@gmail.com>2019-03-27 20:23:17 +0000
committerGerrit Code Review <gerrit2@aicp-server-3>2019-03-27 20:23:17 +0000
commit1ce3a9d272e564b22a1333a1e36a3d3ab7cfab01 (patch)
tree391382eadd4fec5bb480f2e8934fa352770221d1 /clang-r353983/include/llvm/DebugInfo/CodeView/Formatters.h
parentd1d48b140bafaa8a50107292f5fce95562575765 (diff)
parent4f56932d3416ac03f646bc1a611b3135fec2fe08 (diff)
Merge "Update prebuilt Clang to r353983." into p9.0HEADp9.0-backupp9.0
Diffstat (limited to 'clang-r353983/include/llvm/DebugInfo/CodeView/Formatters.h')
-rw-r--r--clang-r353983/include/llvm/DebugInfo/CodeView/Formatters.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/clang-r353983/include/llvm/DebugInfo/CodeView/Formatters.h b/clang-r353983/include/llvm/DebugInfo/CodeView/Formatters.h
new file mode 100644
index 00000000..7d04a6a8
--- /dev/null
+++ b/clang-r353983/include/llvm/DebugInfo/CodeView/Formatters.h
@@ -0,0 +1,72 @@
+//===- Formatters.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H
+#define LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/GUID.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
+#include "llvm/Support/FormatAdapters.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cstdint>
+
+namespace llvm {
+
+namespace codeview {
+
+namespace detail {
+
+class GuidAdapter final : public FormatAdapter<ArrayRef<uint8_t>> {
+ ArrayRef<uint8_t> Guid;
+
+public:
+ explicit GuidAdapter(ArrayRef<uint8_t> Guid);
+ explicit GuidAdapter(StringRef Guid);
+
+ void format(raw_ostream &Stream, StringRef Style) override;
+};
+
+} // end namespace detail
+
+inline detail::GuidAdapter fmt_guid(StringRef Item) {
+ return detail::GuidAdapter(Item);
+}
+
+inline detail::GuidAdapter fmt_guid(ArrayRef<uint8_t> Item) {
+ return detail::GuidAdapter(Item);
+}
+
+} // end namespace codeview
+
+template <> struct format_provider<codeview::TypeIndex> {
+public:
+ static void format(const codeview::TypeIndex &V, raw_ostream &Stream,
+ StringRef Style) {
+ if (V.isNoneType())
+ Stream << "<no type>";
+ else {
+ Stream << formatv("{0:X+4}", V.getIndex());
+ if (V.isSimple())
+ Stream << " (" << codeview::TypeIndex::simpleTypeName(V) << ")";
+ }
+ }
+};
+
+template <> struct format_provider<codeview::GUID> {
+ static void format(const codeview::GUID &V, llvm::raw_ostream &Stream,
+ StringRef Style) {
+ Stream << V;
+ }
+};
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H