summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-12-04 21:34:03 +0000
committerBill Wendling <isanbard@gmail.com>2012-12-04 21:34:03 +0000
commit9493dae613847b01b79914502f337814fe3e00ac (patch)
treea226d132d41fbb221f379e5d5099b28a3e13af70 /lib/VMCore
parent91b9763d53d12e5bb89a395daec9e12359e7adb4 (diff)
downloadllvm-9493dae613847b01b79914502f337814fe3e00ac.tar.gz
llvm-9493dae613847b01b79914502f337814fe3e00ac.tar.bz2
llvm-9493dae613847b01b79914502f337814fe3e00ac.tar.xz
Use the 'count' attribute to calculate the upper bound of an array.
The count attribute is more accurate with regards to the size of an array. It also obviates the upper bound attribute in the subrange. We can also better handle an unbound array by setting the count to -1 instead of the lower bound to 1 and upper bound to 0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169312 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/DIBuilder.cpp4
-rw-r--r--lib/VMCore/DebugInfo.cpp6
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/VMCore/DIBuilder.cpp b/lib/VMCore/DIBuilder.cpp
index 2b77edc7f9..b3bbde86c5 100644
--- a/lib/VMCore/DIBuilder.cpp
+++ b/lib/VMCore/DIBuilder.cpp
@@ -741,12 +741,10 @@ DIArray DIBuilder::getOrCreateArray(ArrayRef<Value *> Elements) {
/// getOrCreateSubrange - Create a descriptor for a value range. This
/// implicitly uniques the values returned.
-DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Hi,
- int64_t Count) {
+DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_subrange_type),
ConstantInt::get(Type::getInt64Ty(VMContext), Lo),
- ConstantInt::get(Type::getInt64Ty(VMContext), Hi),
ConstantInt::get(Type::getInt64Ty(VMContext), Count)
};
diff --git a/lib/VMCore/DebugInfo.cpp b/lib/VMCore/DebugInfo.cpp
index 73eb92ee84..0b43cc0beb 100644
--- a/lib/VMCore/DebugInfo.cpp
+++ b/lib/VMCore/DebugInfo.cpp
@@ -1049,7 +1049,11 @@ void DIDescriptor::print(raw_ostream &OS) const {
}
void DISubrange::printInternal(raw_ostream &OS) const {
- OS << " [" << getLo() << ", " << getHi() << ']';
+ int64_t Count = getCount();
+ if (Count != -1)
+ OS << " [" << getLo() << ", " << Count - 1 << ']';
+ else
+ OS << " [unbound]";
}
void DIScope::printInternal(raw_ostream &OS) const {