summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/RecordLayoutBuilder.cpp
diff options
context:
space:
mode:
authorWarren Hunt <whunt@google.com>2014-02-22 00:40:37 +0000
committerWarren Hunt <whunt@google.com>2014-02-22 00:40:37 +0000
commitc85942038af58dbce643b44fe2160f60b137fd53 (patch)
tree15e30e03865b09c1527c821370d672ddd0ed3535 /clang/lib/AST/RecordLayoutBuilder.cpp
parent324eee45a74c13f60e3ef23cfa0990e937996551 (diff)
downloadbcm5719-llvm-c85942038af58dbce643b44fe2160f60b137fd53.tar.gz
bcm5719-llvm-c85942038af58dbce643b44fe2160f60b137fd53.zip
[MS-ABI] Fix MSRecordLayout to handel MultiDimensionalArrays
A recent change caused multi-dimensional arrays not to be handled correctly, this patch fixes that. Also, it adds a lit test for multi-dimensional arrays. llvm-svn: 201917
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