diff options
author | Alex Lorenz <arphaman@gmail.com> | 2016-11-10 16:19:11 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2016-11-10 16:19:11 +0000 |
commit | d60bb2830797460acc7d061d1f81eddf22d7b857 (patch) | |
tree | 3e563225d7ac41768cd976205804f49ad25a3f66 /clang/lib/Sema/SemaLambda.cpp | |
parent | 115a61560e24e08ecca0b3e2d16e8f1491b47f61 (diff) | |
download | bcm5719-llvm-d60bb2830797460acc7d061d1f81eddf22d7b857.tar.gz bcm5719-llvm-d60bb2830797460acc7d061d1f81eddf22d7b857.zip |
[Sema] Avoid -Wshadow warnings for shadowed variables that
aren't captured by lambdas with a default capture specifier
This commit is a follow-up to r286354. It avoids the -Wshadow warning for
variables which shadow variables that aren't captured by lambdas with a default
capture specifier. It provides an additional note that points to location of
the capture.
The old behaviour is preserved with -Wshadow-all or -Wshadow-uncaptured-local.
rdar://14984176
Differential Revision: https://reviews.llvm.org/D26448
llvm-svn: 286465
Diffstat (limited to 'clang/lib/Sema/SemaLambda.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLambda.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index 9be8fe51887..da4ba8b2a26 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -1620,6 +1620,9 @@ ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, CheckConstexprFunctionBody(CallOperator, CallOperator->getBody())); } + // Emit delayed shadowing warnings now that the full capture list is known. + DiagnoseShadowingLambdaDecls(LSI); + if (!CurContext->isDependentContext()) { switch (ExprEvalContexts.back().Context) { // C++11 [expr.prim.lambda]p2: |