1 //===-- DWARFFormValue.h ----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_DWARFFORMVALUE_H
11 #define LLVM_DEBUGINFO_DWARFFORMVALUE_H
13 #include "llvm/Support/DataExtractor.h"
17 class DWARFCompileUnit;
20 class DWARFFormValue {
23 ValueType() : data(NULL), IsDWOIndex(false) {
37 eValueTypeInvalid = 0,
45 uint16_t Form; // Form for this value.
46 ValueType Value; // Contains all data for the form.
49 DWARFFormValue(uint16_t form = 0) : Form(form) {}
50 uint16_t getForm() const { return Form; }
51 const ValueType& value() const { return Value; }
52 void dump(raw_ostream &OS, const DWARFCompileUnit* cu) const;
53 bool extractValue(DataExtractor data, uint32_t *offset_ptr,
54 const DWARFCompileUnit *cu);
55 bool isInlinedCStr() const {
56 return Value.data != NULL && Value.data == (const uint8_t*)Value.cstr;
58 const uint8_t *BlockData() const;
59 uint64_t getReference(const DWARFCompileUnit* cu) const;
61 /// Resolve any compile unit specific references so that we don't need
62 /// the compile unit at a later time in order to work with the form
64 bool resolveCompileUnitReferences(const DWARFCompileUnit* cu);
65 uint64_t getUnsigned() const { return Value.uval; }
66 int64_t getSigned() const { return Value.sval; }
67 const char *getAsCString(const DWARFCompileUnit *CU) const;
68 uint64_t getAsAddress(const DWARFCompileUnit *CU) const;
69 bool skipValue(DataExtractor debug_info_data, uint32_t *offset_ptr,
70 const DWARFCompileUnit *cu) const;
71 static bool skipValue(uint16_t form, DataExtractor debug_info_data,
72 uint32_t *offset_ptr, const DWARFCompileUnit *cu);
73 static bool isBlockForm(uint16_t form);
74 static bool isDataForm(uint16_t form);
75 static const uint8_t *getFixedFormSizes(uint8_t AddrSize, uint16_t Version);