]> granicus.if.org Git - clang/commitdiff
Initialize variable to work around warning; unfortunately, there isn't any
authorEli Friedman <eli.friedman@gmail.com>
Fri, 6 Aug 2010 16:37:05 +0000 (16:37 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 6 Aug 2010 16:37:05 +0000 (16:37 +0000)
way to tell gcc "really, values outside the enum aren't valid".

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

lib/CodeGen/CGExprScalar.cpp

index 3939ec7d3065c06d1d522d998f80bd07a173ea1c..ae073da672ab8b51320734b1d1314868aa9f8fb9 100644 (file)
@@ -1278,7 +1278,7 @@ Value *ScalarExprEmitter::VisitOffsetOfExpr(OffsetOfExpr *E) {
   QualType CurrentType = E->getTypeSourceInfo()->getType();
   for (unsigned i = 0; i != n; ++i) {
     OffsetOfExpr::OffsetOfNode ON = E->getComponent(i);
-    llvm::Value *Offset;
+    llvm::Value *Offset = 0;
     switch (ON.getKind()) {
     case OffsetOfExpr::OffsetOfNode::Array: {
       // Compute the index
@@ -1325,10 +1325,10 @@ Value *ScalarExprEmitter::VisitOffsetOfExpr(OffsetOfExpr *E) {
       CurrentType = MemberDecl->getType();
       break;
     }
-        
+
     case OffsetOfExpr::OffsetOfNode::Identifier:
       llvm_unreachable("dependent __builtin_offsetof");
-        
+
     case OffsetOfExpr::OffsetOfNode::Base: {
       if (ON.getBase()->isVirtual()) {
         CGF.ErrorUnsupported(E, "virtual base in offsetof");