mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-30 19:35:54 +00:00
Avoid some possibly unsafe uses of StringRef::data().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89873 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
65dbc909f5
commit
1c3451fc99
@ -1010,7 +1010,7 @@ DIE *DwarfDebug::createGlobalVariableDIE(CompileUnit *DW_Unit,
|
|||||||
// Objective-C symbol names and symbol whose name is replaced using GCC's
|
// Objective-C symbol names and symbol whose name is replaced using GCC's
|
||||||
// __asm__ attribute.
|
// __asm__ attribute.
|
||||||
if (LinkageName[0] == 1)
|
if (LinkageName[0] == 1)
|
||||||
LinkageName = LinkageName.data() + 1;
|
LinkageName = LinkageName.substr(1);
|
||||||
addString(GVDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
|
addString(GVDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
|
||||||
LinkageName);
|
LinkageName);
|
||||||
}
|
}
|
||||||
@ -1097,7 +1097,7 @@ DIE *DwarfDebug::createSubprogramDIE(CompileUnit *DW_Unit,
|
|||||||
// Objective-C symbol names and symbol whose name is replaced using GCC's
|
// Objective-C symbol names and symbol whose name is replaced using GCC's
|
||||||
// __asm__ attribute.
|
// __asm__ attribute.
|
||||||
if (LinkageName[0] == 1)
|
if (LinkageName[0] == 1)
|
||||||
LinkageName = LinkageName.data() + 1;
|
LinkageName = LinkageName.substr(1);
|
||||||
addString(SPDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
|
addString(SPDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
|
||||||
LinkageName);
|
LinkageName);
|
||||||
}
|
}
|
||||||
@ -2899,7 +2899,7 @@ void DwarfDebug::emitDebugInlineInfo() {
|
|||||||
// Objective-C symbol names and symbol whose name is replaced using GCC's
|
// Objective-C symbol names and symbol whose name is replaced using GCC's
|
||||||
// __asm__ attribute.
|
// __asm__ attribute.
|
||||||
if (LName[0] == 1)
|
if (LName[0] == 1)
|
||||||
LName = LName.data() + 1;
|
LName = LName.substr(1);
|
||||||
// Asm->EmitString(LName);
|
// Asm->EmitString(LName);
|
||||||
EmitSectionOffset("string", "section_str",
|
EmitSectionOffset("string", "section_str",
|
||||||
StringPool.idFor(LName), false, true);
|
StringPool.idFor(LName), false, true);
|
||||||
|
@ -306,10 +306,9 @@ void PIC16DbgInfo::EmitCompositeTypeElements (DICompositeType CTy,
|
|||||||
int ElementAux[PIC16Dbg::AuxSize] = { 0 };
|
int ElementAux[PIC16Dbg::AuxSize] = { 0 };
|
||||||
std::string TagName = "";
|
std::string TagName = "";
|
||||||
DIDerivedType DITy(Element.getNode());
|
DIDerivedType DITy(Element.getNode());
|
||||||
StringRef ElementName = DITy.getName();
|
|
||||||
unsigned short ElementSize = DITy.getSizeInBits()/8;
|
unsigned short ElementSize = DITy.getSizeInBits()/8;
|
||||||
// Get mangleddd name for this structure/union element.
|
// 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);
|
PopulateDebugInfo(DITy, TypeNo, HasAux, ElementAux, TagName);
|
||||||
short Class = 0;
|
short Class = 0;
|
||||||
if( CTy.getTag() == dwarf::DW_TAG_union_type)
|
if( CTy.getTag() == dwarf::DW_TAG_union_type)
|
||||||
@ -337,12 +336,11 @@ void PIC16DbgInfo::EmitCompositeTypeDecls(Module &M) {
|
|||||||
continue;
|
continue;
|
||||||
if (CTy.getTag() == dwarf::DW_TAG_union_type ||
|
if (CTy.getTag() == dwarf::DW_TAG_union_type ||
|
||||||
CTy.getTag() == dwarf::DW_TAG_structure_type ) {
|
CTy.getTag() == dwarf::DW_TAG_structure_type ) {
|
||||||
StringRef Name = CTy.getName();
|
|
||||||
// Get the number after llvm.dbg.composite and make UniqueSuffix from
|
// Get the number after llvm.dbg.composite and make UniqueSuffix from
|
||||||
// it.
|
// it.
|
||||||
std::string DIVar = CTy.getNode()->getNameStr();
|
std::string DIVar = CTy.getNode()->getNameStr();
|
||||||
std::string UniqueSuffix = "." + DIVar.substr(18);
|
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;
|
unsigned short size = CTy.getSizeInBits()/8;
|
||||||
int Aux[PIC16Dbg::AuxSize] = {0};
|
int Aux[PIC16Dbg::AuxSize] = {0};
|
||||||
// 7th and 8th byte represent size of structure/union.
|
// 7th and 8th byte represent size of structure/union.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user