[cfe-commits] r43588 - in /cfe/trunk: CodeGen/CGExprScalar.cpp test/CodeGen/pointer-to-int.c
Anders Carlsson
andersca at mac.com
Wed Oct 31 16:18:03 PDT 2007
Author: andersca
Date: Wed Oct 31 18:18:02 2007
New Revision: 43588
URL: http://llvm.org/viewvc/llvm-project?rev=43588&view=rev
Log:
Fix a typo that prevented pointer-to-int conversions from working.
Added:
cfe/trunk/test/CodeGen/pointer-to-int.c
Modified:
cfe/trunk/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprScalar.cpp?rev=43588&r1=43587&r2=43588&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/CodeGen/CGExprScalar.cpp Wed Oct 31 18:18:02 2007
@@ -334,7 +334,7 @@
if (isa<PointerType>(SrcType)) {
// Must be an ptr to int cast.
assert(isa<llvm::IntegerType>(DstTy) && "not ptr->int?");
- return Builder.CreateIntToPtr(Src, DstTy, "conv");
+ return Builder.CreatePtrToInt(Src, DstTy, "conv");
}
// Finally, we have the arithmetic types: real int/float.
Added: cfe/trunk/test/CodeGen/pointer-to-int.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pointer-to-int.c?rev=43588&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/pointer-to-int.c (added)
+++ cfe/trunk/test/CodeGen/pointer-to-int.c Wed Oct 31 18:18:02 2007
@@ -0,0 +1,6 @@
+// RUN: clang -emit-llvm %s
+
+int test(void* i)
+{
+ return (int)i;
+}
More information about the cfe-commits
mailing list