[llvm] a3c715e - Twine - fix uninitialized variable warnings. NFCI.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 15:34:36 PST 2019


Which compiler gave that warning and in what situation?

In some cases it's advantageous to leave variables uninitialized if they
aren't intended to be accessed before they're initialized by some other
action - that way tools like MSan & static analysis can diagnose programmer
errors where that initialization doesn't happen.

On Mon, Nov 11, 2019 at 8:39 AM Simon Pilgrim via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

>
> Author: Simon Pilgrim
> Date: 2019-11-10T11:21:43Z
> New Revision: a3c715e9788d829031989b0a5ea4eb43c7288be9
>
> URL:
> https://github.com/llvm/llvm-project/commit/a3c715e9788d829031989b0a5ea4eb43c7288be9
> DIFF:
> https://github.com/llvm/llvm-project/commit/a3c715e9788d829031989b0a5ea4eb43c7288be9.diff
>
> LOG: Twine - fix uninitialized variable warnings. NFCI.
>
> Added:
>
>
> Modified:
>     llvm/include/llvm/ADT/Twine.h
>
> Removed:
>
>
>
>
> ################################################################################
> diff  --git a/llvm/include/llvm/ADT/Twine.h b/llvm/include/llvm/ADT/Twine.h
> index 4140c22aad3d..2dc7486c924f 100644
> --- a/llvm/include/llvm/ADT/Twine.h
> +++ b/llvm/include/llvm/ADT/Twine.h
> @@ -153,11 +153,11 @@ namespace llvm {
>
>      /// LHS - The prefix in the concatenation, which may be uninitialized
> for
>      /// Null or Empty kinds.
> -    Child LHS;
> +    Child LHS = {0};
>
>      /// RHS - The suffix in the concatenation, which may be uninitialized
> for
>      /// Null or Empty kinds.
> -    Child RHS;
> +    Child RHS = {0};
>
>      /// LHSKind - The NodeKind of the left hand side, \see getLHSKind().
>      NodeKind LHSKind = EmptyKind;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191119/a6a64de0/attachment.html>


More information about the llvm-commits mailing list