mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-12 06:06:19 +00:00
Fix PR#193.
Modified ReadArchiveBuffer() so that it dynamically allocates the std::string object used to hold the bytecode object file's name. This is necessary because it is passed by reference to the new Module that is allocated to represent the bytecode object, and previously we were using a std::string that disappeared on function exit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10565 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3e58e48d20
commit
1118d0fd94
@ -122,8 +122,17 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
||||
while (endp[-1] == ' ')
|
||||
--endp;
|
||||
}
|
||||
|
||||
//
|
||||
// We now have the beginning and the end of the object name.
|
||||
// Convert this into a dynamically allocated std::string to pass
|
||||
// to the routines that create the Module object. We do this
|
||||
// (I think) because the created Module object will outlive this function,
|
||||
// but statically declared std::string's won't.
|
||||
//
|
||||
std::string MemberName (startp, endp);
|
||||
std::string FullMemberName = ArchiveName + "(" + MemberName + ")";
|
||||
std::string * FullMemberName;
|
||||
FullMemberName = new std::string (ArchiveName + "(" + MemberName + ")");
|
||||
|
||||
switch (getObjectType(Hdr, MemberData, MemberSize)) {
|
||||
case SVR4LongFilename:
|
||||
@ -133,7 +142,7 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
||||
break;
|
||||
case UserObject: {
|
||||
Module *M = ParseBytecodeBuffer(MemberData, MemberSize,
|
||||
FullMemberName, ErrorStr);
|
||||
*(FullMemberName), ErrorStr);
|
||||
if (!M) return true;
|
||||
Objects.push_back(M);
|
||||
break;
|
||||
@ -144,7 +153,7 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
||||
break;
|
||||
default:
|
||||
std::cerr << "ReadArchiveBuffer: WARNING: Skipping unknown file: "
|
||||
<< FullMemberName << "\n";
|
||||
<< *(FullMemberName) << "\n";
|
||||
break; // Just ignore unknown files.
|
||||
}
|
||||
|
||||
|
@ -122,8 +122,17 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
||||
while (endp[-1] == ' ')
|
||||
--endp;
|
||||
}
|
||||
|
||||
//
|
||||
// We now have the beginning and the end of the object name.
|
||||
// Convert this into a dynamically allocated std::string to pass
|
||||
// to the routines that create the Module object. We do this
|
||||
// (I think) because the created Module object will outlive this function,
|
||||
// but statically declared std::string's won't.
|
||||
//
|
||||
std::string MemberName (startp, endp);
|
||||
std::string FullMemberName = ArchiveName + "(" + MemberName + ")";
|
||||
std::string * FullMemberName;
|
||||
FullMemberName = new std::string (ArchiveName + "(" + MemberName + ")");
|
||||
|
||||
switch (getObjectType(Hdr, MemberData, MemberSize)) {
|
||||
case SVR4LongFilename:
|
||||
@ -133,7 +142,7 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
||||
break;
|
||||
case UserObject: {
|
||||
Module *M = ParseBytecodeBuffer(MemberData, MemberSize,
|
||||
FullMemberName, ErrorStr);
|
||||
*(FullMemberName), ErrorStr);
|
||||
if (!M) return true;
|
||||
Objects.push_back(M);
|
||||
break;
|
||||
@ -144,7 +153,7 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
||||
break;
|
||||
default:
|
||||
std::cerr << "ReadArchiveBuffer: WARNING: Skipping unknown file: "
|
||||
<< FullMemberName << "\n";
|
||||
<< *(FullMemberName) << "\n";
|
||||
break; // Just ignore unknown files.
|
||||
}
|
||||
|
||||
|
@ -122,8 +122,17 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
||||
while (endp[-1] == ' ')
|
||||
--endp;
|
||||
}
|
||||
|
||||
//
|
||||
// We now have the beginning and the end of the object name.
|
||||
// Convert this into a dynamically allocated std::string to pass
|
||||
// to the routines that create the Module object. We do this
|
||||
// (I think) because the created Module object will outlive this function,
|
||||
// but statically declared std::string's won't.
|
||||
//
|
||||
std::string MemberName (startp, endp);
|
||||
std::string FullMemberName = ArchiveName + "(" + MemberName + ")";
|
||||
std::string * FullMemberName;
|
||||
FullMemberName = new std::string (ArchiveName + "(" + MemberName + ")");
|
||||
|
||||
switch (getObjectType(Hdr, MemberData, MemberSize)) {
|
||||
case SVR4LongFilename:
|
||||
@ -133,7 +142,7 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
||||
break;
|
||||
case UserObject: {
|
||||
Module *M = ParseBytecodeBuffer(MemberData, MemberSize,
|
||||
FullMemberName, ErrorStr);
|
||||
*(FullMemberName), ErrorStr);
|
||||
if (!M) return true;
|
||||
Objects.push_back(M);
|
||||
break;
|
||||
@ -144,7 +153,7 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
||||
break;
|
||||
default:
|
||||
std::cerr << "ReadArchiveBuffer: WARNING: Skipping unknown file: "
|
||||
<< FullMemberName << "\n";
|
||||
<< *(FullMemberName) << "\n";
|
||||
break; // Just ignore unknown files.
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user