Be more rigorous about the sizes of forms and attributes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187953 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2013-08-08 01:41:00 +00:00
parent e32032d812
commit 3166762610
8 changed files with 84 additions and 84 deletions

View File

@ -110,7 +110,7 @@ namespace llvm {
return !operator==(Other);
}
unsigned getTag() const {
uint16_t getTag() const {
return getUnsignedField(0) & ~LLVMDebugVersionMask;
}

View File

@ -122,7 +122,7 @@ DIE *DIE::getCompileUnit() {
llvm_unreachable("We should not have orphaned DIEs.");
}
DIEValue *DIE::findAttribute(unsigned Attribute) {
DIEValue *DIE::findAttribute(uint16_t Attribute) {
const SmallVectorImpl<DIEValue *> &Values = getValues();
const DIEAbbrev &Abbrevs = getAbbrev();
@ -199,7 +199,7 @@ void DIEValue::dump() const {
/// EmitValue - Emit integer of appropriate size.
///
void DIEInteger::EmitValue(AsmPrinter *Asm, unsigned Form) const {
void DIEInteger::EmitValue(AsmPrinter *Asm, uint16_t Form) const {
unsigned Size = ~0U;
switch (Form) {
case dwarf::DW_FORM_flag_present:
@ -231,7 +231,7 @@ void DIEInteger::EmitValue(AsmPrinter *Asm, unsigned Form) const {
/// SizeOf - Determine size of integer value in bytes.
///
unsigned DIEInteger::SizeOf(AsmPrinter *AP, unsigned Form) const {
unsigned DIEInteger::SizeOf(AsmPrinter *AP, uint16_t Form) const {
switch (Form) {
case dwarf::DW_FORM_flag_present: return 0;
case dwarf::DW_FORM_flag: // Fall thru
@ -266,13 +266,13 @@ void DIEInteger::print(raw_ostream &O) const {
/// EmitValue - Emit expression value.
///
void DIEExpr::EmitValue(AsmPrinter *AP, unsigned Form) const {
void DIEExpr::EmitValue(AsmPrinter *AP, uint16_t Form) const {
AP->OutStreamer.EmitValue(Expr, SizeOf(AP, Form));
}
/// SizeOf - Determine size of expression value in bytes.
///
unsigned DIEExpr::SizeOf(AsmPrinter *AP, unsigned Form) const {
unsigned DIEExpr::SizeOf(AsmPrinter *AP, uint16_t Form) const {
if (Form == dwarf::DW_FORM_data4) return 4;
if (Form == dwarf::DW_FORM_sec_offset) return 4;
if (Form == dwarf::DW_FORM_strp) return 4;
@ -292,13 +292,13 @@ void DIEExpr::print(raw_ostream &O) const {
/// EmitValue - Emit label value.
///
void DIELabel::EmitValue(AsmPrinter *AP, unsigned Form) const {
void DIELabel::EmitValue(AsmPrinter *AP, uint16_t Form) const {
AP->EmitLabelReference(Label, SizeOf(AP, Form));
}
/// SizeOf - Determine size of label value in bytes.
///
unsigned DIELabel::SizeOf(AsmPrinter *AP, unsigned Form) const {
unsigned DIELabel::SizeOf(AsmPrinter *AP, uint16_t Form) const {
if (Form == dwarf::DW_FORM_data4) return 4;
if (Form == dwarf::DW_FORM_sec_offset) return 4;
if (Form == dwarf::DW_FORM_strp) return 4;
@ -317,13 +317,13 @@ void DIELabel::print(raw_ostream &O) const {
/// EmitValue - Emit delta value.
///
void DIEDelta::EmitValue(AsmPrinter *AP, unsigned Form) const {
void DIEDelta::EmitValue(AsmPrinter *AP, uint16_t Form) const {
AP->EmitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form));
}
/// SizeOf - Determine size of delta value in bytes.
///
unsigned DIEDelta::SizeOf(AsmPrinter *AP, unsigned Form) const {
unsigned DIEDelta::SizeOf(AsmPrinter *AP, uint16_t Form) const {
if (Form == dwarf::DW_FORM_data4) return 4;
if (Form == dwarf::DW_FORM_strp) return 4;
return AP->getDataLayout().getPointerSize();
@ -341,13 +341,13 @@ void DIEDelta::print(raw_ostream &O) const {
/// EmitValue - Emit string value.
///
void DIEString::EmitValue(AsmPrinter *AP, unsigned Form) const {
void DIEString::EmitValue(AsmPrinter *AP, uint16_t Form) const {
Access->EmitValue(AP, Form);
}
/// SizeOf - Determine size of delta value in bytes.
///
unsigned DIEString::SizeOf(AsmPrinter *AP, unsigned Form) const {
unsigned DIEString::SizeOf(AsmPrinter *AP, uint16_t Form) const {
return Access->SizeOf(AP, Form);
}
@ -364,7 +364,7 @@ void DIEString::print(raw_ostream &O) const {
/// EmitValue - Emit debug information entry offset.
///
void DIEEntry::EmitValue(AsmPrinter *AP, unsigned Form) const {
void DIEEntry::EmitValue(AsmPrinter *AP, uint16_t Form) const {
AP->EmitInt32(Entry->getOffset());
}
@ -402,7 +402,7 @@ unsigned DIEBlock::ComputeSize(AsmPrinter *AP) {
/// EmitValue - Emit block data.
///
void DIEBlock::EmitValue(AsmPrinter *Asm, unsigned Form) const {
void DIEBlock::EmitValue(AsmPrinter *Asm, uint16_t Form) const {
switch (Form) {
default: llvm_unreachable("Improper form for block");
case dwarf::DW_FORM_block1: Asm->EmitInt8(Size); break;
@ -418,7 +418,7 @@ void DIEBlock::EmitValue(AsmPrinter *Asm, unsigned Form) const {
/// SizeOf - Determine size of block data in bytes.
///
unsigned DIEBlock::SizeOf(AsmPrinter *AP, unsigned Form) const {
unsigned DIEBlock::SizeOf(AsmPrinter *AP, uint16_t Form) const {
switch (Form) {
case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);

View File

@ -143,7 +143,7 @@ namespace llvm {
// Accessors.
DIEAbbrev &getAbbrev() { return Abbrev; }
unsigned getAbbrevNumber() const { return Abbrev.getNumber(); }
unsigned getTag() const { return Abbrev.getTag(); }
uint16_t getTag() const { return Abbrev.getTag(); }
unsigned getOffset() const { return Offset; }
unsigned getSize() const { return Size; }
const std::vector<DIE *> &getChildren() const { return Children; }
@ -152,13 +152,13 @@ namespace llvm {
/// Climb up the parent chain to get the compile unit DIE this DIE belongs
/// to.
DIE *getCompileUnit();
void setTag(unsigned Tag) { Abbrev.setTag(Tag); }
void setTag(uint16_t Tag) { Abbrev.setTag(Tag); }
void setOffset(unsigned O) { Offset = O; }
void setSize(unsigned S) { Size = S; }
/// addValue - Add a value and attributes to a DIE.
///
void addValue(unsigned Attribute, unsigned Form, DIEValue *Value) {
void addValue(uint16_t Attribute, uint16_t Form, DIEValue *Value) {
Abbrev.AddAttribute(Attribute, Form);
Values.push_back(Value);
}
@ -177,7 +177,7 @@ namespace llvm {
/// findAttribute - Find a value in the DIE with the attribute given, returns NULL
/// if no such attribute exists.
DIEValue *findAttribute(unsigned Attribute);
DIEValue *findAttribute(uint16_t Attribute);
#ifndef NDEBUG
void print(raw_ostream &O, unsigned IndentCount = 0) const;
@ -213,11 +213,11 @@ namespace llvm {
/// EmitValue - Emit value via the Dwarf writer.
///
virtual void EmitValue(AsmPrinter *AP, unsigned Form) const = 0;
virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const = 0;
/// SizeOf - Return the size of a value in bytes.
///
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const = 0;
virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const = 0;
#ifndef NDEBUG
virtual void print(raw_ostream &O) const = 0;
@ -235,7 +235,7 @@ namespace llvm {
/// BestForm - Choose the best form for integer.
///
static unsigned BestForm(bool IsSigned, uint64_t Int) {
static uint16_t BestForm(bool IsSigned, uint64_t Int) {
if (IsSigned) {
const int64_t SignedInt = Int;
if ((char)Int == SignedInt) return dwarf::DW_FORM_data1;
@ -251,13 +251,13 @@ namespace llvm {
/// EmitValue - Emit integer of appropriate size.
///
virtual void EmitValue(AsmPrinter *AP, unsigned Form) const;
virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;
uint64_t getValue() const { return Integer; }
/// SizeOf - Determine size of integer value in bytes.
///
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const;
virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;
// Implement isa/cast/dyncast.
static bool classof(const DIEValue *I) { return I->getType() == isInteger; }
@ -277,7 +277,7 @@ namespace llvm {
/// EmitValue - Emit expression value.
///
virtual void EmitValue(AsmPrinter *AP, unsigned Form) const;
virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;
/// getValue - Get MCExpr.
///
@ -285,7 +285,7 @@ namespace llvm {
/// SizeOf - Determine size of expression value in bytes.
///
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const;
virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;
// Implement isa/cast/dyncast.
static bool classof(const DIEValue *E) { return E->getType() == isExpr; }
@ -305,7 +305,7 @@ namespace llvm {
/// EmitValue - Emit label value.
///
virtual void EmitValue(AsmPrinter *AP, unsigned Form) const;
virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;
/// getValue - Get MCSymbol.
///
@ -313,7 +313,7 @@ namespace llvm {
/// SizeOf - Determine size of label value in bytes.
///
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const;
virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;
// Implement isa/cast/dyncast.
static bool classof(const DIEValue *L) { return L->getType() == isLabel; }
@ -335,11 +335,11 @@ namespace llvm {
/// EmitValue - Emit delta value.
///
virtual void EmitValue(AsmPrinter *AP, unsigned Form) const;
virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;
/// SizeOf - Determine size of delta value in bytes.
///
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const;
virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;
// Implement isa/cast/dyncast.
static bool classof(const DIEValue *D) { return D->getType() == isDelta; }
@ -365,11 +365,11 @@ namespace llvm {
/// EmitValue - Emit delta value.
///
virtual void EmitValue(AsmPrinter *AP, unsigned Form) const;
virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;
/// SizeOf - Determine size of delta value in bytes.
///
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const;
virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;
// Implement isa/cast/dyncast.
static bool classof(const DIEValue *D) { return D->getType() == isString; }
@ -394,13 +394,13 @@ namespace llvm {
/// EmitValue - Emit debug information entry offset.
///
virtual void EmitValue(AsmPrinter *AP, unsigned Form) const;
virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;
/// SizeOf - Determine size of debug information entry in bytes.
///
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const {
return Form == dwarf::DW_FORM_ref_addr ? getRefAddrSize(AP) :
sizeof(int32_t);
virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const {
return Form == dwarf::DW_FORM_ref_addr ? getRefAddrSize(AP)
: sizeof(int32_t);
}
/// Returns size of a ref_addr entry.
@ -430,7 +430,7 @@ namespace llvm {
/// BestForm - Choose the best form for data.
///
unsigned BestForm() const {
uint16_t BestForm() const {
if ((unsigned char)Size == Size) return dwarf::DW_FORM_block1;
if ((unsigned short)Size == Size) return dwarf::DW_FORM_block2;
if ((unsigned int)Size == Size) return dwarf::DW_FORM_block4;
@ -439,11 +439,11 @@ namespace llvm {
/// EmitValue - Emit block data.
///
virtual void EmitValue(AsmPrinter *AP, unsigned Form) const;
virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;
/// SizeOf - Determine size of block data in bytes.
///
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const;
virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;
// Implement isa/cast/dyncast.
static bool classof(const DIEValue *E) { return E->getType() == isBlock; }

View File

@ -99,7 +99,7 @@ int64_t CompileUnit::getDefaultLowerBound() const {
}
/// addFlag - Add a flag that is true.
void CompileUnit::addFlag(DIE *Die, unsigned Attribute) {
void CompileUnit::addFlag(DIE *Die, uint16_t Attribute) {
if (!DD->useDarwinGDBCompat())
Die->addValue(Attribute, dwarf::DW_FORM_flag_present,
DIEIntegerOne);
@ -109,8 +109,8 @@ void CompileUnit::addFlag(DIE *Die, unsigned Attribute) {
/// addUInt - Add an unsigned integer attribute data and value.
///
void CompileUnit::addUInt(DIE *Die, unsigned Attribute,
unsigned Form, uint64_t Integer) {
void CompileUnit::addUInt(DIE *Die, uint16_t Attribute,
uint16_t Form, uint64_t Integer) {
if (!Form) Form = DIEInteger::BestForm(false, Integer);
DIEValue *Value = Integer == 1 ?
DIEIntegerOne : new (DIEValueAllocator) DIEInteger(Integer);
@ -119,8 +119,8 @@ void CompileUnit::addUInt(DIE *Die, unsigned Attribute,
/// addSInt - Add an signed integer attribute data and value.
///
void CompileUnit::addSInt(DIE *Die, unsigned Attribute,
unsigned Form, int64_t Integer) {
void CompileUnit::addSInt(DIE *Die, uint16_t Attribute,
uint16_t Form, int64_t Integer) {
if (!Form) Form = DIEInteger::BestForm(true, Integer);
DIEValue *Value = new (DIEValueAllocator) DIEInteger(Integer);
Die->addValue(Attribute, Form, Value);
@ -131,9 +131,9 @@ void CompileUnit::addSInt(DIE *Die, unsigned Attribute,
/// more predictable sizes. In the case of split dwarf we emit an index
/// into another table which gets us the static offset into the string
/// table.
void CompileUnit::addString(DIE *Die, unsigned Attribute, StringRef String) {
void CompileUnit::addString(DIE *Die, uint16_t Attribute, StringRef String) {
DIEValue *Value;
unsigned Form;
uint16_t Form;
if (!DD->useSplitDwarf()) {
MCSymbol *Symb = DU->getStringPoolEntry(String);
if (Asm->needsRelocationsForDwarfStringPool())
@ -154,7 +154,7 @@ void CompileUnit::addString(DIE *Die, unsigned Attribute, StringRef String) {
/// addLocalString - Add a string attribute data and value. This is guaranteed
/// to be in the local string pool instead of indirected.
void CompileUnit::addLocalString(DIE *Die, unsigned Attribute,
void CompileUnit::addLocalString(DIE *Die, uint16_t Attribute,
StringRef String) {
MCSymbol *Symb = DU->getStringPoolEntry(String);
DIEValue *Value;
@ -169,7 +169,7 @@ void CompileUnit::addLocalString(DIE *Die, unsigned Attribute,
/// addExpr - Add a Dwarf expression attribute data and value.
///
void CompileUnit::addExpr(DIE *Die, unsigned Attribute, unsigned Form,
void CompileUnit::addExpr(DIE *Die, uint16_t Attribute, uint16_t Form,
const MCExpr *Expr) {
DIEValue *Value = new (DIEValueAllocator) DIEExpr(Expr);
Die->addValue(Attribute, Form, Value);
@ -177,7 +177,7 @@ void CompileUnit::addExpr(DIE *Die, unsigned Attribute, unsigned Form,
/// addLabel - Add a Dwarf label attribute data and value.
///
void CompileUnit::addLabel(DIE *Die, unsigned Attribute, unsigned Form,
void CompileUnit::addLabel(DIE *Die, uint16_t Attribute, uint16_t Form,
const MCSymbol *Label) {
DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
Die->addValue(Attribute, Form, Value);
@ -186,7 +186,7 @@ void CompileUnit::addLabel(DIE *Die, unsigned Attribute, unsigned Form,
/// addLabelAddress - Add a dwarf label attribute data and value using
/// DW_FORM_addr or DW_FORM_GNU_addr_index.
///
void CompileUnit::addLabelAddress(DIE *Die, unsigned Attribute,
void CompileUnit::addLabelAddress(DIE *Die, uint16_t Attribute,
MCSymbol *Label) {
if (!DD->useSplitDwarf()) {
if (Label != NULL) {
@ -218,7 +218,7 @@ void CompileUnit::addOpAddress(DIE *Die, const MCSymbol *Sym) {
/// addDelta - Add a label delta attribute data and value.
///
void CompileUnit::addDelta(DIE *Die, unsigned Attribute, unsigned Form,
void CompileUnit::addDelta(DIE *Die, uint16_t Attribute, uint16_t Form,
const MCSymbol *Hi, const MCSymbol *Lo) {
DIEValue *Value = new (DIEValueAllocator) DIEDelta(Hi, Lo);
Die->addValue(Attribute, Form, Value);
@ -226,14 +226,14 @@ void CompileUnit::addDelta(DIE *Die, unsigned Attribute, unsigned Form,
/// addDIEEntry - Add a DIE attribute data and value.
///
void CompileUnit::addDIEEntry(DIE *Die, unsigned Attribute, unsigned Form,
void CompileUnit::addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form,
DIE *Entry) {
Die->addValue(Attribute, Form, createDIEEntry(Entry));
}
/// addBlock - Add block data.
///
void CompileUnit::addBlock(DIE *Die, unsigned Attribute, unsigned Form,
void CompileUnit::addBlock(DIE *Die, uint16_t Attribute, uint16_t Form,
DIEBlock *Block) {
Block->ComputeSize(Asm);
DIEBlocks.push_back(Block); // Memoize so we can call the destructor later on.
@ -393,7 +393,7 @@ void CompileUnit::addRegisterOffset(DIE *TheDie, unsigned Reg,
/// addAddress - Add an address attribute to a die based on the location
/// provided.
void CompileUnit::addAddress(DIE *Die, unsigned Attribute,
void CompileUnit::addAddress(DIE *Die, uint16_t Attribute,
const MachineLocation &Location, bool Indirect) {
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
@ -416,7 +416,7 @@ void CompileUnit::addAddress(DIE *Die, unsigned Attribute,
/// the starting location. Add the DWARF information to the die.
///
void CompileUnit::addComplexAddress(const DbgVariable &DV, DIE *Die,
unsigned Attribute,
uint16_t Attribute,
const MachineLocation &Location) {
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
unsigned N = DV.getNumAddrElements();
@ -509,11 +509,11 @@ void CompileUnit::addComplexAddress(const DbgVariable &DV, DIE *Die,
/// more information, read large comment just above here.
///
void CompileUnit::addBlockByrefAddress(const DbgVariable &DV, DIE *Die,
unsigned Attribute,
uint16_t Attribute,
const MachineLocation &Location) {
DIType Ty = DV.getType();
DIType TmpTy = Ty;
unsigned Tag = Ty.getTag();
uint16_t Tag = Ty.getTag();
bool isPointer = false;
StringRef varName = DV.getName();
@ -609,7 +609,7 @@ void CompileUnit::addConstantValue(DIE *Die, const MachineOperand &MO,
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
int SizeInBits = -1;
bool SignedConstant = isTypeSigned(Ty, &SizeInBits);
unsigned Form = SignedConstant ? dwarf::DW_FORM_sdata : dwarf::DW_FORM_udata;
uint16_t Form = SignedConstant ? dwarf::DW_FORM_sdata : dwarf::DW_FORM_udata;
switch (SizeInBits) {
case 8: Form = dwarf::DW_FORM_data1; break;
case 16: Form = dwarf::DW_FORM_data2; break;
@ -775,7 +775,7 @@ DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
}
/// addType - Add a new type attribute to the specified entity.
void CompileUnit::addType(DIE *Entity, DIType Ty, unsigned Attribute) {
void CompileUnit::addType(DIE *Entity, DIType Ty, uint16_t Attribute) {
if (!Ty.isType())
return;
@ -814,7 +814,7 @@ void CompileUnit::addGlobalType(DIType Ty) {
/// addPubTypes - Add type for pubtypes section.
void CompileUnit::addPubTypes(DISubprogram SP) {
DICompositeType SPTy = SP.getType();
unsigned SPTag = SPTy.getTag();
uint16_t SPTag = SPTy.getTag();
if (SPTag != dwarf::DW_TAG_subroutine_type)
return;
@ -854,7 +854,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DIDerivedType DTy) {
// Get core information.
StringRef Name = DTy.getName();
uint64_t Size = DTy.getSizeInBits() >> 3;
unsigned Tag = DTy.getTag();
uint16_t Tag = DTy.getTag();
// FIXME - Workaround for templates.
if (Tag == dwarf::DW_TAG_inheritance) Tag = dwarf::DW_TAG_reference_type;
@ -896,7 +896,7 @@ static bool isTypeUnitScoped(DIType Ty) {
/// Return true if the type should be split out into a type unit.
static bool shouldCreateTypeUnit(DICompositeType CTy) {
unsigned Tag = CTy.getTag();
uint16_t Tag = CTy.getTag();
switch (Tag) {
case dwarf::DW_TAG_structure_type:
@ -920,7 +920,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
StringRef Name = CTy.getName();
uint64_t Size = CTy.getSizeInBits() >> 3;
unsigned Tag = CTy.getTag();
uint16_t Tag = CTy.getTag();
Buffer.setTag(Tag);
switch (Tag) {
@ -1559,7 +1559,7 @@ DIE *CompileUnit::constructVariableDIE(DbgVariable *DV,
StringRef Name = DV->getName();
// Translate tag to proper Dwarf tag.
unsigned Tag = DV->getTag();
uint16_t Tag = DV->getTag();
// Define variable debug information entry.
DIE *VariableDie = new DIE(Tag);

View File

@ -196,38 +196,38 @@ public:
}
/// addFlag - Add a flag that is true to the DIE.
void addFlag(DIE *Die, unsigned Attribute);
void addFlag(DIE *Die, uint16_t Attribute);
/// addUInt - Add an unsigned integer attribute data and value.
///
void addUInt(DIE *Die, unsigned Attribute, unsigned Form, uint64_t Integer);
void addUInt(DIE *Die, uint16_t Attribute, uint16_t Form, uint64_t Integer);
/// addSInt - Add an signed integer attribute data and value.
///
void addSInt(DIE *Die, unsigned Attribute, unsigned Form, int64_t Integer);
void addSInt(DIE *Die, uint16_t Attribute, uint16_t Form, int64_t Integer);
/// addString - Add a string attribute data and value.
///
void addString(DIE *Die, unsigned Attribute, const StringRef Str);
void addString(DIE *Die, uint16_t Attribute, const StringRef Str);
/// addLocalString - Add a string attribute data and value.
///
void addLocalString(DIE *Die, unsigned Attribute, const StringRef Str);
void addLocalString(DIE *Die, uint16_t Attribute, const StringRef Str);
/// addExpr - Add a Dwarf expression attribute data and value.
///
void addExpr(DIE *Die, unsigned Attribute, unsigned Form,
void addExpr(DIE *Die, uint16_t Attribute, uint16_t Form,
const MCExpr *Expr);
/// addLabel - Add a Dwarf label attribute data and value.
///
void addLabel(DIE *Die, unsigned Attribute, unsigned Form,
void addLabel(DIE *Die, uint16_t Attribute, uint16_t Form,
const MCSymbol *Label);
/// addLabelAddress - Add a dwarf label attribute data and value using
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.
///
void addLabelAddress(DIE *Die, unsigned Attribute, MCSymbol *Label);
void addLabelAddress(DIE *Die, uint16_t Attribute, MCSymbol *Label);
/// addOpAddress - Add a dwarf op address data and value using the
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
@ -237,16 +237,16 @@ public:
/// addDelta - Add a label delta attribute data and value.
///
void addDelta(DIE *Die, unsigned Attribute, unsigned Form,
void addDelta(DIE *Die, uint16_t Attribute, uint16_t Form,
const MCSymbol *Hi, const MCSymbol *Lo);
/// addDIEEntry - Add a DIE attribute data and value.
///
void addDIEEntry(DIE *Die, unsigned Attribute, unsigned Form, DIE *Entry);
void addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form, DIE *Entry);
/// addBlock - Add block data.
///
void addBlock(DIE *Die, unsigned Attribute, unsigned Form, DIEBlock *Block);
void addBlock(DIE *Die, uint16_t Attribute, uint16_t Form, DIEBlock *Block);
/// addSourceLine - Add location information to specified debug information
/// entry.
@ -259,7 +259,7 @@ public:
/// addAddress - Add an address attribute to a die based on the location
/// provided.
void addAddress(DIE *Die, unsigned Attribute,
void addAddress(DIE *Die, uint16_t Attribute,
const MachineLocation &Location, bool Indirect = false);
/// addConstantValue - Add constant value entry in variable DIE.
@ -285,7 +285,7 @@ public:
/// (navigating the extra location information encoded in the type) based on
/// the starting location. Add the DWARF information to the die.
///
void addComplexAddress(const DbgVariable &DV, DIE *Die, unsigned Attribute,
void addComplexAddress(const DbgVariable &DV, DIE *Die, uint16_t Attribute,
const MachineLocation &Location);
// FIXME: Should be reformulated in terms of addComplexAddress.
@ -295,7 +295,7 @@ public:
/// starting location. Add the DWARF information to the die. Obsolete,
/// please use addComplexAddress instead.
///
void addBlockByrefAddress(const DbgVariable &DV, DIE *Die, unsigned Attribute,
void addBlockByrefAddress(const DbgVariable &DV, DIE *Die, uint16_t Attribute,
const MachineLocation &Location);
/// addVariableAddress - Add DW_AT_location attribute for a
@ -309,7 +309,7 @@ public:
/// addType - Add a new type attribute to the specified entity. This takes
/// and attribute parameter because DW_AT_friend attributes are also
/// type references.
void addType(DIE *Entity, DIType Ty, unsigned Attribute = dwarf::DW_AT_type);
void addType(DIE *Entity, DIType Ty, uint16_t Attribute = dwarf::DW_AT_type);
/// getOrCreateNameSpace - Create a DIE for DINameSpace.
DIE *getOrCreateNameSpace(DINameSpace NS);

View File

@ -147,7 +147,7 @@ DIType DbgVariable::getType() const {
the pointers and __Block_byref_x_VarName struct to find the actual
value of the variable. The function addBlockByrefType does this. */
DIType subType = Ty;
unsigned tag = Ty.getTag();
uint16_t tag = Ty.getTag();
if (tag == dwarf::DW_TAG_pointer_type) {
DIDerivedType DTy = DIDerivedType(Ty);
@ -392,7 +392,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU,
// Add arguments.
DICompositeType SPTy = SP.getType();
DIArray Args = SPTy.getTypeArray();
unsigned SPTag = SPTy.getTag();
uint16_t SPTag = SPTy.getTag();
if (SPTag == dwarf::DW_TAG_subroutine_type)
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);

View File

@ -169,7 +169,7 @@ public:
int getFrameIndex() const { return FrameIndex; }
void setFrameIndex(int FI) { FrameIndex = FI; }
// Translate tag to proper Dwarf tag.
unsigned getTag() const {
uint16_t getTag() const {
if (Var.getTag() == dwarf::DW_TAG_arg_variable)
return dwarf::DW_TAG_formal_parameter;

View File

@ -428,7 +428,7 @@ bool DIType::Verify() const {
return false;
// FIXME: Sink this into the various subclass verifies.
unsigned Tag = getTag();
uint16_t Tag = getTag();
if (!isBasicType() && Tag != dwarf::DW_TAG_const_type &&
Tag != dwarf::DW_TAG_volatile_type && Tag != dwarf::DW_TAG_pointer_type &&
Tag != dwarf::DW_TAG_ptr_to_member_type &&
@ -598,7 +598,7 @@ bool DIImportedEntity::Verify() const {
/// getOriginalTypeSize - If this type is derived from a base type then
/// return base type size.
uint64_t DIDerivedType::getOriginalTypeSize() const {
unsigned Tag = getTag();
uint16_t Tag = getTag();
if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type &&