diff --git a/include/llvm/LTO/LTOModule.h b/include/llvm/LTO/LTOModule.h index 2f1f3c2152a..509b84e7e80 100644 --- a/include/llvm/LTO/LTOModule.h +++ b/include/llvm/LTO/LTOModule.h @@ -101,13 +101,13 @@ public: StringRef path = ""); /// Return the Module's target triple. - const char *getTargetTriple() { - return _module->getTargetTriple().c_str(); + const std::string &getTargetTriple() { + return _module->getTargetTriple(); } /// Set the Module's target triple. - void setTargetTriple(const char *triple) { - _module->setTargetTriple(triple); + void setTargetTriple(StringRef Triple) { + _module->setTargetTriple(Triple); } /// Get the number of symbols diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index 8df7315ff79..b3f5938b00d 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -149,7 +149,7 @@ lto_module_t lto_module_create_from_memory_with_path(const void* mem, void lto_module_dispose(lto_module_t mod) { delete unwrap(mod); } const char* lto_module_get_target_triple(lto_module_t mod) { - return unwrap(mod)->getTargetTriple(); + return unwrap(mod)->getTargetTriple().c_str(); } void lto_module_set_target_triple(lto_module_t mod, const char *triple) {