r235981 - Silencing a spurious -Wuninitialized warning with this local; NFC.

David Blaikie dblaikie at gmail.com
Tue Apr 28 09:22:56 PDT 2015


On Tue, Apr 28, 2015 at 5:36 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> Author: aaronballman
> Date: Tue Apr 28 07:36:54 2015
> New Revision: 235981
>
> URL: http://llvm.org/viewvc/llvm-project?rev=235981&view=rev
> Log:
> Silencing a spurious -Wuninitialized warning with this local; NFC.

Which compiler warned on this?

It looks like this initialization is not needed - the switch over
ImpCaptureStyle (speaking of which, the declaration of this variable
could be moved down to closer to this switch - it isn't used before
the switch) seems to initialize the variable on all paths that are
reachable.

(the usual "excessive initialization hampers checkers like msan and
doesn't make the code better because the default value is never
intended to be used - so the program's already off the rails if it's
used")

>
> Modified:
>     cfe/trunk/lib/Sema/SemaLambda.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaLambda.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=235981&r1=235980&r2=235981&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaLambda.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaLambda.cpp Tue Apr 28 07:36:54 2015
> @@ -1482,7 +1482,7 @@ ExprResult Sema::BuildLambdaExpr(SourceL
>    // Collect information from the lambda scope.
>    SmallVector<LambdaCapture, 4> Captures;
>    SmallVector<Expr *, 4> CaptureInits;
> -  LambdaCaptureDefault CaptureDefault;
> +  LambdaCaptureDefault CaptureDefault = LCD_None;
>    SourceLocation CaptureDefaultLoc;
>    CXXRecordDecl *Class;
>    CXXMethodDecl *CallOperator;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list