summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/RecordLayoutBuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/RecordLayoutBuilder.cpp')
-rw-r--r--clang/lib/AST/RecordLayoutBuilder.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index a038e2dc6a5..731f197fe08 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -2271,8 +2271,9 @@ MicrosoftRecordLayoutBuilder::getAdjustedElementInfo(
// Get the element info for a layout, respecting pack.
Info = getAdjustedElementInfo(Layout, false);
// If the field is an array type, scale it's size properly.
- if (const ConstantArrayType *CAT =
- dyn_cast<ConstantArrayType>(FD->getType()))
+ for (const ConstantArrayType *CAT =
+ dyn_cast<ConstantArrayType>(FD->getType()); CAT;
+ CAT = dyn_cast<ConstantArrayType>(CAT->getElementType()))
Info.Size = Info.Size * (int64_t)CAT->getSize().getZExtValue();
// Capture required alignment as a side-effect.
RequiredAlignment = std::max(RequiredAlignment,
OpenPOWER on IntegriCloud