[clang] d0f3c82 - Fix uninitialized variable warnings. NFCI.

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 16:11:09 PST 2019


Which compiler/what sort of warning was this addressing? (it can be
beneficial to leave variables uninitialized if their value isn't intended
to be used - so things like asan can catch bugs where the read of
uninitialized is unintended)

On Sat, Nov 2, 2019 at 11:27 AM Simon Pilgrim via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

>
> Author: Simon Pilgrim
> Date: 2019-11-02T18:03:21Z
> New Revision: d0f3c822160e36e10588bc86dabde6ab8d63cf10
>
> URL:
> https://github.com/llvm/llvm-project/commit/d0f3c822160e36e10588bc86dabde6ab8d63cf10
> DIFF:
> https://github.com/llvm/llvm-project/commit/d0f3c822160e36e10588bc86dabde6ab8d63cf10.diff
>
> LOG: Fix uninitialized variable warnings. NFCI.
>
> Added:
>
>
> Modified:
>     clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
>
> Removed:
>
>
>
>
> ################################################################################
> diff  --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
> b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
> index 778375010041..f694c3e4380a 100644
> --- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
> +++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
> @@ -134,7 +134,7 @@ namespace {
>
>      const Record *ExplicitDef;
>
> -    GroupInfo() : ExplicitDef(nullptr) {}
> +    GroupInfo() : IDNo(0), ExplicitDef(nullptr) {}
>    };
>  } // end anonymous namespace.
>
> @@ -554,7 +554,7 @@ struct SelectPiece : Piece {
>
>    ModifierType ModKind;
>    std::vector<Piece *> Options;
> -  int Index;
> +  int Index = 0;
>
>    static bool classof(const Piece *P) {
>      return P->getPieceClass() == SelectPieceClass ||
> @@ -566,7 +566,7 @@ struct PluralPiece : SelectPiece {
>    PluralPiece() : SelectPiece(PluralPieceClass, MT_Plural) {}
>
>    std::vector<Piece *> OptionPrefixes;
> -  int Index;
> +  int Index = 0;
>
>    static bool classof(const Piece *P) {
>      return P->getPieceClass() == PluralPieceClass;
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191118/59c18da2/attachment.html>


More information about the cfe-commits mailing list