xref: /freebsd/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //===- DWARFDebugAranges.cpp ------------------------------------*- C++ -*-===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
10*0b57cec5SDimitry Andric 
11*0b57cec5SDimitry Andric #include "llvm/Support/Format.h"
12*0b57cec5SDimitry Andric #include "llvm/Support/raw_ostream.h"
13*0b57cec5SDimitry Andric 
14*0b57cec5SDimitry Andric using namespace llvm;
15*0b57cec5SDimitry Andric 
16*0b57cec5SDimitry Andric void DWARFAddressRange::dump(raw_ostream &OS, uint32_t AddressSize,
17*0b57cec5SDimitry Andric                              DIDumpOptions DumpOpts) const {
18*0b57cec5SDimitry Andric 
19*0b57cec5SDimitry Andric   OS << (DumpOpts.DisplayRawContents ? " " : "[");
20*0b57cec5SDimitry Andric   OS << format("0x%*.*" PRIx64 ", ", AddressSize * 2, AddressSize * 2, LowPC)
21*0b57cec5SDimitry Andric      << format("0x%*.*" PRIx64, AddressSize * 2, AddressSize * 2, HighPC);
22*0b57cec5SDimitry Andric   OS << (DumpOpts.DisplayRawContents ? "" : ")");
23*0b57cec5SDimitry Andric }
24*0b57cec5SDimitry Andric 
25*0b57cec5SDimitry Andric raw_ostream &llvm::operator<<(raw_ostream &OS, const DWARFAddressRange &R) {
26*0b57cec5SDimitry Andric   R.dump(OS, /* AddressSize */ 8);
27*0b57cec5SDimitry Andric   return OS;
28*0b57cec5SDimitry Andric }
29