[compiler-rt] DO_NOT_MERGE (PR #66682)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 20:54:25 PDT 2023
================
@@ -321,55 +322,61 @@ static uptr GetGlobalSizeFromDescriptor(uptr ptr) {
void ReportStats() {}
-static void PrintTagInfoAroundAddr(tag_t *tag_ptr, uptr num_rows,
- void (*print_tag)(InternalScopedString &s,
- tag_t *tag)) {
+template <typename PrintTag>
+static void PrintTagInfoAroundAddr(uptr addr, uptr num_rows,
+ InternalScopedString &s,
+ PrintTag print_tag) {
const uptr row_len = 16; // better be power of two.
- tag_t *center_row_beg = reinterpret_cast<tag_t *>(
- RoundDownTo(reinterpret_cast<uptr>(tag_ptr), row_len));
- tag_t *beg_row = center_row_beg - row_len * (num_rows / 2);
- tag_t *end_row = center_row_beg + row_len * ((num_rows + 1) / 2);
- InternalScopedString s;
- for (tag_t *row = beg_row; row < end_row; row += row_len) {
+ uptr center_row_beg = RoundDownTo(addr, row_len);
+ uptr beg_row = center_row_beg - row_len * (num_rows / 2);
+ uptr end_row = center_row_beg + row_len * ((num_rows + 1) / 2);
+ for (uptr row = beg_row; row < end_row; row += row_len) {
s.Append(row == center_row_beg ? "=>" : " ");
- s.AppendF("%p:", (void *)ShadowToMem(reinterpret_cast<uptr>(row)));
+ s.AppendF("%p:", (void *)ShadowToMem(row));
----------------
vitalybuka wrote:
even if it looks the same, I would prefer to use %p for pointers as intended.
https://github.com/llvm/llvm-project/pull/66682
More information about the llvm-commits
mailing list