From: Ted Kremenek Date: Tue, 1 May 2012 17:56:53 +0000 (+0000) Subject: Push variable declaration into nested scope (the only place where it is used). Found... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cf18ae57176a827b668e059d559ee5f1d6f8f910;p=clang Push variable declaration into nested scope (the only place where it is used). Found by static analyzer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155922 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index a60b436620..6cbf36dc14 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -880,7 +880,6 @@ llvm::MDNode *CodeGenFunction::getRangeForLoadFromType(QualType Ty) { CGM.getCodeGenOpts().StrictEnums && !ET->getDecl()->isFixed()); bool IsBool = hasBooleanRepresentation(Ty); - llvm::Type *LTy; if (!IsBool && !IsRegularCPlusPlusEnum) return NULL; @@ -889,10 +888,9 @@ llvm::MDNode *CodeGenFunction::getRangeForLoadFromType(QualType Ty) { if (IsBool) { Min = llvm::APInt(8, 0); End = llvm::APInt(8, 2); - LTy = Int8Ty; } else { const EnumDecl *ED = ET->getDecl(); - LTy = ConvertTypeForMem(ED->getIntegerType()); + llvm::Type *LTy = ConvertTypeForMem(ED->getIntegerType()); unsigned Bitwidth = LTy->getScalarSizeInBits(); unsigned NumNegativeBits = ED->getNumNegativeBits(); unsigned NumPositiveBits = ED->getNumPositiveBits();