From d309b57e6ef32cdc3e9ffc83ba79723af711f772 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Sat, 1 Oct 2016 01:18:23 +0000 Subject: [PATCH] Use StringRef in LTOCodegenerator (NFC) llvm-svn: 282998 --- include/llvm/LTO/legacy/LTOCodeGenerator.h | 8 ++++---- lib/LTO/LTOCodeGenerator.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/llvm/LTO/legacy/LTOCodeGenerator.h b/include/llvm/LTO/legacy/LTOCodeGenerator.h index a1bce8a3293..bbd671eb818 100644 --- a/include/llvm/LTO/legacy/LTOCodeGenerator.h +++ b/include/llvm/LTO/legacy/LTOCodeGenerator.h @@ -86,8 +86,8 @@ struct LTOCodeGenerator { /// The default is TargetMachine::CGFT_ObjectFile. void setFileType(TargetMachine::CodeGenFileType FT) { FileType = FT; } - void setCpu(const char *MCpu) { this->MCpu = MCpu; } - void setAttr(const char *MAttr) { this->MAttr = MAttr; } + void setCpu(StringRef MCpu) { this->MCpu = MCpu; } + void setAttr(StringRef MAttr) { this->MAttr = MAttr; } void setOptLevel(unsigned OptLevel); void setShouldInternalize(bool Value) { ShouldInternalize = Value; } @@ -117,7 +117,7 @@ struct LTOCodeGenerator { /// name is misleading). This function should be called before /// LTOCodeGenerator::compilexxx(), and /// LTOCodeGenerator::writeMergedModules(). - void setCodeGenDebugOptions(const char *Opts); + void setCodeGenDebugOptions(StringRef Opts); /// Parse the options set in setCodeGenDebugOptions. /// @@ -130,7 +130,7 @@ struct LTOCodeGenerator { /// true on success. /// /// Calls \a verifyMergedModuleOnce(). - bool writeMergedModules(const char *Path); + bool writeMergedModules(StringRef Path); /// Compile the merged module into a *single* output file; the path to output /// file is returned to the caller via argument "name". Return true on diff --git a/lib/LTO/LTOCodeGenerator.cpp b/lib/LTO/LTOCodeGenerator.cpp index 6dabdf110ac..81fb58a4e0a 100644 --- a/lib/LTO/LTOCodeGenerator.cpp +++ b/lib/LTO/LTOCodeGenerator.cpp @@ -199,7 +199,7 @@ void LTOCodeGenerator::setOptLevel(unsigned Level) { llvm_unreachable("Unknown optimization level!"); } -bool LTOCodeGenerator::writeMergedModules(const char *Path) { +bool LTOCodeGenerator::writeMergedModules(StringRef Path) { if (!determineTarget()) return false; @@ -240,7 +240,7 @@ bool LTOCodeGenerator::compileOptimizedToFile(const char **Name) { SmallString<128> Filename; int FD; - const char *Extension = + StringRef Extension (FileType == TargetMachine::CGFT_AssemblyFile ? "s" : "o"); std::error_code EC = @@ -251,7 +251,7 @@ bool LTOCodeGenerator::compileOptimizedToFile(const char **Name) { } // generate object file - tool_output_file objFile(Filename.c_str(), FD); + tool_output_file objFile(Filename, FD); bool genResult = compileOptimized(&objFile.os()); objFile.os().close(); @@ -586,7 +586,7 @@ bool LTOCodeGenerator::compileOptimized(ArrayRef Out) { /// setCodeGenDebugOptions - Set codegen debugging options to aid in debugging /// LTO problems. -void LTOCodeGenerator::setCodeGenDebugOptions(const char *Options) { +void LTOCodeGenerator::setCodeGenDebugOptions(StringRef Options) { for (std::pair o = getToken(Options); !o.first.empty(); o = getToken(o.second)) CodegenOptions.push_back(o.first);