[llvm] r336612 - Use StringRef instead of `const char *`.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 9 15:26:49 PDT 2018
Author: ruiu
Date: Mon Jul 9 15:26:49 2018
New Revision: 336612
URL: http://llvm.org/viewvc/llvm-project?rev=336612&view=rev
Log:
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
Modified:
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h?rev=336612&r1=336611&r2=336612&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h Mon Jul 9 15:26:49 2018
@@ -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
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp?rev=336612&r1=336611&r2=336612&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp Mon Jul 9 15:26:49 2018
@@ -37,7 +37,7 @@ DWARFDebugPubTable::DWARFDebugPubTable(S
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});
}
More information about the llvm-commits
mailing list