Skip to content

Commit 3688b37

Browse files
committed
Fix name of static
1 parent 28b17ef commit 3688b37

5 files changed

Lines changed: 10 additions & 12 deletions

File tree

‎cpp2rust/converter/converter.cpp‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2994,9 +2994,7 @@ std::string Converter::ConvertDeclRefExpr(clang::DeclRefExpr *expr) {
29942994
if (auto *function = decl->getAsFunction()) {
29952995
if (auto method = clang::dyn_cast<clang::CXXMethodDecl>(function)) {
29962996
if (IsStaticMethod(method)) {
2997-
//return GetFunctionRefName(method);
2998-
return std::format("{}::{}", GetRecordName(method->getParent()),
2999-
GetNamedDeclAsString(method));
2997+
return GetFunctionRefName(method);
30002998
}
30012999
}
30023000
return GetNamedDeclAsString(function->getCanonicalDecl());

‎cpp2rust/converter/converter_lib.cpp‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,7 @@ bool IsPassThroughConstructor(const clang::CXXConstructorDecl *ctor) {
427427
bool IsConvertibleCXXRecordDecl(const clang::CXXRecordDecl *decl) {
428428
if (decl->isLambda()) {
429429
// The call operator of a generic lambda is a template pattern
430-
return decl->isGenericLambda() ||
431-
decl->getLambdaCallOperator()->hasBody();
430+
return decl->isGenericLambda() || decl->getLambdaCallOperator()->hasBody();
432431
}
433432
return decl->isThisDeclarationADefinition() && !decl->isDependentContext();
434433
}
@@ -1105,10 +1104,9 @@ bool LambdaCallOperatorIsDeducible(const clang::CXXMethodDecl *op) {
11051104
if (tmpl == nullptr) {
11061105
return true;
11071106
}
1108-
return llvm::any_of(tmpl->getTemplatedDecl()->parameters(),
1109-
[](const auto *param) {
1110-
return param->getType()->isDependentType();
1111-
});
1107+
return llvm::any_of(
1108+
tmpl->getTemplatedDecl()->parameters(),
1109+
[](const auto *param) { return param->getType()->isDependentType(); });
11121110
}
11131111

11141112
std::vector<clang::CXXMethodDecl *>

‎tests/unit/lambda_generic_explicit_args.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ static int sum(Val a, Val b) { return a.x + b.x; }
88

99
int main() {
1010
int total = 0;
11-
auto tally = [&total]<typename T, typename U> { total += sizeof(T) + sizeof(U); };
11+
auto tally = [&total]<typename T, typename U> {
12+
total += sizeof(T) + sizeof(U);
13+
};
1214
tally.operator()<char, char>();
1315
tally.operator()<int, char>();
1416
assert(total == 7);

‎tests/unit/out/refcount/fn_ptr_struct.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn main_0() -> i32 {
8181
Rc::new(RefCell::new(FnPtr::<fn(i32) -> i32>::new(S::solo)));
8282
assert!((({ (*p1.borrow()).call(5,) }) == 6));
8383
assert!((({ (*p2.borrow()).call(5,) }) == 8));
84-
assert!((({ S::pick(5_i64,) }) == 7));
84+
assert!((({ S::pick_i64(5_i64,) }) == 7));
8585
let h3: Value<Handler> = Rc::new(RefCell::new(Handler {
8686
tag: Rc::new(RefCell::new(3)),
8787
cb: Rc::new(RefCell::new((FnPtr::<fn(i32) -> i32>::new(S::pick_i32)))),

‎tests/unit/out/unsafe/fn_ptr_struct.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ unsafe fn main_0() -> i32 {
5151
let mut p2: Option<unsafe fn(i32) -> i32> = Some(S::solo);
5252
assert!(((unsafe { (p1).unwrap()(5,) }) == (6)));
5353
assert!(((unsafe { (p2).unwrap()(5,) }) == (8)));
54-
assert!(((unsafe { S::pick(5_i64,) }) == (7)));
54+
assert!(((unsafe { S::pick_i64(5_i64,) }) == (7)));
5555
let mut h3: Handler = Handler {
5656
tag: 3,
5757
cb: (Some(S::pick_i32)),

0 commit comments

Comments
 (0)