Make DIELoc/DIEBlock's ComputeSize method const. Add a setSize

method to actually set it in the class to avoid computing it
multiple times.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201751 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher
2014-02-20 02:40:45 +00:00
parent 0af815c0dc
commit eed3d708ee
3 changed files with 30 additions and 18 deletions
+18 -14
View File
@@ -424,14 +424,16 @@ void DIETypeSignature::dump() const { print(dbgs()); }
/// ComputeSize - calculate the size of the location expression.
///
unsigned DIELoc::ComputeSize(AsmPrinter *AP) {
if (!Size) {
const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
for (unsigned i = 0, N = Values.size(); i < N; ++i)
Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
}
unsigned DIELoc::ComputeSize(AsmPrinter *AP) const {
if (Size)
return Size;
return Size;
unsigned Sz = 0;
const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
for (unsigned i = 0, N = Values.size(); i < N; ++i)
Sz += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
return Sz;
}
/// EmitValue - Emit location data.
@@ -479,14 +481,16 @@ void DIELoc::print(raw_ostream &O) const {
/// ComputeSize - calculate the size of the block.
///
unsigned DIEBlock::ComputeSize(AsmPrinter *AP) {
if (!Size) {
const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
for (unsigned i = 0, N = Values.size(); i < N; ++i)
Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
}
unsigned DIEBlock::ComputeSize(AsmPrinter *AP) const {
if (Size)
return Size;
return Size;
unsigned Sz = 0;
const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
for (unsigned i = 0, N = Values.size(); i < N; ++i)
Sz += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
return Sz;
}
/// EmitValue - Emit block data.