Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/tools/llvm-exegesis/lib/Assembler.cpp
Show First 20 Lines • Show All 246 Lines • ▼ Show 20 Lines | |||||
object::OwningBinary<object::ObjectFile> | object::OwningBinary<object::ObjectFile> | ||||
getObjectFromBuffer(StringRef InputData) { | getObjectFromBuffer(StringRef InputData) { | ||||
// Storing the generated assembly into a MemoryBuffer that owns the memory. | // Storing the generated assembly into a MemoryBuffer that owns the memory. | ||||
std::unique_ptr<MemoryBuffer> Buffer = | std::unique_ptr<MemoryBuffer> Buffer = | ||||
MemoryBuffer::getMemBufferCopy(InputData); | MemoryBuffer::getMemBufferCopy(InputData); | ||||
// Create the ObjectFile from the MemoryBuffer. | // Create the ObjectFile from the MemoryBuffer. | ||||
std::unique_ptr<object::ObjectFile> Obj = | std::unique_ptr<object::ObjectFile> Obj = | ||||
cantFail(object::ObjectFile::createObjectFile(Buffer->getMemBufferRef())); | llvm_cantFail(object::ObjectFile::createObjectFile(Buffer->getMemBufferRef())); | ||||
// Returning both the MemoryBuffer and the ObjectFile. | // Returning both the MemoryBuffer and the ObjectFile. | ||||
return object::OwningBinary<object::ObjectFile>(std::move(Obj), | return object::OwningBinary<object::ObjectFile>(std::move(Obj), | ||||
std::move(Buffer)); | std::move(Buffer)); | ||||
} | } | ||||
object::OwningBinary<object::ObjectFile> getObjectFromFile(StringRef Filename) { | object::OwningBinary<object::ObjectFile> getObjectFromFile(StringRef Filename) { | ||||
return cantFail(object::ObjectFile::createObjectFile(Filename)); | return llvm_cantFail(object::ObjectFile::createObjectFile(Filename)); | ||||
} | } | ||||
namespace { | namespace { | ||||
// Implementation of this class relies on the fact that a single object with a | // Implementation of this class relies on the fact that a single object with a | ||||
// single function will be loaded into memory. | // single function will be loaded into memory. | ||||
class TrackingSectionMemoryManager : public SectionMemoryManager { | class TrackingSectionMemoryManager : public SectionMemoryManager { | ||||
public: | public: | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |