From: Eric Christopher Date: Mon, 21 May 2012 22:13:23 +0000 (+0000) Subject: Revert r115805. An array type is required to have a range type, X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6d11975d7182ee63ceb6a4f3ece4ee27efbba68;p=clang Revert r115805. An array type is required to have a range type, however, the range can be unknown for the upper bound. Testcase to follow. Part of rdar://11457152 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157212 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index d110f4bba1..1df32d85cc 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1479,25 +1479,21 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty, // obvious/recursive way? SmallVector Subscripts; QualType EltTy(Ty, 0); - if (Ty->isIncompleteArrayType()) + while ((Ty = dyn_cast(EltTy))) { + int64_t UpperBound = 0; + int64_t LowerBound = 0; + if (const ConstantArrayType *CAT = dyn_cast(Ty)) { + if (CAT->getSize().getZExtValue()) + UpperBound = CAT->getSize().getZExtValue() - 1; + } else + // This is an unbounded array. Use Low = 1, Hi = 0 to express such + // arrays. + LowerBound = 1; + + // FIXME: Verify this is right for VLAs. + Subscripts.push_back(DBuilder.getOrCreateSubrange(LowerBound, + UpperBound)); EltTy = Ty->getElementType(); - else { - while ((Ty = dyn_cast(EltTy))) { - int64_t UpperBound = 0; - int64_t LowerBound = 0; - if (const ConstantArrayType *CAT = dyn_cast(Ty)) { - if (CAT->getSize().getZExtValue()) - UpperBound = CAT->getSize().getZExtValue() - 1; - } else - // This is an unbounded array. Use Low = 1, Hi = 0 to express such - // arrays. - LowerBound = 1; - - // FIXME: Verify this is right for VLAs. - Subscripts.push_back(DBuilder.getOrCreateSubrange(LowerBound, - UpperBound)); - EltTy = Ty->getElementType(); - } } llvm::DIArray SubscriptArray = DBuilder.getOrCreateArray(Subscripts);