Index: include/llvm/LTO/LTOModule.h =================================================================== --- include/llvm/LTO/LTOModule.h +++ include/llvm/LTO/LTOModule.h @@ -86,16 +86,18 @@ /// InitializeAllTargetMCs(); /// InitializeAllAsmPrinters(); /// InitializeAllAsmParsers(); - static LTOModule *makeLTOModule(const char *path, TargetOptions options, - std::string &errMsg); - static LTOModule *makeLTOModule(int fd, const char *path, size_t size, - TargetOptions options, std::string &errMsg); - static LTOModule *makeLTOModule(int fd, const char *path, size_t map_size, - off_t offset, TargetOptions options, - std::string &errMsg); - static LTOModule *makeLTOModule(const void *mem, size_t length, - TargetOptions options, std::string &errMsg, - StringRef path = ""); + static LTOModule *createFromFile(const char *path, TargetOptions options, + std::string &errMsg); + static LTOModule *createFromOpenFile(int fd, const char *path, size_t size, + TargetOptions options, + std::string &errMsg); + static LTOModule *createFromOpenFileSlice(int fd, const char *path, + size_t map_size, off_t offset, + TargetOptions options, + std::string &errMsg); + static LTOModule *createFromBuffer(const void *mem, size_t length, + TargetOptions options, std::string &errMsg, + StringRef path = ""); /// Return the Module's target triple. const char *getTargetTriple() { Index: lib/LTO/LTOModule.cpp =================================================================== --- lib/LTO/LTOModule.cpp +++ lib/LTO/LTOModule.cpp @@ -95,8 +95,8 @@ /// makeLTOModule - Create an LTOModule. N.B. These methods take ownership of /// the buffer. -LTOModule *LTOModule::makeLTOModule(const char *path, TargetOptions options, - std::string &errMsg) { +LTOModule *LTOModule::createFromFile(const char *path, TargetOptions options, + std::string &errMsg) { std::unique_ptr buffer; if (std::error_code ec = MemoryBuffer::getFile(path, buffer)) { errMsg = ec.message(); @@ -105,17 +105,16 @@ return makeLTOModule(buffer.release(), options, errMsg); } -LTOModule *LTOModule::makeLTOModule(int fd, const char *path, - size_t size, TargetOptions options, - std::string &errMsg) { - return makeLTOModule(fd, path, size, 0, options, errMsg); +LTOModule *LTOModule::createFromOpenFile(int fd, const char *path, size_t size, + TargetOptions options, + std::string &errMsg) { + return createFromOpenFileSlice(fd, path, size, 0, options, errMsg); } -LTOModule *LTOModule::makeLTOModule(int fd, const char *path, - size_t map_size, - off_t offset, - TargetOptions options, - std::string &errMsg) { +LTOModule *LTOModule::createFromOpenFileSlice(int fd, const char *path, + size_t map_size, off_t offset, + TargetOptions options, + std::string &errMsg) { std::unique_ptr buffer; if (std::error_code ec = MemoryBuffer::getOpenFileSlice(fd, path, buffer, map_size, offset)) { @@ -125,9 +124,9 @@ return makeLTOModule(buffer.release(), options, errMsg); } -LTOModule *LTOModule::makeLTOModule(const void *mem, size_t length, - TargetOptions options, - std::string &errMsg, StringRef path) { +LTOModule *LTOModule::createFromBuffer(const void *mem, size_t length, + TargetOptions options, + std::string &errMsg, StringRef path) { std::unique_ptr buffer(makeBuffer(mem, length, path)); if (!buffer) return nullptr; Index: tools/gold/gold-plugin.cpp =================================================================== --- tools/gold/gold-plugin.cpp +++ tools/gold/gold-plugin.cpp @@ -292,7 +292,7 @@ return LDPS_OK; std::string Error; - M = LTOModule::makeLTOModule(view, file->filesize, TargetOpts, Error); + M = LTOModule::createFromBuffer(view, file->filesize, TargetOpts, Error); if (!M) { (*message)(LDPL_ERROR, "LLVM gold plugin has failed to create LTO module: %s", Index: tools/llvm-lto/llvm-lto.cpp =================================================================== --- tools/llvm-lto/llvm-lto.cpp +++ tools/llvm-lto/llvm-lto.cpp @@ -110,7 +110,7 @@ for (unsigned i = BaseArg; i < InputFilenames.size(); ++i) { std::string error; std::unique_ptr Module( - LTOModule::makeLTOModule(InputFilenames[i].c_str(), Options, error)); + LTOModule::createFromFile(InputFilenames[i].c_str(), Options, error)); if (!error.empty()) { errs() << argv[0] << ": error loading file '" << InputFilenames[i] << "': " << error << "\n"; Index: tools/lto/lto.cpp =================================================================== --- tools/lto/lto.cpp +++ tools/lto/lto.cpp @@ -104,14 +104,14 @@ lto_module_t lto_module_create(const char* path) { lto_initialize(); llvm::TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); - return wrap(LTOModule::makeLTOModule(path, Options, sLastErrorString)); + return wrap(LTOModule::createFromFile(path, Options, sLastErrorString)); } lto_module_t lto_module_create_from_fd(int fd, const char *path, size_t size) { lto_initialize(); llvm::TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); return wrap( - LTOModule::makeLTOModule(fd, path, size, Options, sLastErrorString)); + LTOModule::createFromOpenFile(fd, path, size, Options, sLastErrorString)); } lto_module_t lto_module_create_from_fd_at_offset(int fd, const char *path, @@ -120,14 +120,14 @@ off_t offset) { lto_initialize(); llvm::TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); - return wrap(LTOModule::makeLTOModule(fd, path, map_size, offset, Options, - sLastErrorString)); + return wrap(LTOModule::createFromOpenFileSlice(fd, path, map_size, offset, + Options, sLastErrorString)); } lto_module_t lto_module_create_from_memory(const void* mem, size_t length) { lto_initialize(); llvm::TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); - return wrap(LTOModule::makeLTOModule(mem, length, Options, sLastErrorString)); + return wrap(LTOModule::createFromBuffer(mem, length, Options, sLastErrorString)); } lto_module_t lto_module_create_from_memory_with_path(const void* mem, @@ -136,7 +136,7 @@ lto_initialize(); llvm::TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); return wrap( - LTOModule::makeLTOModule(mem, length, Options, sLastErrorString, path)); + LTOModule::createFromBuffer(mem, length, Options, sLastErrorString, path)); } void lto_module_dispose(lto_module_t mod) { delete unwrap(mod); }