From 9d11e6f4754848cd74b9a08d40d4a9e0fe68e29d Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 27 Jun 2011 19:46:54 +0000 Subject: Revert parts of r133860 to fix a crash. Add a test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133931 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index a3f8301578..5bdb016738 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -791,7 +791,9 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV) { return RValue::get(EmitARCLoadWeak(LV.getAddress())); if (LV.isSimple()) { - assert(!LV.getType()->isFunctionType()); + // Functions are l-values that don't require loading. + if (LV.getType()->isFunctionType()) + return RValue::get(LV.getAddress()); // Everything needs a load. return RValue::get(EmitLoadOfScalar(LV)); -- cgit v1.2.3