[llvm] r361731 - [LLParser] Fix uninitialized variable warnings. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun May 26 08:05:12 PDT 2019


Author: rksimon
Date: Sun May 26 08:05:12 2019
New Revision: 361731

URL: http://llvm.org/viewvc/llvm-project?rev=361731&view=rev
Log:
[LLParser] Fix uninitialized variable warnings. NFCI.

These 3 variables cause quite a few warnings in the scan-build report on llvm.

Modified:
    llvm/trunk/lib/AsmParser/LLParser.cpp

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=361731&r1=361730&r2=361731&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Sun May 26 08:05:12 2019
@@ -8484,13 +8484,13 @@ bool LLParser::ParseGVFlags(GlobalValueS
     return true;
 
   do {
-    unsigned Flag;
+    unsigned Flag = 0;
     switch (Lex.getKind()) {
     case lltok::kw_linkage:
       Lex.Lex();
       if (ParseToken(lltok::colon, "expected ':'"))
         return true;
-      bool HasLinkage;
+      bool HasLinkage = false;
       GVFlags.Linkage = parseOptionalLinkageAux(Lex.getKind(), HasLinkage);
       assert(HasLinkage && "Linkage not optional in summary entry");
       Lex.Lex();
@@ -8536,7 +8536,7 @@ bool LLParser::ParseGVarFlags(GlobalVarS
   assert(Lex.getKind() == lltok::kw_varFlags);
   Lex.Lex();
 
-  unsigned Flag;
+  unsigned Flag = 0;
   if (ParseToken(lltok::colon, "expected ':' here") ||
       ParseToken(lltok::lparen, "expected '(' here") ||
       ParseToken(lltok::kw_readonly, "expected 'readonly' here") ||




More information about the llvm-commits mailing list