This revision was automatically updated to reflect the committed changes.
Closed by commit rL305315: Fix spurious Wunused-lambda-capture warning
(authored by kongyi).
Changed prior to commit:
https://reviews.llvm.org/D33526?vs=102099&id=102371#toc
Repository:
rL LLVM
https://reviews.llvm.or
malcolm.parsons accepted this revision.
malcolm.parsons added a comment.
This revision is now accepted and ready to land.
LGTM!
Repository:
rL LLVM
https://reviews.llvm.org/D33526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lis
kongyi added a comment.
For normal captures, variables are safe to eliminate if they are non-ODR used
or totally unused. However for init captures, non-ODR usage still depends on
the capture; they are only safe to eliminate if totally unused.
Repository:
rL LLVM
https://reviews.llvm.org/D33
malcolm.parsons added a comment.
I don't understand why init captures have this problem.
The variable is defined within the context of the lambda, but it's not within
the context of the templated method.
Are you working around a bug somewhere else?
Repository:
rL LLVM
https://reviews.llvm.or
kongyi updated this revision to Diff 102099.
Repository:
rL LLVM
https://reviews.llvm.org/D33526
Files:
lib/Sema/SemaLambda.cpp
test/SemaCXX/warn-unused-lambda-capture.cpp
Index: test/SemaCXX/warn-unused-lambda-capture.cpp
=
malcolm.parsons added inline comments.
Comment at: lib/Sema/SemaLambda.cpp:1525-1526
+ if (!CurContext->isDependentContext() && !IsImplicit)
+if ((IsGenericLambda && !From.isNonODRUsed()) ||
+(!IsGenericLambda && !From.isODRUsed()))
+ DiagnoseUnu
ahatanak added inline comments.
Comment at: lib/Sema/SemaLambda.cpp:1524-1526
+ if (!CurContext->isDependentContext() && !IsImplicit)
+if ((IsGenericLambda && !From.isNonODRUsed()) ||
+(!IsGenericLambda && !From.isODRUsed()))
kongyi wrote
kongyi added inline comments.
Comment at: lib/Sema/SemaLambda.cpp:1524-1526
+ if (!CurContext->isDependentContext() && !IsImplicit)
+if ((IsGenericLambda && !From.isNonODRUsed()) ||
+(!IsGenericLambda && !From.isODRUsed()))
malcolm.parson