From e51e7a3fa8554f0bbf49c91e899f728664b488b5 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 26 Sep 2014 05:50:45 +0000 Subject: [PATCH] llvm-vtabledump: strip trailing NUL bytes llvm-svn: 218502 --- test/tools/llvm-vtabledump/trivial.test | 4 ++-- tools/llvm-vtabledump/llvm-vtabledump.cpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/tools/llvm-vtabledump/trivial.test b/test/tools/llvm-vtabledump/trivial.test index a0b9683296e..4ee37ecdd88 100644 --- a/test/tools/llvm-vtabledump/trivial.test +++ b/test/tools/llvm-vtabledump/trivial.test @@ -44,7 +44,7 @@ CHECK-NEXT: ??_R1A@?0A@EA@S@@8[Flags]: 64 CHECK-NEXT: ??_R1A@?0A@EA@S@@8[ClassHierarchyDescriptor]: ??_R3S@@8 CHECK-NEXT: ??_R0?AUA@@@8[VFPtr]: ??_7type_info@@6B@ CHECK-NEXT: ??_R0?AUA@@@8[AlwaysZero]: 0 -CHECK-NEXT: ??_R0?AUA@@@8[MangledName]: .?AUA@@\x00 +CHECK-NEXT: ??_R0?AUA@@@8[MangledName]: .?AUA@@ CHECK-NEXT: ??_R0?AUS@@@8[VFPtr]: ??_7type_info@@6B@ CHECK-NEXT: ??_R0?AUS@@@8[AlwaysZero]: 0 -CHECK-NEXT: ??_R0?AUS@@@8[MangledName]: .?AUS@@\x00 +CHECK-NEXT: ??_R0?AUS@@@8[MangledName]: .?AUS@@ diff --git a/tools/llvm-vtabledump/llvm-vtabledump.cpp b/tools/llvm-vtabledump/llvm-vtabledump.cpp index e3e13693923..95803a37082 100644 --- a/tools/llvm-vtabledump/llvm-vtabledump.cpp +++ b/tools/llvm-vtabledump/llvm-vtabledump.cpp @@ -303,7 +303,9 @@ static void dumpVTables(const ObjectFile *Obj) { AlwaysZero |= Data; outs() << TDName << "[AlwaysZero]: " << AlwaysZero << '\n'; outs() << TDName << "[MangledName]: "; - outs().write_escaped(TD.MangledName, /*UseHexEscapes=*/true) << '\n'; + outs().write_escaped(TD.MangledName.rtrim(StringRef("\0", 1)), + /*UseHexEscapes=*/true) + << '\n'; } }