mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
StringMap<DIE*>::iterator::first() returns a pointer to the first character of
the key. This will cause it to create a new std::string, which isn't wanted. Instead, pass back the "const char*". Modify the EmitString() method to take a "const char*". llvm-svn: 68741
This commit is contained in:
parent
500dc5157e
commit
62c4c8bc44
@ -285,7 +285,8 @@ namespace llvm {
|
||||
/// Special characters are emitted properly.
|
||||
/// @verbatim (Eg. '\t') @endverbatim
|
||||
void EmitString(const std::string &String) const;
|
||||
|
||||
void EmitString(const char *String, unsigned Size) const;
|
||||
|
||||
/// EmitFile - Emit a .file directive.
|
||||
void EmitFile(unsigned Number, const std::string &Name) const;
|
||||
|
||||
|
@ -727,13 +727,17 @@ static void printStringChar(raw_ostream &O, unsigned char C) {
|
||||
/// Special characters are emitted properly.
|
||||
/// \literal (Eg. '\t') \endliteral
|
||||
void AsmPrinter::EmitString(const std::string &String) const {
|
||||
EmitString(String.c_str(), String.size());
|
||||
}
|
||||
|
||||
void AsmPrinter::EmitString(const char *String, unsigned Size) const {
|
||||
const char* AscizDirective = TAI->getAscizDirective();
|
||||
if (AscizDirective)
|
||||
O << AscizDirective;
|
||||
else
|
||||
O << TAI->getAsciiDirective();
|
||||
O << '\"';
|
||||
for (unsigned i = 0, N = String.size(); i < N; ++i)
|
||||
for (unsigned i = 0; i < Size; ++i)
|
||||
printStringChar(O, String[i]);
|
||||
if (AscizDirective)
|
||||
O << '\"';
|
||||
|
@ -2664,13 +2664,13 @@ private:
|
||||
Asm->EOL("Compilation Unit Length");
|
||||
|
||||
StringMap<DIE*> &Globals = Unit->getGlobals();
|
||||
for (StringMap<DIE*>::iterator
|
||||
for (StringMap<DIE*>::const_iterator
|
||||
GI = Globals.begin(), GE = Globals.end(); GI != GE; ++GI) {
|
||||
const std::string &Name = GI->first();
|
||||
const char *Name = GI->getKeyData();
|
||||
DIE * Entity = GI->second;
|
||||
|
||||
Asm->EmitInt32(Entity->getOffset()); Asm->EOL("DIE offset");
|
||||
Asm->EmitString(Name); Asm->EOL("External Name");
|
||||
Asm->EmitString(Name, strlen(Name)); Asm->EOL("External Name");
|
||||
}
|
||||
|
||||
Asm->EmitInt32(0); Asm->EOL("End Mark");
|
||||
|
Loading…
Reference in New Issue
Block a user