Fix another byref bug. This should hopefully get QuickLookPlugins building successfully.

llvm-svn: 81681
This commit is contained in:
Anders Carlsson
2009-09-13 17:55:13 +00:00
parent 512e60ac35
commit ccbabc9645
2 changed files with 19 additions and 11 deletions

View File

@@ -270,18 +270,18 @@ const llvm::Type *CodeGenFunction::BuildByRefType(const ValueDecl *D) {
llvm::RoundUpToAlignment(CurrentOffsetInBytes, Align);
unsigned NumPaddingBytes = AlignedOffsetInBytes - CurrentOffsetInBytes;
assert(NumPaddingBytes > 0 && "Can't append any padding!");
if (NumPaddingBytes > 0) {
const llvm::Type *Ty = llvm::Type::getInt8Ty(VMContext);
// FIXME: We need a sema error for alignment larger than the minimum of the
// maximal stack alignmint and the alignment of malloc on the system.
if (NumPaddingBytes > 1)
Ty = llvm::ArrayType::get(Ty, NumPaddingBytes);
const llvm::Type *Ty = llvm::Type::getInt8Ty(VMContext);
// FIXME: We need a sema error for alignment larger than the minimum of the
// maximal stack alignmint and the alignment of malloc on the system.
if (NumPaddingBytes > 1)
Ty = llvm::ArrayType::get(Ty, NumPaddingBytes);
Types.push_back(Ty);
Types.push_back(Ty);
// We want a packed struct.
Packed = true;
// We want a packed struct.
Packed = true;
}
}
// T x;

View File

@@ -1,4 +1,5 @@
// RUN: clang-cc -emit-llvm -o -
// RUN: clang-cc -emit-llvm -o - -triple x86_64-apple-darwin10 &&
// RUN: clang-cc -emit-llvm -o - -triple i386-apple-darwin10
typedef int __attribute__((aligned(32))) ai;
void f() {
@@ -9,3 +10,10 @@ void f() {
}();
}
void g() {
__block double a = 10;
^{
a = 20;
}();
}