[cfe-commits] r100938 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGen/catch-undef-behavior.c
Chris Lattner
sabre at nondot.org
Sat Apr 10 11:34:14 PDT 2010
Author: lattner
Date: Sat Apr 10 13:34:14 2010
New Revision: 100938
URL: http://llvm.org/viewvc/llvm-project?rev=100938&view=rev
Log:
fix PR6805: llvm.objectsize changed to take an i1 instead of an i32.
Added:
cfe/trunk/test/CodeGen/catch-undef-behavior.c
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=100938&r1=100937&r2=100938&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Sat Apr 10 13:34:14 2010
@@ -240,18 +240,15 @@
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();
Added: cfe/trunk/test/CodeGen/catch-undef-behavior.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/catch-undef-behavior.c?rev=100938&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/catch-undef-behavior.c (added)
+++ cfe/trunk/test/CodeGen/catch-undef-behavior.c Sat Apr 10 13:34:14 2010
@@ -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;
+}
More information about the cfe-commits
mailing list