git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101783
91177308-0d34-0410-b5e6-
96231b3b80d8
/// into memory, the return value will be null.
/// @returns a pointer to the member's data.
/// @brief Get the data content of the archive member
/// into memory, the return value will be null.
/// @returns a pointer to the member's data.
/// @brief Get the data content of the archive member
- const void* getData() const { return data; }
+ const char* getData() const { return data; }
/// This method determines if the member is a regular compressed file.
/// @returns true iff the archive member is a compressed regular file.
/// This method determines if the member is a regular compressed file.
/// @returns true iff the archive member is a compressed regular file.
sys::PathWithStatus path; ///< Path of file containing the member
sys::FileStatus info; ///< Status info (size,mode,date)
unsigned flags; ///< Flags about the archive member
sys::PathWithStatus path; ///< Path of file containing the member
sys::FileStatus info; ///< Status info (size,mode,date)
unsigned flags; ///< Flags about the archive member
- const void* data; ///< Data for the member
+ const char* data; ///< Data for the member
/// @}
/// @name Constructors
/// @}
/// @name Constructors
-llvm::GetBitcodeSymbols(const unsigned char *BufPtr, unsigned Length,
+llvm::GetBitcodeSymbols(const char *BufPtr, unsigned Length,
const std::string& ModuleID,
LLVMContext& Context,
std::vector<std::string>& symbols,
std::string* ErrMsg) {
// Get the module.
std::auto_ptr<MemoryBuffer> Buffer(
const std::string& ModuleID,
LLVMContext& Context,
std::vector<std::string>& symbols,
std::string* ErrMsg) {
// Get the module.
std::auto_ptr<MemoryBuffer> Buffer(
- MemoryBuffer::getNewMemBuffer(Length, ModuleID.c_str()));
- memcpy(const_cast<char *>(Buffer->getBufferStart()), BufPtr, Length);
+ MemoryBuffer::getMemBufferCopy(StringRef(BufPtr, Length),ModuleID.c_str()));
Module *M = ParseBitcodeFile(Buffer.get(), Context, ErrMsg);
if (!M)
Module *M = ParseBitcodeFile(Buffer.get(), Context, ErrMsg);
if (!M)
std::vector<std::string>& symbols,
std::string* ErrMsg);
std::vector<std::string>& symbols,
std::string* ErrMsg);
- Module* GetBitcodeSymbols(const unsigned char*Buffer,unsigned Length,
+ Module* GetBitcodeSymbols(const char *Buffer, unsigned Length,
const std::string& ModuleID,
LLVMContext& Context,
std::vector<std::string>& symbols,
const std::string& ModuleID,
LLVMContext& Context,
std::vector<std::string>& symbols,
std::string FullMemberName = archPath.str() +
"(" + I->getPath().str() + ")";
MemoryBuffer *Buffer =
std::string FullMemberName = archPath.str() +
"(" + I->getPath().str() + ")";
MemoryBuffer *Buffer =
- MemoryBuffer::getNewMemBuffer(I->getSize(), FullMemberName.c_str());
- memcpy(const_cast<char *>(Buffer->getBufferStart()),
- I->getData(), I->getSize());
+ MemoryBuffer::getMemBufferCopy(StringRef(I->getData(), I->getSize()),
+ FullMemberName.c_str());
Module *M = ParseBitcodeFile(Buffer, Context, ErrMessage);
delete Buffer;
Module *M = ParseBitcodeFile(Buffer, Context, ErrMessage);
delete Buffer;
// Now, load the bitcode module to get the Module.
std::string FullMemberName = archPath.str() + "(" +
mbr->getPath().str() + ")";
// Now, load the bitcode module to get the Module.
std::string FullMemberName = archPath.str() + "(" +
mbr->getPath().str() + ")";
- MemoryBuffer *Buffer =MemoryBuffer::getNewMemBuffer(mbr->getSize(),
- FullMemberName.c_str());
- memcpy(const_cast<char *>(Buffer->getBufferStart()),
- mbr->getData(), mbr->getSize());
+ MemoryBuffer *Buffer =
+ MemoryBuffer::getMemBufferCopy(StringRef(mbr->getData(), mbr->getSize()),
+ FullMemberName.c_str());
Module *m = getLazyBitcodeModule(Buffer, Context, ErrMsg);
if (!m)
Module *m = getLazyBitcodeModule(Buffer, Context, ErrMsg);
if (!m)
std::string FullMemberName = archPath.str() + "(" +
mbr->getPath().str() + ")";
Module* M =
std::string FullMemberName = archPath.str() + "(" +
mbr->getPath().str() + ")";
Module* M =
- GetBitcodeSymbols((const unsigned char*)At, mbr->getSize(),
- FullMemberName, Context, symbols, error);
+ GetBitcodeSymbols(At, mbr->getSize(), FullMemberName, Context,
+ symbols, error);
if (M) {
// Insert the module's symbols into the symbol table
if (M) {
// Insert the module's symbols into the symbol table
archPath.str() + "(" + I->getPath().str() + ")";
MemoryBuffer *Buffer =
archPath.str() + "(" + I->getPath().str() + ")";
MemoryBuffer *Buffer =
- MemoryBuffer::getNewMemBuffer(I->getSize(), FullMemberName.c_str());
- memcpy(const_cast<char *>(Buffer->getBufferStart()),
- I->getData(), I->getSize());
+ MemoryBuffer::getMemBufferCopy(StringRef(I->getData(), I->getSize()),
+ FullMemberName.c_str());
Module *M = ParseBitcodeFile(Buffer, Context);
delete Buffer;
if (!M)
Module *M = ParseBitcodeFile(Buffer, Context);
delete Buffer;
if (!M)
std::string FullMemberName = archPath.str() + "(" + member.getPath().str()
+ ")";
Module* M =
std::string FullMemberName = archPath.str() + "(" + member.getPath().str()
+ ")";
Module* M =
- GetBitcodeSymbols((const unsigned char*)data,fSize,
- FullMemberName, Context, symbols, ErrMsg);
+ GetBitcodeSymbols(data, fSize, FullMemberName, Context, symbols, ErrMsg);
// If the bitcode parsed successfully
if ( M ) {
// If the bitcode parsed successfully
if ( M ) {