LLVM  6.0.0svn
Formatters.cpp
Go to the documentation of this file.
1 //===- Formatters.cpp -----------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
11 #include "llvm/ADT/ArrayRef.h"
14 #include <algorithm>
15 #include <cassert>
16 
17 using namespace llvm;
18 using namespace llvm::codeview;
19 using namespace llvm::codeview::detail;
20 
22  : FormatAdapter(makeArrayRef(Guid.bytes_begin(), Guid.bytes_end())) {}
23 
25  : FormatAdapter(std::move(Guid)) {}
26 
28  static const char *Lookup = "0123456789ABCDEF";
29 
30  assert(Item.size() == 16 && "Expected 16-byte GUID");
31  Stream << "{";
32  for (int i = 0; i < 16;) {
33  uint8_t Byte = Item[i];
34  uint8_t HighNibble = (Byte >> 4) & 0xF;
35  uint8_t LowNibble = Byte & 0xF;
36  Stream << Lookup[HighNibble] << Lookup[LowNibble];
37  ++i;
38  if (i >= 4 && i <= 10 && i % 2 == 0)
39  Stream << "-";
40  }
41  Stream << "}";
42 }
43 
46  A.format(OS, "");
47  return OS;
48 }
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
Definition: BitVector.h:920
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:451
static int Lookup(ArrayRef< TableEntry > Table, unsigned Opcode)
void format(raw_ostream &Stream, StringRef Style) override
Definition: Formatters.cpp:27
This represents the &#39;GUID&#39; type from windows.h.
Definition: GUID.h:22
uint8_t Guid[16]
Definition: GUID.h:23
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:149
raw_ostream & operator<<(raw_ostream &OS, const GUID &Guid)
Definition: Formatters.cpp:44
GuidAdapter(ArrayRef< uint8_t > Guid)
Definition: Formatters.cpp:24
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49