]> granicus.if.org Git - clang/commitdiff
Null initialize a few variables flagged by
authorTed Kremenek <kremenek@apple.com>
Sun, 23 Jan 2011 17:04:59 +0000 (17:04 +0000)
committerTed Kremenek <kremenek@apple.com>
Sun, 23 Jan 2011 17:04:59 +0000 (17:04 +0000)
clang's -Wuninitialized-experimental warning.
While these don't look like real bugs, clang's
-Wuninitialized-experimental analysis is stricter
than GCC's, and these fixes have the benefit
of being general nice cleanups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124072 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBuiltin.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaTemplateVariadic.cpp

index 0b7f3a06a7016051e8c735014ea7ea3e4e942d61..4e59c8d5171861516fb731c4aaffefc059d562dc 100644 (file)
@@ -1748,7 +1748,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
     Ops[0] = Builder.CreateBitCast(Ops[0], llvm::PointerType::getUnqual(Ty));
     Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
     Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
-    Value *SV;
+    Value *SV = 0;
 
     for (unsigned vi = 0; vi != 2; ++vi) {
       SmallVector<Constant*, 16> Indices;
@@ -1768,7 +1768,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
     Ops[0] = Builder.CreateBitCast(Ops[0], llvm::PointerType::getUnqual(Ty));
     Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
     Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
-    Value *SV;
+    Value *SV = 0;
     
     for (unsigned vi = 0; vi != 2; ++vi) {
       SmallVector<Constant*, 16> Indices;
@@ -1787,7 +1787,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
     Ops[0] = Builder.CreateBitCast(Ops[0], llvm::PointerType::getUnqual(Ty));
     Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
     Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
-    Value *SV;
+    Value *SV = 0;
     
     for (unsigned vi = 0; vi != 2; ++vi) {
       SmallVector<Constant*, 16> Indices;
index 7c6d9d9142f5e77a6c033bb2c8d48319473454c0..62adcf9bb1998165aa14af13afe2d0953bd1ef56 100644 (file)
@@ -2888,7 +2888,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC,
     }
   }
   
-  bool isExplicitSpecialization;
+  bool isExplicitSpecialization = false;
   VarDecl *NewVD;
   if (!getLangOptions().CPlusPlus) {
       NewVD = VarDecl::Create(Context, DC, D.getIdentifierLoc(),
index 8f57c56383c7baca8d7ee8342cdca8235d35e4bb..a49c23b1df8d2cbe0a71688302ce8a351f214d74 100644 (file)
@@ -475,8 +475,7 @@ bool Sema::CheckParameterPacksForExpansion(SourceLocation EllipsisLoc,
   
   for (unsigned I = 0; I != NumUnexpanded; ++I) {
     // Compute the depth and index for this parameter pack.
-    unsigned Depth;
-    unsigned Index;
+    unsigned Depth = 0, Index = 0;
     IdentifierInfo *Name;
     bool IsFunctionParameterPack = false;