]> granicus.if.org Git - clang/commitdiff
Fix a couple -Wuninitialized warnings from gcc. Reported by David Greene.
authorEli Friedman <eli.friedman@gmail.com>
Wed, 29 Feb 2012 20:59:56 +0000 (20:59 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 29 Feb 2012 20:59:56 +0000 (20:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151754 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Expr.cpp
lib/Sema/SemaExpr.cpp

index 92e901a93b8d21cbcd4782b108b07726e1a01b2a..9c9c7baf8ecf4bce6ef52a1872d7caf0469d4004 100644 (file)
@@ -500,7 +500,7 @@ double FloatingLiteral::getValueAsApproximateDouble() const {
 }
 
 int StringLiteral::mapCharByteWidth(TargetInfo const &target,StringKind k) {
-  int CharByteWidth;
+  int CharByteWidth = 0;
   switch(k) {
     case Ascii:
     case UTF8:
@@ -514,6 +514,7 @@ int StringLiteral::mapCharByteWidth(TargetInfo const &target,StringKind k) {
       break;
     case UTF32:
       CharByteWidth = target.getChar32Width();
+      break;
   }
   assert((CharByteWidth & 7) == 0 && "Assumes character size is byte multiple");
   CharByteWidth /= 8;
index 56debcf208727e32c2779be6eee3deb9ac8f08dd..027ec73d49460c6ecbdacaa834d38e8a158bfd67 100644 (file)
@@ -9000,7 +9000,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
   // Decode the result (notice that AST's are still created for extensions).
   bool CheckInferredResultType = false;
   bool isInvalid = false;
-  unsigned DiagKind;
+  unsigned DiagKind = 0;
   FixItHint Hint;
   ConversionFixItGenerator ConvHints;
   bool MayHaveConvFixit = false;