*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
97 lines
3.2 KiB
C++
97 lines
3.2 KiB
C++
//===-- DWARFFormValue.h ----------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SymbolFileDWARF_DWARFFormValue_h_
|
|
#define SymbolFileDWARF_DWARFFormValue_h_
|
|
|
|
#include "DWARFDataExtractor.h"
|
|
#include <stddef.h> // for NULL
|
|
|
|
class DWARFCompileUnit;
|
|
|
|
class DWARFFormValue {
|
|
public:
|
|
typedef struct ValueTypeTag {
|
|
ValueTypeTag() : value(), data(NULL) { value.uval = 0; }
|
|
|
|
union {
|
|
uint64_t uval;
|
|
int64_t sval;
|
|
const char *cstr;
|
|
} value;
|
|
const uint8_t *data;
|
|
} ValueType;
|
|
|
|
class FixedFormSizes {
|
|
public:
|
|
FixedFormSizes() : m_fix_sizes(nullptr), m_size(0) {}
|
|
|
|
FixedFormSizes(const uint8_t *fix_sizes, size_t size)
|
|
: m_fix_sizes(fix_sizes), m_size(size) {}
|
|
|
|
uint8_t GetSize(uint32_t index) const {
|
|
return index < m_size ? m_fix_sizes[index] : 0;
|
|
}
|
|
|
|
bool Empty() const { return m_size == 0; }
|
|
|
|
private:
|
|
const uint8_t *m_fix_sizes;
|
|
size_t m_size;
|
|
};
|
|
|
|
enum {
|
|
eValueTypeInvalid = 0,
|
|
eValueTypeUnsigned,
|
|
eValueTypeSigned,
|
|
eValueTypeCStr,
|
|
eValueTypeBlock
|
|
};
|
|
|
|
DWARFFormValue();
|
|
DWARFFormValue(const DWARFCompileUnit *cu, dw_form_t form);
|
|
const DWARFCompileUnit *GetCompileUnit() const { return m_cu; }
|
|
void SetCompileUnit(const DWARFCompileUnit *cu) { m_cu = cu; }
|
|
dw_form_t Form() const { return m_form; }
|
|
void SetForm(dw_form_t form) { m_form = form; }
|
|
const ValueType &Value() const { return m_value; }
|
|
void Dump(lldb_private::Stream &s) const;
|
|
bool ExtractValue(const lldb_private::DWARFDataExtractor &data,
|
|
lldb::offset_t *offset_ptr);
|
|
const uint8_t *BlockData() const;
|
|
uint64_t Reference() const;
|
|
uint64_t Reference(dw_offset_t offset) const;
|
|
bool Boolean() const { return m_value.value.uval != 0; }
|
|
uint64_t Unsigned() const { return m_value.value.uval; }
|
|
void SetUnsigned(uint64_t uval) { m_value.value.uval = uval; }
|
|
int64_t Signed() const { return m_value.value.sval; }
|
|
void SetSigned(int64_t sval) { m_value.value.sval = sval; }
|
|
const char *AsCString() const;
|
|
dw_addr_t Address() const;
|
|
bool IsValid() const { return m_form != 0; }
|
|
bool SkipValue(const lldb_private::DWARFDataExtractor &debug_info_data,
|
|
lldb::offset_t *offset_ptr) const;
|
|
static bool SkipValue(const dw_form_t form,
|
|
const lldb_private::DWARFDataExtractor &debug_info_data,
|
|
lldb::offset_t *offset_ptr, const DWARFCompileUnit *cu);
|
|
static bool IsBlockForm(const dw_form_t form);
|
|
static bool IsDataForm(const dw_form_t form);
|
|
static FixedFormSizes GetFixedFormSizesForAddressSize(uint8_t addr_size,
|
|
bool is_dwarf64);
|
|
static int Compare(const DWARFFormValue &a, const DWARFFormValue &b);
|
|
void Clear();
|
|
|
|
protected:
|
|
const DWARFCompileUnit *m_cu; // Compile unit for this form
|
|
dw_form_t m_form; // Form for this value
|
|
ValueType m_value; // Contains all data for the form
|
|
};
|
|
|
|
#endif // SymbolFileDWARF_DWARFFormValue_h_
|