summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-11-08 22:54:08 +0000
committerJohn McCall <rjmccall@apple.com>2011-11-08 22:54:08 +0000
commit9a54961e0174ff95efc69bfcac94d5772f2ad7f0 (patch)
tree71cdd757d5bbfee75e216fa3f64fe668fa7b76e1 /clang/lib/CodeGen/CodeGenFunction.h
parent557fc9a99d50a8302c98196da346b19da76be291 (diff)
downloadbcm5719-llvm-9a54961e0174ff95efc69bfcac94d5772f2ad7f0.tar.gz
bcm5719-llvm-9a54961e0174ff95efc69bfcac94d5772f2ad7f0.zip
Bind function "r-values" as l-values when emitting them as
opaque values. Silly C type system. llvm-svn: 144144
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 3a0be7a5627..383eb587ca5 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/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,
OpenPOWER on IntegriCloud