Skip to content

Commit e1ad0cb

Browse files
committed
Don't call getcaptureField with dummy map
1 parent 893f631 commit e1ad0cb

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎cpp2rust/converter/converter_lib.cpp‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,11 +1102,12 @@ const clang::FieldDecl *AsLambdaCaptureThis(const clang::FunctionDecl *fn) {
11021102
if (!call) {
11031103
return nullptr;
11041104
}
1105-
llvm::DenseMap<const clang::ValueDecl *, clang::FieldDecl *> fields;
1106-
clang::FieldDecl *this_field = nullptr;
1107-
call->getParent()->getCaptureFields(fields, this_field);
1108-
assert(this_field && "this used in a lambda that does not capture it");
1109-
return this_field;
1105+
for (auto field : call->getParent()->fields()) {
1106+
if (AsLambdaCapture(field)->capturesThis()) {
1107+
return field;
1108+
}
1109+
}
1110+
return nullptr;
11101111
}
11111112

11121113
clang::QualType GetDeclRefType(const clang::FunctionDecl *fn,

0 commit comments

Comments
 (0)