summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-10 18:34:14 +0000
committerChris Lattner <sabre@nondot.org>2010-04-10 18:34:14 +0000
commitbc3be65d2ee4a8514577a0276b803f5573c15414 (patch)
tree8c551bdf61a5598520f2b197d7abbf278eec3db0 /clang
parent9ae28b141f1c8f9f3007dcb90245efc550a7681c (diff)
downloadbcm5719-llvm-bc3be65d2ee4a8514577a0276b803f5573c15414.tar.gz
bcm5719-llvm-bc3be65d2ee4a8514577a0276b803f5573c15414.zip
fix PR6805: llvm.objectsize changed to take an i1 instead of an i32.
llvm-svn: 100938
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp13
-rw-r--r--clang/test/CodeGen/catch-undef-behavior.c7
2 files changed, 12 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 6fd18f395c4..4b61c2835ff 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -240,18 +240,15 @@ void CodeGenFunction::EmitCheck(llvm::Value *Address, unsigned Size) {
if (!CatchUndefined)
return;
- const llvm::IntegerType *Size_tTy
+ const llvm::Type *Size_tTy
= llvm::IntegerType::get(VMContext, LLVMPointerWidth);
Address = Builder.CreateBitCast(Address, PtrToInt8Ty);
- const llvm::Type *ResType[] = {
- Size_tTy
- };
- llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::objectsize, ResType, 1);
- const llvm::IntegerType *IntTy = cast<llvm::IntegerType>(
- CGM.getTypes().ConvertType(CGM.getContext().IntTy));
+ llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::objectsize, &Size_tTy, 1);
+ const llvm::IntegerType *Int1Ty = llvm::IntegerType::get(VMContext, 1);
+
// In time, people may want to control this and use a 1 here.
- llvm::Value *Arg = llvm::ConstantInt::get(IntTy, 0);
+ llvm::Value *Arg = llvm::ConstantInt::get(Int1Ty, 0);
llvm::Value *C = Builder.CreateCall2(F, Address, Arg);
llvm::BasicBlock *Cont = createBasicBlock();
llvm::BasicBlock *Check = createBasicBlock();
diff --git a/clang/test/CodeGen/catch-undef-behavior.c b/clang/test/CodeGen/catch-undef-behavior.c
new file mode 100644
index 00000000000..b7a4a90347d
--- /dev/null
+++ b/clang/test/CodeGen/catch-undef-behavior.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o /dev/null %s
+
+// PR6805
+void foo() {
+ union { int i; } u;
+ u.i=1;
+}
OpenPOWER on IntegriCloud