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 | c0601d1e99daba98c96647ff29dbf27d8a40eb5e (patch) | |
tree | 05ee9417bace6e7bdc8caf3b9eafc9511dc87e99 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | df2dc0f6f2f6b48d03726b341fa14dfad8b70ef4 (diff) | |
download | bcm5719-llvm-c0601d1e99daba98c96647ff29dbf27d8a40eb5e.tar.gz bcm5719-llvm-c0601d1e99daba98c96647ff29dbf27d8a40eb5e.zip |
Do not emit subrange for incomplete array type.
This is tested by ptype.exp in gdb testsuite.
llvm-svn: 115805
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 2a84d1d7d61..2c72996392f 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/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 = |