Skip to content

Commit

Permalink
Fixed lambda showing destructor if one is present.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasfertig committed Feb 13, 2024
1 parent 718afc5 commit 03c64dd
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3329,7 +3329,7 @@ void CodeGenerator::InsertArg(const CXXRecordDecl* stmt)
// mOutputFormatHelper.AppendNewLine();
}

if((stmt->isLambda() and isa<CXXDestructorDecl>(d))) {
if((stmt->isLambda() and isa<CXXDestructorDecl>(d)) and not d->isUsed()) {
continue;
}

Expand Down
1 change: 1 addition & 0 deletions tests/Issue258.expect
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ int main()
public:
// inline /*constexpr */ __lambda_7_19(const __lambda_7_19 &) /* noexcept */ = delete;
// inline __lambda_7_19 & operator=(const __lambda_7_19 &) /* noexcept */ = delete;
// inline ~__lambda_7_19() noexcept = default;
__lambda_7_19(std::unique_ptr<int, std::default_delete<int> > && _x)
: x{std::move(_x)}
{}
Expand Down
1 change: 1 addition & 0 deletions tests/Issue347.expect
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ int main()
std::basic_string<char, std::char_traits<char>, std::allocator<char> > str;
public:
// inline __lambda_5_12 & operator=(const __lambda_5_12 &) /* noexcept */ = delete;
// inline ~__lambda_5_12() noexcept = default;
__lambda_5_12(const std::basic_string<char, std::char_traits<char>, std::allocator<char> > & _str)
: str{_str}
{}
Expand Down
1 change: 1 addition & 0 deletions tests/Issue347_2.expect
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ int main()
const std::basic_string<char, std::char_traits<char>, std::allocator<char> > str;
public:
// inline __lambda_5_12 & operator=(const __lambda_5_12 &) /* noexcept */ = delete;
// inline ~__lambda_5_12() noexcept = default;
__lambda_5_12(const std::basic_string<char, std::char_traits<char>, std::allocator<char> > & _str)
: str{_str}
{}
Expand Down
2 changes: 1 addition & 1 deletion tests/Issue51.expect
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ int main()
using Map = std::map<int, bool>;
int m;

auto __7 = /* INSIGHTS-TODO: CodeGenerator.cpp:3850 stmt: RecoveryExpr */.insert({1, true});
auto __7 = /* INSIGHTS-TODO: CodeGenerator.cpp:3857 stmt: RecoveryExpr */.insert({1, true});

}
1 change: 1 addition & 0 deletions tests/Issue64.expect
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void func(const std::basic_string<char, std::char_traits<char>, std::allocator<c
const std::basic_string<char, std::char_traits<char>, std::allocator<char> > arg;
public:
// inline __lambda_5_11 & operator=(const __lambda_5_11 &) /* noexcept */ = delete;
// inline ~__lambda_5_11() noexcept = default;
__lambda_5_11(const std::basic_string<char, std::char_traits<char>, std::allocator<char> > & _arg)
: arg{_arg}
{}
Expand Down

0 comments on commit 03c64dd

Please sign in to comment.