[PATCH] D24639: [Sema] Warn when returning a lambda that captures a local variable by reference

2019-04-03 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment. In D24639#1453795 , @bgianfo wrote: > Is there a reason why this was never merged? > Has the functionality been folded in in some other revision? > > I saw a bug recently which would have been caught by exactly this,

[PATCH] D24639: [Sema] Warn when returning a lambda that captures a local variable by reference

2019-04-03 Thread Brian Gianforcaro via Phabricator via cfe-commits
bgianfo added a comment. Herald added subscribers: dexonsmith, jkorous. Is there a reason why this was never merged? Has the functionality been folded in in some other revision? I saw a bug recently where this warning would have been great. How can we get this merged? CHANGES SINCE LAST ACTION

[PATCH] D24639: [Sema] Warn when returning a lambda that captures a local variable by reference

2016-12-20 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment. Ping! https://reviews.llvm.org/D24639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D24639: [Sema] Warn when returning a lambda that captures a local variable by reference

2016-12-01 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment. Ping! https://reviews.llvm.org/D24639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D24639: [Sema] Warn when returning a lambda that captures a local variable by reference

2016-11-23 Thread Erik Pilkington via cfe-commits
erik.pilkington added a comment. Ping! https://reviews.llvm.org/D24639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D24639: [Sema] Warn when returning a lambda that captures a local variable by reference

2016-11-12 Thread Erik Pilkington via cfe-commits
erik.pilkington added inline comments. Comment at: test/SemaCXX/cxx1y-generic-lambdas-capturing.cpp:185 f(y, d); - f(z, d); + f(z, d); // expected-warning {{address of stack memory associated with local variable 'z' returned}} decltype(a)

[PATCH] D24639: [Sema] Warn when returning a lambda that captures a local variable by reference

2016-11-12 Thread Erik Pilkington via cfe-commits
erik.pilkington updated this revision to Diff 77717. erik.pilkington added a comment. This new patch rewrites the check to just use the captures in the lambda's CXXRecordDecl, instead of searching through the returned expression to find the LambdaExpr. Thanks! https://reviews.llvm.org/D24639

Re: [PATCH] D24639: [Sema] Warn when returning a lambda that captures a local variable by reference

2016-09-16 Thread Alexey Bataev via cfe-commits
ABataev added a subscriber: ABataev. Comment at: lib/Sema/SemaChecking.cpp:6588 @@ -6587,2 +6587,3 @@ stackE = EvalAddr(RetValExp, refVars, /*ParentDecl=*/nullptr); + } else if (lhsType->isReferenceType()) { Remove empty line Comment at:

Re: [PATCH] D24639: [Sema] Warn when returning a lambda that captures a local variable by reference

2016-09-15 Thread Richard Smith via cfe-commits
rsmith added a comment. > But not here, because we would have to verify that the pointer in lam wasn't > mutated in a previous call of the lambda: Isn't that guaranteed, because the lambda is not marked `mutable`? Comment at: lib/Sema/SemaChecking.cpp:6594 @@ -6590,1 +6593,3

[PATCH] D24639: [Sema] Warn when returning a lambda that captures a local variable by reference

2016-09-15 Thread Erik Pilkington via cfe-commits
erik.pilkington created this revision. erik.pilkington added reviewers: faisalv, rsmith. erik.pilkington added a subscriber: cfe-commits. Previously, clang emitted no diagnostic for the following: ``` auto f() { int loc; return [&] { return loc; }; } ``` The problem being that this returns a