[cfe-commits] r61661 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Anders Carlsson andersca at mac.com
Sun Jan 4 17:23:29 PST 2009


Author: andersca
Date: Sun Jan  4 19:23:29 2009
New Revision: 61661

URL: http://llvm.org/viewvc/llvm-project?rev=61661&view=rev
Log:
Generate debug info for VLA types

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=61661&r1=61660&r2=61661&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Sun Jan  4 19:23:29 2009
@@ -329,9 +329,20 @@
 
 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





More information about the cfe-commits mailing list