summaryrefslogtreecommitdiff
path: root/lib/LTO
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2014-02-10 23:26:14 +0000
committerManman Ren <manman.ren@gmail.com>2014-02-10 23:26:14 +0000
commitf3fc8c9d0953dbb275f00122afbe207ef7e76df4 (patch)
treeb1374660a820a6e15ff03115b06ef0f30679f5ca /lib/LTO
parent4822c5fa52bcc581ac54046b1f5f28be6159bb4e (diff)
downloadllvm-f3fc8c9d0953dbb275f00122afbe207ef7e76df4.tar.gz
llvm-f3fc8c9d0953dbb275f00122afbe207ef7e76df4.tar.bz2
llvm-f3fc8c9d0953dbb275f00122afbe207ef7e76df4.tar.xz
LTO API: add lto_module_create_from_memory_with_path.
This function adds an extra path argument to lto_module_create_from_memory. The path argument will be passed to makeBuffer to make sure the MemoryBuffer has a name and the created module has a module identifier. This is mainly for emitting warning messages from the linker. When we emit warning message on a module, we can use the module identifier. rdar://15985737 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201114 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/LTO')
-rw-r--r--lib/LTO/LTOModule.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/LTO/LTOModule.cpp b/lib/LTO/LTOModule.cpp
index 68b7313be7..909b92e888 100644
--- a/lib/LTO/LTOModule.cpp
+++ b/lib/LTO/LTOModule.cpp
@@ -128,8 +128,8 @@ LTOModule *LTOModule::makeLTOModule(int fd, const char *path,
LTOModule *LTOModule::makeLTOModule(const void *mem, size_t length,
TargetOptions options,
- std::string &errMsg) {
- OwningPtr<MemoryBuffer> buffer(makeBuffer(mem, length));
+ std::string &errMsg, StringRef path) {
+ OwningPtr<MemoryBuffer> buffer(makeBuffer(mem, length, path));
if (!buffer)
return NULL;
return makeLTOModule(buffer.take(), options, errMsg);
@@ -186,10 +186,11 @@ LTOModule *LTOModule::makeLTOModule(MemoryBuffer *buffer,
return Ret;
}
-/// makeBuffer - Create a MemoryBuffer from a memory range.
-MemoryBuffer *LTOModule::makeBuffer(const void *mem, size_t length) {
+/// Create a MemoryBuffer from a memory range with an optional name.
+MemoryBuffer *LTOModule::makeBuffer(const void *mem, size_t length,
+ StringRef name) {
const char *startPtr = (const char*)mem;
- return MemoryBuffer::getMemBuffer(StringRef(startPtr, length), "", false);
+ return MemoryBuffer::getMemBuffer(StringRef(startPtr, length), name, false);
}
/// objcClassNameFromExpression - Get string that the data pointer points to.