[cfe-commits] r81681 - in /cfe/trunk: lib/CodeGen/CGDecl.cpp test/CodeGen/blocks-aligned-byref-variable.c
Anders Carlsson
andersca at mac.com
Sun Sep 13 10:55:13 PDT 2009
Author: andersca
Date: Sun Sep 13 12:55:13 2009
New Revision: 81681
URL: http://llvm.org/viewvc/llvm-project?rev=81681&view=rev
Log:
Fix another byref bug. This should hopefully get QuickLookPlugins building successfully.
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/test/CodeGen/blocks-aligned-byref-variable.c
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=81681&r1=81680&r2=81681&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Sun Sep 13 12:55:13 2009
@@ -270,18 +270,18 @@
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;
Modified: cfe/trunk/test/CodeGen/blocks-aligned-byref-variable.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/blocks-aligned-byref-variable.c?rev=81681&r1=81680&r2=81681&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/blocks-aligned-byref-variable.c (original)
+++ cfe/trunk/test/CodeGen/blocks-aligned-byref-variable.c Sun Sep 13 12:55:13 2009
@@ -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 g() {
+ __block double a = 10;
+
+ ^{
+ a = 20;
+ }();
+}
More information about the cfe-commits
mailing list