[llvm-commits] [llvm] r89873 - in /llvm/trunk/lib: CodeGen/AsmPrinter/DwarfDebug.cpp Target/PIC16/PIC16DebugInfo.cpp
Benjamin Kramer
benny.kra at googlemail.com
Wed Nov 25 10:26:09 PST 2009
Author: d0k
Date: Wed Nov 25 12:26:09 2009
New Revision: 89873
URL: http://llvm.org/viewvc/llvm-project?rev=89873&view=rev
Log:
Avoid some possibly unsafe uses of StringRef::data().
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=89873&r1=89872&r2=89873&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Nov 25 12:26:09 2009
@@ -1010,7 +1010,7 @@
// Objective-C symbol names and symbol whose name is replaced using GCC's
// __asm__ attribute.
if (LinkageName[0] == 1)
- LinkageName = LinkageName.data() + 1;
+ LinkageName = LinkageName.substr(1);
addString(GVDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
LinkageName);
}
@@ -1097,7 +1097,7 @@
// Objective-C symbol names and symbol whose name is replaced using GCC's
// __asm__ attribute.
if (LinkageName[0] == 1)
- LinkageName = LinkageName.data() + 1;
+ LinkageName = LinkageName.substr(1);
addString(SPDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
LinkageName);
}
@@ -2899,7 +2899,7 @@
// Objective-C symbol names and symbol whose name is replaced using GCC's
// __asm__ attribute.
if (LName[0] == 1)
- LName = LName.data() + 1;
+ LName = LName.substr(1);
// Asm->EmitString(LName);
EmitSectionOffset("string", "section_str",
StringPool.idFor(LName), false, true);
Modified: llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp?rev=89873&r1=89872&r2=89873&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp Wed Nov 25 12:26:09 2009
@@ -306,10 +306,9 @@
int ElementAux[PIC16Dbg::AuxSize] = { 0 };
std::string TagName = "";
DIDerivedType DITy(Element.getNode());
- StringRef ElementName = DITy.getName();
unsigned short ElementSize = DITy.getSizeInBits()/8;
// Get mangleddd name for this structure/union element.
- std::string MangMemName = ElementName.data() + SuffixNo;
+ std::string MangMemName = DITy.getName().str() + SuffixNo;
PopulateDebugInfo(DITy, TypeNo, HasAux, ElementAux, TagName);
short Class = 0;
if( CTy.getTag() == dwarf::DW_TAG_union_type)
@@ -337,12 +336,11 @@
continue;
if (CTy.getTag() == dwarf::DW_TAG_union_type ||
CTy.getTag() == dwarf::DW_TAG_structure_type ) {
- StringRef Name = CTy.getName();
// Get the number after llvm.dbg.composite and make UniqueSuffix from
// it.
std::string DIVar = CTy.getNode()->getNameStr();
std::string UniqueSuffix = "." + DIVar.substr(18);
- std::string MangledCTyName = Name.data() + UniqueSuffix;
+ std::string MangledCTyName = CTy.getName().str() + UniqueSuffix;
unsigned short size = CTy.getSizeInBits()/8;
int Aux[PIC16Dbg::AuxSize] = {0};
// 7th and 8th byte represent size of structure/union.
More information about the llvm-commits
mailing list