diff options
author | Devang Patel <dpatel@apple.com> | 2010-10-06 18:30:00 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-10-06 18:30:00 +0000 |
commit | cdf523ca1fc81c18fccb4757714f7cd27288a580 (patch) | |
tree | 7406fa240e119d431f11f066f66a230c3cf918f7 /lib/CodeGen/CGDebugInfo.cpp | |
parent | 730e175910936eae49e65caea8b2ba81c67edff7 (diff) |
Do not emit subrange for incomplete array type.
This is tested by ptype.exp in gdb testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 2a84d1d7d6..2c72996392 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1255,14 +1255,18 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty, // obvious/recursive way? llvm::SmallVector<llvm::DIDescriptor, 8> Subscripts; QualType EltTy(Ty, 0); - while ((Ty = dyn_cast<ArrayType>(EltTy))) { - uint64_t Upper = 0; - if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(Ty)) - if (CAT->getSize().getZExtValue()) - Upper = CAT->getSize().getZExtValue() - 1; - // FIXME: Verify this is right for VLAs. - Subscripts.push_back(DebugFactory.GetOrCreateSubrange(0, Upper)); + if (Ty->isIncompleteArrayType()) EltTy = Ty->getElementType(); + else { + while ((Ty = dyn_cast<ArrayType>(EltTy))) { + uint64_t Upper = 0; + if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(Ty)) + if (CAT->getSize().getZExtValue()) + Upper = CAT->getSize().getZExtValue() - 1; + // FIXME: Verify this is right for VLAs. + Subscripts.push_back(DebugFactory.GetOrCreateSubrange(0, Upper)); + EltTy = Ty->getElementType(); + } } llvm::DIArray SubscriptArray = |