[llvm] r282998 - Use StringRef in LTOCodegenerator (NFC)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 18:18:24 PDT 2016


Author: mehdi_amini
Date: Fri Sep 30 20:18:23 2016
New Revision: 282998

URL: http://llvm.org/viewvc/llvm-project?rev=282998&view=rev
Log:
Use StringRef in LTOCodegenerator (NFC)

Modified:
    llvm/trunk/include/llvm/LTO/legacy/LTOCodeGenerator.h
    llvm/trunk/lib/LTO/LTOCodeGenerator.cpp

Modified: llvm/trunk/include/llvm/LTO/legacy/LTOCodeGenerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LTO/legacy/LTOCodeGenerator.h?rev=282998&r1=282997&r2=282998&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LTO/legacy/LTOCodeGenerator.h (original)
+++ llvm/trunk/include/llvm/LTO/legacy/LTOCodeGenerator.h Fri Sep 30 20:18:23 2016
@@ -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

Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=282998&r1=282997&r2=282998&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Fri Sep 30 20:18:23 2016
@@ -199,7 +199,7 @@ void LTOCodeGenerator::setOptLevel(unsig
   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::compileOptimizedT
   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::compileOptimizedT
   }
 
   // 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(
 
 /// 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<StringRef, StringRef> o = getToken(Options); !o.first.empty();
        o = getToken(o.second))
     CodegenOptions.push_back(o.first);




More information about the llvm-commits mailing list