[PATCH] D20711: [codeview] Improve readability of type record assembly

Amjad Aboud via llvm-commits llvm-commits at lists.llvm.org
Sat May 28 15:38:22 PDT 2016


aaboud added inline comments.

================
Comment at: lib/DebugInfo/CodeView/MemoryTypeTableBuilder.cpp:31
@@ +30,3 @@
+  memcpy(Mem + 2, Data.data(), Data.size());
+  for (int I = Data.size() + 2; I < TotalSize; ++I)
+    Mem[I] = LF_PAD0 + (TotalSize - I);
----------------
aaboud wrote:
> The Padding is created in the wrong order (check how it is emitted in CodeViewDebug.cpp lines 299-300.
> This should be like this:
> 
> ```
> for (int I = TotalSize - (Data.size() + 2) - 1; I >= 0; --I)
>   Mem[I] = LF_PAD0 + I;
> ```
It seems that LF_PAD0 should not be used in padding so the correct loop will look like this:

```
for (int I = TotalSize - (Data.size() + 2) ; I > 0; --I)
  Mem[I] = LF_PAD0 + I;
```


http://reviews.llvm.org/D20711





More information about the llvm-commits mailing list