/// 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; }
/// 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.
///
/// 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
llvm_unreachable("Unknown optimization level!");
}
-bool LTOCodeGenerator::writeMergedModules(const char *Path) {
+bool LTOCodeGenerator::writeMergedModules(StringRef Path) {
if (!determineTarget())
return false;
SmallString<128> Filename;
int FD;
- const char *Extension =
+ StringRef Extension
(FileType == TargetMachine::CGFT_AssemblyFile ? "s" : "o");
std::error_code EC =
}
// 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();
/// 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);