diff options
author | John McCall <rjmccall@apple.com> | 2011-11-08 22:54:08 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-11-08 22:54:08 +0000 |
commit | a5493f885095bd63d525a7035ad1c224de3ae5f2 (patch) | |
tree | 649509969218d296d3a3425f03f5539386e628bf /lib/CodeGen/CodeGenFunction.h | |
parent | 90f7b62aba1ae2d41bfe2286c210b027fc62681f (diff) |
Bind function "r-values" as l-values when emitting them as
opaque values. Silly C type system.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144144 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 3a0be7a562..383eb587ca 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -970,7 +970,14 @@ public: OpaqueValueMappingData() : OpaqueValue(0) {} static bool shouldBindAsLValue(const Expr *expr) { - return expr->isGLValue() || expr->getType()->isRecordType(); + // gl-values should be bound as l-values for obvious reasons. + // Records should be bound as l-values because IR generation + // always keeps them in memory. Expressions of function type + // act exactly like l-values but are formally required to be + // r-values in C. + return expr->isGLValue() || + expr->getType()->isRecordType() || + expr->getType()->isFunctionType(); } static OpaqueValueMappingData bind(CodeGenFunction &CGF, |