From 16fd39fb11cce33d58ecdd39f25540b85c1542b4 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Fri, 6 Aug 2010 16:37:05 +0000 Subject: [PATCH] Initialize variable to work around warning; unfortunately, there isn't any 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 3939ec7d30..ae073da672 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -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"); -- 2.40.0