summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2016-08-22 17:49:56 +0000
committerDavid Blaikie <dblaikie@gmail.com>2016-08-22 17:49:56 +0000
commit87173f108ab976f64f4577e3bfce1d300fcb0b50 (patch)
treec4ad8e23a17e92f902e7fa4016275363b0864b01 /clang/lib/CodeGen/CGDebugInfo.cpp
parentc41fcaf8aa1e0fce242fcf0af55d1d8113e67bcb (diff)
downloadbcm5719-llvm-87173f108ab976f64f4577e3bfce1d300fcb0b50.tar.gz
bcm5719-llvm-87173f108ab976f64f4577e3bfce1d300fcb0b50.zip
PR29086: DebugInfo: Improve support for fixed array dimensions in variable length arrays
llvm-svn: 279445
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index fa5f53e4599..a153193a53f 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2122,6 +2122,11 @@ llvm::DIType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::DIFile *Unit) {
int64_t Count = -1; // Count == -1 is an unbounded array.
if (const auto *CAT = dyn_cast<ConstantArrayType>(Ty))
Count = CAT->getSize().getZExtValue();
+ else if (const auto *VAT = dyn_cast<VariableArrayType>(Ty)) {
+ llvm::APSInt V;
+ if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
+ Count = V.getExtValue();
+ }
// FIXME: Verify this is right for VLAs.
Subscripts.push_back(DBuilder.getOrCreateSubrange(0, Count));
OpenPOWER on IntegriCloud