Switch a lot of call-sites over to using the new value-kind calculations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120084 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 7682baa..f802b39 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -192,7 +192,7 @@
}
RValue RV;
- if (E->isLvalue(CGF.getContext()) == Expr::LV_Valid) {
+ if (E->isLValue()) {
// Emit the expression as an lvalue.
LValue LV = CGF.EmitLValue(E);
if (LV.isPropertyRef() || LV.isKVCRef()) {
@@ -235,8 +235,8 @@
continue;
}
} else if (const MemberExpr *ME = dyn_cast<MemberExpr>(E)) {
- if (ME->getBase()->isLvalue(CGF.getContext()) != Expr::LV_Valid &&
- ME->getBase()->getType()->isRecordType()) {
+ if (!ME->isArrow() && ME->getBase()->isRValue()) {
+ assert(ME->getBase()->getType()->isRecordType());
if (FieldDecl *Field = dyn_cast<FieldDecl>(ME->getMemberDecl())) {
E = ME->getBase();
Adjustments.push_back(SubobjectAdjustment(Field));
@@ -1515,7 +1515,7 @@
const PointerType *PT = E->getBase()->getType()->getAs<PointerType>();
Base = MakeAddrLValue(Ptr, PT->getPointeeType());
Base.getQuals().removeObjCGCAttr();
- } else if (E->getBase()->isLvalue(getContext()) == Expr::LV_Valid) {
+ } else if (E->getBase()->isGLValue()) {
// Otherwise, if the base is an lvalue ( as in the case of foo.x.x),
// emit the base as an lvalue.
assert(E->getBase()->getType()->isVectorType());
@@ -1711,7 +1711,7 @@
LValue
CodeGenFunction::EmitConditionalOperatorLValue(const ConditionalOperator *E) {
- if (E->isLvalue(getContext()) == Expr::LV_Valid) {
+ if (E->isGLValue()) {
if (int Cond = ConstantFoldsToSimpleInteger(E->getCond())) {
Expr *Live = Cond == 1 ? E->getLHS() : E->getRHS();
if (Live)
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index a5f9890..e5ea26c 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -1474,7 +1474,7 @@
// If it's an l-value, load through the appropriate subobject l-value.
// Note that we have to ask E because Op might be an l-value that
// this won't work for, e.g. an Obj-C property.
- if (E->isLvalue(CGF.getContext()) == Expr::LV_Valid)
+ if (E->isGLValue())
return CGF.EmitLoadOfLValue(CGF.EmitLValue(E), E->getType())
.getScalarVal();
@@ -1491,7 +1491,7 @@
// If it's an l-value, load through the appropriate subobject l-value.
// Note that we have to ask E because Op might be an l-value that
// this won't work for, e.g. an Obj-C property.
- if (Op->isLvalue(CGF.getContext()) == Expr::LV_Valid)
+ if (Op->isGLValue())
return CGF.EmitLoadOfLValue(CGF.EmitLValue(E), E->getType())
.getScalarVal();
@@ -2548,7 +2548,7 @@
const llvm::Type *ClassPtrTy = ConvertType(E->getType());
Expr *BaseExpr = E->getBase();
- if (BaseExpr->isLvalue(getContext()) != Expr::LV_Valid) {
+ if (BaseExpr->isRValue()) {
V = CreateTempAlloca(ClassPtrTy, "resval");
llvm::Value *Src = EmitScalarExpr(BaseExpr);
Builder.CreateStore(Src, V);