diff options
| author | Eric Christopher <echristo@apple.com> | 2012-05-21 22:13:23 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@apple.com> | 2012-05-21 22:13:23 +0000 |
| commit | 246bb9939757ba23cd1f6b29bb56a45b0c4bd096 (patch) | |
| tree | 43af2b54d426a9fece15c695e283702d77a103a4 | |
| parent | fc1d4bdc4f93a071c9d2343270cd41b65890963a (diff) | |
| download | bcm5719-llvm-246bb9939757ba23cd1f6b29bb56a45b0c4bd096.tar.gz bcm5719-llvm-246bb9939757ba23cd1f6b29bb56a45b0c4bd096.zip | |
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
llvm-svn: 157212
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index d110f4bba1c..1df32d85cc5 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1479,25 +1479,21 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty, // obvious/recursive way? SmallVector<llvm::Value *, 8> Subscripts; QualType EltTy(Ty, 0); - if (Ty->isIncompleteArrayType()) + while ((Ty = dyn_cast<ArrayType>(EltTy))) { + int64_t UpperBound = 0; + int64_t LowerBound = 0; + if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(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<ArrayType>(EltTy))) { - int64_t UpperBound = 0; - int64_t LowerBound = 0; - if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(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); |

