[PATCH] D82033: [LTO] Use StringRef instead of C-style strings in setCodeGenDebugOptions
Momchil Velikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 22 03:43:47 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG75b0bbca1d0c: [LTO] Use StringRef instead of C-style strings in setCodeGenDebugOptions (authored by chill).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82033/new/
https://reviews.llvm.org/D82033
Files:
llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/tools/lto/lto.cpp
Index: llvm/tools/lto/lto.cpp
===================================================================
--- llvm/tools/lto/lto.cpp
+++ llvm/tools/lto/lto.cpp
@@ -474,17 +474,20 @@
}
void lto_codegen_debug_options(lto_code_gen_t cg, const char *opt) {
- std::vector<const char *> Options;
+ SmallVector<StringRef, 4> Options;
for (std::pair<StringRef, StringRef> o = getToken(opt); !o.first.empty();
o = getToken(o.second))
- Options.push_back(o.first.data());
+ Options.push_back(o.first);
unwrap(cg)->setCodeGenDebugOptions(Options);
}
void lto_codegen_debug_options_array(lto_code_gen_t cg,
const char *const *options, int number) {
- unwrap(cg)->setCodeGenDebugOptions(makeArrayRef(options, number));
+ SmallVector<StringRef, 4> Options;
+ for (int i = 0; i < number; ++i)
+ Options.push_back(options[i]);
+ unwrap(cg)->setCodeGenDebugOptions(makeArrayRef(Options));
}
unsigned int lto_api_version() { return LTO_API_VERSION; }
Index: llvm/lib/LTO/LTOCodeGenerator.cpp
===================================================================
--- llvm/lib/LTO/LTOCodeGenerator.cpp
+++ llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -632,9 +632,9 @@
return true;
}
-void LTOCodeGenerator::setCodeGenDebugOptions(ArrayRef<const char *> Options) {
+void LTOCodeGenerator::setCodeGenDebugOptions(ArrayRef<StringRef> Options) {
for (StringRef Option : Options)
- CodegenOptions.push_back(std::string(Option));
+ CodegenOptions.push_back(Option.str());
}
void LTOCodeGenerator::parseCodeGenDebugOptions() {
Index: llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h
===================================================================
--- llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h
+++ llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h
@@ -123,7 +123,7 @@
/// name is misleading). This function should be called before
/// LTOCodeGenerator::compilexxx(), and
/// LTOCodeGenerator::writeMergedModules().
- void setCodeGenDebugOptions(ArrayRef<const char *> Opts);
+ void setCodeGenDebugOptions(ArrayRef<StringRef> Opts);
/// Parse the options set in setCodeGenDebugOptions.
///
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82033.272372.patch
Type: text/x-patch
Size: 2170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200622/86ab6086/attachment-0001.bin>
More information about the llvm-commits
mailing list