Skip to content

Commit 192a6e7

Browse files
Copilotnunoplopes
andauthored
Use owning strings for transpile inputs and flags
Agent-Logs-Url: https://github.com/Cpp2Rust/cpp2rust/sessions/b35e24ce-b7f8-4f5a-97dd-80c8f5f18730 Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
1 parent 04e281f commit 192a6e7

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

cpp2rust/cpp2rust.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ int main(int argc, char *argv[]) {
140140
}
141141
}
142142

143-
std::vector<std::string_view> cxx_flags(CXXFlags.begin(), CXXFlags.end());
143+
std::vector<std::string> cxx_flags(CXXFlags.begin(), CXXFlags.end());
144144

145145
if (RulesDir.empty() && !ResolveRulesDir()) {
146146
llvm::errs() << "ERROR: rules directory not found. "

cpp2rust/cpp2rust_lib.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include "frontend_action.h"
1212

1313
namespace cpp2rust {
14-
std::string TranspileSrc(std::string_view cc_code, Model model,
15-
const std::vector<std::string_view> &cxx_flags,
14+
std::string TranspileSrc(const std::string &cc_code, Model model,
15+
const std::vector<std::string> &cxx_flags,
1616
const std::string &rules_dir) {
1717
auto tool_args = getPlatformClangFlags();
1818
tool_args.push_back("-fparse-all-comments");
@@ -25,7 +25,7 @@ std::string TranspileSrc(std::string_view cc_code, Model model,
2525
return rs_code;
2626
}
2727

28-
std::string TranspileDir(std::string_view build_dir, Model model,
28+
std::string TranspileDir(const std::string &build_dir, Model model,
2929
const std::string &rules_dir) {
3030
std::string error_message;
3131
auto compile_dbase = clang::tooling::CompilationDatabase::loadFromDirectory(

cpp2rust/cpp2rust_lib.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
namespace cpp2rust {
1212

13-
std::string TranspileSrc(std::string_view cc_code, Model model,
14-
const std::vector<std::string_view> &cxx_flags,
13+
std::string TranspileSrc(const std::string &cc_code, Model model,
14+
const std::vector<std::string> &cxx_flags,
1515
const std::string &rules_dir);
16-
std::string TranspileDir(std::string_view build_dir, Model model,
16+
std::string TranspileDir(const std::string &build_dir, Model model,
1717
const std::string &rules_dir);
1818

1919
} // namespace cpp2rust

0 commit comments

Comments
 (0)