Style & indentation tweaks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139646 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2011-09-13 21:47:32 +00:00
parent 13b8d1e396
commit 4aa3fea8b1
7 changed files with 202 additions and 212 deletions

View File

@ -38,8 +38,7 @@ DWARFAbbreviationDeclaration::extract(DataExtractor data, uint32_t* offset_ptr,
}
return Tag != 0;
}
else {
} else {
Tag = 0;
HasChildren = false;
}

View File

@ -32,13 +32,11 @@ bool DWARFAbbreviationDeclarationSet::extract(DataExtractor data,
return beginOffset != *offset_ptr;
}
void DWARFAbbreviationDeclarationSet::dump(raw_ostream &OS) const {
for (unsigned i = 0, e = Decls.size(); i != e; ++i)
Decls[i].dump(OS);
}
const DWARFAbbreviationDeclaration*
DWARFAbbreviationDeclarationSet::getAbbreviationDeclaration(uint32_t abbrCode)
const {
@ -58,8 +56,8 @@ DWARFAbbreviationDeclarationSet::getAbbreviationDeclaration(uint32_t abbrCode)
}
DWARFDebugAbbrev::DWARFDebugAbbrev() :
m_abbrevCollMap(),
m_prev_abbr_offset_pos(m_abbrevCollMap.end()) {}
AbbrevCollMap(),
PrevAbbrOffsetPos(AbbrevCollMap.end()) {}
void DWARFDebugAbbrev::parse(DataExtractor data) {
@ -70,21 +68,21 @@ void DWARFDebugAbbrev::parse(DataExtractor data) {
DWARFAbbreviationDeclarationSet abbrevDeclSet;
if (abbrevDeclSet.extract(data, &offset))
m_abbrevCollMap[initial_cu_offset] = abbrevDeclSet;
AbbrevCollMap[initial_cu_offset] = abbrevDeclSet;
else
break;
}
m_prev_abbr_offset_pos = m_abbrevCollMap.end();
PrevAbbrOffsetPos = AbbrevCollMap.end();
}
void DWARFDebugAbbrev::dump(raw_ostream &OS) const {
if (m_abbrevCollMap.empty()) {
if (AbbrevCollMap.empty()) {
OS << "< EMPTY >\n";
return;
}
DWARFAbbreviationDeclarationCollMapConstIter pos;
for (pos = m_abbrevCollMap.begin(); pos != m_abbrevCollMap.end(); ++pos) {
for (pos = AbbrevCollMap.begin(); pos != AbbrevCollMap.end(); ++pos) {
OS << format("Abbrev table for offset: 0x%8.8x\n", pos->first);
pos->second.dump(OS);
}
@ -92,17 +90,17 @@ void DWARFDebugAbbrev::dump(raw_ostream &OS) const {
const DWARFAbbreviationDeclarationSet*
DWARFDebugAbbrev::getAbbreviationDeclarationSet(uint64_t cu_abbr_offset) const {
DWARFAbbreviationDeclarationCollMapConstIter end = m_abbrevCollMap.end();
DWARFAbbreviationDeclarationCollMapConstIter end = AbbrevCollMap.end();
DWARFAbbreviationDeclarationCollMapConstIter pos;
if (m_prev_abbr_offset_pos != end &&
m_prev_abbr_offset_pos->first == cu_abbr_offset) {
return &(m_prev_abbr_offset_pos->second);
if (PrevAbbrOffsetPos != end &&
PrevAbbrOffsetPos->first == cu_abbr_offset) {
return &(PrevAbbrOffsetPos->second);
} else {
pos = m_abbrevCollMap.find(cu_abbr_offset);
m_prev_abbr_offset_pos = pos;
pos = AbbrevCollMap.find(cu_abbr_offset);
PrevAbbrOffsetPos = pos;
}
if (pos != m_abbrevCollMap.end())
if (pos != AbbrevCollMap.end())
return &(pos->second);
return NULL;
}

View File

@ -47,23 +47,25 @@ class DWARFAbbreviationDeclarationSet {
getAbbreviationDeclaration(uint32_t abbrCode) const;
};
typedef std::map<uint64_t, DWARFAbbreviationDeclarationSet>
class DWARFDebugAbbrev {
public:
typedef std::map<uint64_t, DWARFAbbreviationDeclarationSet>
DWARFAbbreviationDeclarationCollMap;
typedef DWARFAbbreviationDeclarationCollMap::iterator
typedef DWARFAbbreviationDeclarationCollMap::iterator
DWARFAbbreviationDeclarationCollMapIter;
typedef DWARFAbbreviationDeclarationCollMap::const_iterator
typedef DWARFAbbreviationDeclarationCollMap::const_iterator
DWARFAbbreviationDeclarationCollMapConstIter;
class DWARFDebugAbbrev {
private:
DWARFAbbreviationDeclarationCollMap AbbrevCollMap;
mutable DWARFAbbreviationDeclarationCollMapConstIter PrevAbbrOffsetPos;
public:
DWARFDebugAbbrev();
const DWARFAbbreviationDeclarationSet *
getAbbreviationDeclarationSet(uint64_t cu_abbr_offset) const;
void dump(raw_ostream &OS) const;
void parse(DataExtractor data);
protected:
DWARFAbbreviationDeclarationCollMap m_abbrevCollMap;
mutable DWARFAbbreviationDeclarationCollMapConstIter m_prev_abbr_offset_pos;
};
}

View File

@ -351,8 +351,7 @@ DWARFDebugInfoEntryMinimal::getAttributeValue(const DWARFCompileUnit *cu,
const uint32_t attr_offset = offset;
form_value = DWARFFormValue(AbbrevDecl->getFormByIndex(idx));
if (form_value.extractValue(debug_info_data, &offset, cu))
{
if (form_value.extractValue(debug_info_data, &offset, cu)) {
if (end_attr_offset_ptr)
*end_attr_offset_ptr = offset;
return attr_offset;

View File

@ -85,19 +85,16 @@ public:
// We know we are kept in a vector of contiguous entries, so we know
// our parent will be some index behind "this".
ParentIdx = this - parent;
}
else
} else
ParentIdx = 0;
}
void setSibling(DWARFDebugInfoEntryMinimal *sibling) {
if (sibling)
{
if (sibling) {
// We know we are kept in a vector of contiguous entries, so we know
// our sibling will be some index after "this".
SiblingIdx = sibling - this;
sibling->setParent(getParent());
}
else
} else
SiblingIdx = 0;
}

View File

@ -261,8 +261,7 @@ DWARFFormValue::dump(raw_ostream &OS, const DataExtractor *debug_str_data,
uint64_t uvalue = getUnsigned();
bool cu_relative_offset = false;
switch (Form)
{
switch (Form) {
case DW_FORM_addr: OS << format("0x%016x", uvalue); break;
case DW_FORM_flag:
case DW_FORM_data1: OS << format("0x%02x", uvalue); break;
@ -365,8 +364,7 @@ DWARFFormValue::getAsCString(const DataExtractor *debug_str_data_ptr) const {
return NULL;
}
uint64_t
DWARFFormValue::getReference(const DWARFCompileUnit *cu) const {
uint64_t DWARFFormValue::getReference(const DWARFCompileUnit *cu) const {
uint64_t die_offset = Value.uval;
switch (Form) {
case DW_FORM_ref1:
@ -397,7 +395,6 @@ DWARFFormValue::resolveCompileUnitReferences(const DWARFCompileUnit* cu) {
default:
break;
}
return false;
}
@ -408,8 +405,7 @@ const uint8_t *DWARFFormValue::BlockData() const {
}
bool DWARFFormValue::isBlockForm(uint16_t form) {
switch (form)
{
switch (form) {
case DW_FORM_block:
case DW_FORM_block1:
case DW_FORM_block2:
@ -420,8 +416,7 @@ bool DWARFFormValue::isBlockForm(uint16_t form) {
}
bool DWARFFormValue::isDataForm(uint16_t form) {
switch (form)
{
switch (form) {
case DW_FORM_sdata:
case DW_FORM_udata:
case DW_FORM_data1: