Simplify. There is no need to use static variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129406 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2011-04-12 23:10:47 +00:00
parent 5d60763831
commit 513edf62fa

View File

@@ -2206,17 +2206,15 @@ DwarfDebug::computeSizeAndOffset(DIE *Die, unsigned Offset, bool Last) {
/// computeSizeAndOffsets - Compute the size and offset of all the DIEs. /// computeSizeAndOffsets - Compute the size and offset of all the DIEs.
/// ///
void DwarfDebug::computeSizeAndOffsets() { void DwarfDebug::computeSizeAndOffsets() {
unsigned PrevOffset = 0;
for (DenseMap<const MDNode *, CompileUnit *>::iterator I = CUMap.begin(), for (DenseMap<const MDNode *, CompileUnit *>::iterator I = CUMap.begin(),
E = CUMap.end(); I != E; ++I) { E = CUMap.end(); I != E; ++I) {
// Compute size of compile unit header. // Compute size of compile unit header.
static unsigned Offset = PrevOffset + unsigned Offset =
sizeof(int32_t) + // Length of Compilation Unit Info sizeof(int32_t) + // Length of Compilation Unit Info
sizeof(int16_t) + // DWARF version number sizeof(int16_t) + // DWARF version number
sizeof(int32_t) + // Offset Into Abbrev. Section sizeof(int32_t) + // Offset Into Abbrev. Section
sizeof(int8_t); // Pointer Size (in bytes) sizeof(int8_t); // Pointer Size (in bytes)
computeSizeAndOffset(I->second->getCUDie(), Offset, true); computeSizeAndOffset(I->second->getCUDie(), Offset, true);
PrevOffset = Offset;
} }
} }