summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-06-04 04:45:03 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-06-04 04:45:03 +0000
commit34f94f93dc20e08c9327441e4b5bcbce9ba23e9c (patch)
treee09b7569e03d34fdf6a2248673ba1e46260b9d8b /lib/CodeGen/CGExpr.cpp
parenta7ff62f9443efa3b13a28a1e566d4625b15b8553 (diff)
downloadclang-34f94f93dc20e08c9327441e4b5bcbce9ba23e9c.tar.gz
clang-34f94f93dc20e08c9327441e4b5bcbce9ba23e9c.tar.bz2
clang-34f94f93dc20e08c9327441e4b5bcbce9ba23e9c.tar.xz
Remove some unreachable (and wrong) code and replace it with an assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183206 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 28eae50832..501d7ecfa3 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -361,19 +361,9 @@ EmitExprForReferenceBinding(CodeGenFunction &CGF, const Expr *E,
case SubobjectAdjustment::FieldAdjustment: {
LValue LV = CGF.MakeAddrLValue(Object, E->getType());
LV = CGF.EmitLValueForField(LV, Adjustment.Field);
- if (LV.isSimple()) {
- Object = LV.getAddress();
- break;
- }
-
- // For non-simple lvalues, we actually have to create a copy of
- // the object we're binding to.
- QualType T = Adjustment.Field->getType().getNonReferenceType()
- .getUnqualifiedType();
- Object = CreateReferenceTemporary(CGF, T, InitializedDecl);
- LValue TempLV = CGF.MakeAddrLValue(Object,
- Adjustment.Field->getType());
- CGF.EmitStoreThroughLValue(CGF.EmitLoadOfLValue(LV), TempLV);
+ assert(LV.isSimple() &&
+ "materialized temporary field is not a simple lvalue");
+ Object = LV.getAddress();
break;
}