Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp2rust/converter/converter_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ clang::QualType GetReturnTypeOfFunction(const clang::CallExpr *expr) {
return {};
}

std::string GetOverloadedOperator(const clang::FunctionDecl *decl) {
const char *GetOverloadedOperator(const clang::FunctionDecl *decl) {
switch (decl->getOverloadedOperator()) {
case clang::OO_Less:
return "lt";
Expand Down
2 changes: 1 addition & 1 deletion cpp2rust/converter/converter_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ template <class T> llvm::SmallString<16> GetNumAsString(const T &num) {

clang::QualType GetReturnTypeOfFunction(const clang::CallExpr *expr);

std::string GetOverloadedOperator(const clang::FunctionDecl *decl);
const char *GetOverloadedOperator(const clang::FunctionDecl *decl);

bool IsOverloadedComparisonOperator(const clang::CXXMethodDecl *decl);

Expand Down
9 changes: 5 additions & 4 deletions cpp2rust/converter/mapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ Map::const_iterator parallel_search(const Map &container,

decltype(exprs_)::const_iterator search(const clang::Expr *expr) {
auto qualified_name = ToString(expr);
auto result = parallel_search(exprs_, [&](std::string tpl) {
auto result = parallel_search(exprs_, [&](const std::string &tpl) {
return matchTemplate(tpl, qualified_name);
});
llvm::errs() << "search expr " << qualified_name << ", result:\n";
Expand All @@ -382,7 +382,7 @@ decltype(exprs_)::const_iterator search(const clang::Expr *expr) {
decltype(types_)::const_iterator search(clang::QualType qual_type) {
auto type = ToString(qual_type);
auto result = parallel_search(
types_, [&](std::string tpl) { return matchTemplate(tpl, type); });
types_, [&](const std::string &tpl) { return matchTemplate(tpl, type); });
llvm::errs() << "search type " << type << ", result: "
<< ((result == types_.end()) ? "None"
: result->second.type_info.type)
Expand Down Expand Up @@ -531,8 +531,9 @@ clang::QualType normalizeQualType(clang::QualType qual_type) {
}

std::string mapTypeStringRecursive(const std::string &cpp_type) {
auto rule = parallel_search(
types_, [&](std::string tpl) { return matchTemplate(tpl, cpp_type); });
auto rule = parallel_search(types_, [&](const std::string &tpl) {
return matchTemplate(tpl, cpp_type);
});
if (rule == types_.end()) {
llvm::errs() << "cpp_type: " << cpp_type << '\n';
assert(0 && "Type is not present in types_");
Expand Down
2 changes: 1 addition & 1 deletion cpp2rust/converter/models/converter_refcount.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class ConverterRefCount final : public Converter {
FullRefCount,
};

std::string ConversionKindToString(ConversionKind k) {
const char *ConversionKindToString(ConversionKind k) {
switch (k) {
case ConversionKind::Unboxed:
return "Unboxed";
Expand Down
Loading