]> granicus.if.org Git - clang/commitdiff
Generate debug info for VLA types
authorAnders Carlsson <andersca@mac.com>
Mon, 5 Jan 2009 01:23:29 +0000 (01:23 +0000)
committerAnders Carlsson <andersca@mac.com>
Mon, 5 Jan 2009 01:23:29 +0000 (01:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61661 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index d6a1c6b8b3044c6c9e8ec6c1e8e990bd1c3cd489..6176b868ea8a06eaf5991c4106926d4f3f6a8664 100644 (file)
@@ -329,9 +329,20 @@ llvm::DIType CGDebugInfo::CreateType(const TagType *Ty,
 
 llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty,
                                      llvm::DICompileUnit Unit) {
-  // Size and align of the whole array, not the element type.
-  uint64_t Size = M->getContext().getTypeSize(Ty);
-  uint64_t Align = M->getContext().getTypeAlign(Ty);
+  uint64_t Size;
+  uint64_t Align;
+  
+  
+  if (const VariableArrayType *VAT = dyn_cast<VariableArrayType>(Ty)) {
+
+    Size = 0;
+    Align =
+      M->getContext().getTypeSize(M->getContext().getBaseElementType(VAT));
+  } else {
+    // Size and align of the whole array, not the element type.
+    Size = M->getContext().getTypeSize(Ty);
+    Align = M->getContext().getTypeAlign(Ty);
+  }
   
   // Add the dimensions of the array.  FIXME: This loses CV qualifiers from
   // interior arrays, do we care?  Why aren't nested arrays represented the