diff options
author | Anders Carlsson <andersca@mac.com> | 2009-01-05 01:23:29 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-01-05 01:23:29 +0000 |
commit | 835c909696ecd1e1f128297089d1def8d1a6f7cd (patch) | |
tree | f3f30def8dc2fec05dcf09253912f2055f06787e | |
parent | a67865c64e2185817703b602ec24163b286abaab (diff) |
Generate debug info for VLA types
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61661 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index d6a1c6b8b3..6176b868ea 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -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 |