[cfe-commits] r110450 - /cfe/trunk/lib/CodeGen/CGExprScalar.cpp

Eli Friedman eli.friedman at gmail.com
Fri Aug 6 09:37:05 PDT 2010


Author: efriedma
Date: Fri Aug  6 11:37:05 2010
New Revision: 110450

URL: http://llvm.org/viewvc/llvm-project?rev=110450&view=rev
Log:
Initialize variable to work around warning; unfortunately, there isn't any
way to tell gcc "really, values outside the enum aren't valid".


Modified:
    cfe/trunk/lib/CodeGen/CGExprScalar.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=110450&r1=110449&r2=110450&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Aug  6 11:37:05 2010
@@ -1278,7 +1278,7 @@
   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 @@
       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");





More information about the cfe-commits mailing list