summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorWarren Hunt <whunt@google.com>2013-11-01 23:59:41 +0000
committerWarren Hunt <whunt@google.com>2013-11-01 23:59:41 +0000
commit5ae586ad459617f6266ceb4aa7ccf132b73f65fd (patch)
tree45f565c044a4d6a4064befafc1b51d8dd7c27ac5 /clang/lib/AST/ASTContext.cpp
parent365bd0c88cb36f5d92bca3b396fbb0fbe36bc44a (diff)
downloadbcm5719-llvm-5ae586ad459617f6266ceb4aa7ccf132b73f65fd.tar.gz
bcm5719-llvm-5ae586ad459617f6266ceb4aa7ccf132b73f65fd.zip
Improves compatibility with cl.exe when laying out array fields
Differential Revision: http://llvm-reviews.chandlerc.com/D2090 Clang was "improperly" over-aligning arrays with sizes are not a multiple of their alignment. This behavior was removed in microsoft 32 bit mode. In addition, after examination of ASTContext::getTypeInfoImpl, a redundant code block in MicrosoftRecordLayoutBuilder::getAdjustedFieldInfo was deleted. llvm-svn: 193898
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 88e1d04ddf8..2ed345aec8d 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1387,7 +1387,9 @@ static getConstantArrayInfoInChars(const ASTContext &Context,
"Overflow in array type char size evaluation");
uint64_t Width = EltInfo.first.getQuantity() * Size;
unsigned Align = EltInfo.second.getQuantity();
- Width = llvm::RoundUpToAlignment(Width, Align);
+ if (!Context.getTargetInfo().getCXXABI().isMicrosoft() ||
+ Context.getTargetInfo().getPointerWidth(0) == 64)
+ Width = llvm::RoundUpToAlignment(Width, Align);
return std::make_pair(CharUnits::fromQuantity(Width),
CharUnits::fromQuantity(Align));
}
@@ -1460,7 +1462,9 @@ ASTContext::getTypeInfoImpl(const Type *T) const {
"Overflow in array type bit size evaluation");
Width = EltInfo.first*Size;
Align = EltInfo.second;
- Width = llvm::RoundUpToAlignment(Width, Align);
+ if (!getTargetInfo().getCXXABI().isMicrosoft() ||
+ getTargetInfo().getPointerWidth(0) == 64)
+ Width = llvm::RoundUpToAlignment(Width, Align);
break;
}
case Type::ExtVector:
OpenPOWER on IntegriCloud