Fix a typo that prevented pointer-to-int conversions from working.

llvm-svn: 43588
This commit is contained in:
Anders Carlsson 2007-10-31 23:18:02 +00:00
parent f5fcb9870a
commit e89b84ab29
2 changed files with 7 additions and 1 deletions

View File

@ -334,7 +334,7 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType,
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.

View File

@ -0,0 +1,6 @@
// RUN: clang -emit-llvm %s
int test(void* i)
{
return (int)i;
}