Add a 'count' field to the DWARF subrange.

The count field is necessary because there isn't a difference between the 'lo'
and 'hi' attributes for a one-element array and a zero-element array. When the
count is '0', we know that this is a zero-element array. When it's >=1, then
it's a normal constant sized array. When it's -1, then the array is unbounded.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169219 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/debug-info-flex-member.cpp b/test/CodeGenCXX/debug-info-flex-member.cpp
index b6aa6da..d38634c 100644
--- a/test/CodeGenCXX/debug-info-flex-member.cpp
+++ b/test/CodeGenCXX/debug-info-flex-member.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
 
-// CHECK: metadata !{i32 {{.*}}, i64 1, i64 0}        ; [ DW_TAG_subrange_type ]
+// CHECK: metadata !{i32 {{.*}}, i64 1, i64 0, i64 -1}        ; [ DW_TAG_subrange_type ]
 
 struct StructName {
   int member[];
diff --git a/test/CodeGenCXX/debug-info-zero-length-arrays.cpp b/test/CodeGenCXX/debug-info-zero-length-arrays.cpp
new file mode 100644
index 0000000..bfbea37
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-zero-length-arrays.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang -fverbose-asm -g -O0 -S %s -o - | FileCheck %s
+// <rdar://problem/12566646>
+
+class A {
+  int x[];
+};
+A a;
+
+// CHECK:      Abbrev [3] 0x2d:0x3 DW_TAG_base_type
+// CHECK-NEXT:   DW_AT_byte_size
+// CHECK-NEXT:     DW_AT_encoding
+// CHECK-NEXT:   Abbrev [4] 0x30:0xb DW_TAG_array_type
+// CHECK-NEXT:     DW_AT_type
+// CHECK-NEXT:     Abbrev [5] 0x35:0x5 DW_TAG_subrange_type
+// CHECK-NEXT:       DW_AT_type
+// CHECK-NEXT:   End Of Children Mark