Format my previous commit
[oota-llvm.git] / lib / DebugInfo / DWARF / DWARFUnitIndex.cpp
1 //===-- DWARFUnitIndex.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
10 #include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
11
12 namespace llvm {
13
14 bool DWARFUnitIndex::Header::parse(DataExtractor IndexData,
15                                    uint32_t *OffsetPtr) {
16   Version = IndexData.getU32(OffsetPtr);
17   NumColumns = IndexData.getU32(OffsetPtr);
18   NumUnits = IndexData.getU32(OffsetPtr);
19   NumBuckets = IndexData.getU32(OffsetPtr);
20   return Version <= 2;
21 }
22
23 void DWARFUnitIndex::Header::dump(raw_ostream &OS) const {
24   OS << "Index header:\n" << format("   version: %u\n", Version)
25      << format("   columns: %u\n", NumColumns)
26      << format("     units: %u\n", NumUnits)
27      << format("   buckets: %u\n", NumBuckets);
28 }
29
30 bool DWARFUnitIndex::parse(DataExtractor IndexData) {
31   uint32_t Offset = 0;
32   if (!Header.parse(IndexData, &Offset))
33     return false;
34
35   return true;
36 }
37
38 void DWARFUnitIndex::dump(raw_ostream &OS) const { Header.dump(OS); }
39 }