From 0230f7c763c5b5f988f629506f0ce050fbacaed4 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Mon, 9 Jul 2018 22:26:49 +0000 Subject: [PATCH] Use StringRef instead of `const char *`. I don't think there's a need to use `const char *`. In most (probably all?) cases, we need a length of a name later, so discarding a length will lead to a wasted effort. Differential Revision: https://reviews.llvm.org/D49046 llvm-svn: 336612 --- llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h | 2 +- llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h index 761871d..cae4804 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h @@ -32,7 +32,7 @@ public: /// The name of the object as given by the DW_AT_name attribute of the /// referenced DIE. - const char *Name; + StringRef Name; }; /// Each table consists of sets of variable length entries. Each set describes diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp index 956a91e..de8b6e5 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp @@ -37,7 +37,7 @@ DWARFDebugPubTable::DWARFDebugPubTable(StringRef Data, bool LittleEndian, if (DieRef == 0) break; uint8_t IndexEntryValue = GnuStyle ? PubNames.getU8(&Offset) : 0; - const char *Name = PubNames.getCStr(&Offset); + StringRef Name = PubNames.getCStrRef(&Offset); SetData.Entries.push_back( {DieRef, PubIndexEntryDescriptor(IndexEntryValue), Name}); } -- 2.7.4