Remove unused SK_LValueToRValue initialization step.

In addition to being unused and duplicating code, this was also wrong
(it didn't properly mark the operand as being potentially not odr-used).

llvm-svn: 363340
This commit is contained in:
Richard Smith 2019-06-13 23:47:42 +00:00
parent 68a2fef9ae
commit aca017e802
2 changed files with 0 additions and 36 deletions

View File

@ -821,9 +821,6 @@ public:
/// Perform a conversion adding _Atomic to a type. /// Perform a conversion adding _Atomic to a type.
SK_AtomicConversion, SK_AtomicConversion,
/// Perform a load from a glvalue, producing an rvalue.
SK_LValueToRValue,
/// Perform an implicit conversion sequence. /// Perform an implicit conversion sequence.
SK_ConversionSequence, SK_ConversionSequence,
@ -1270,12 +1267,6 @@ public:
/// type. /// type.
void AddAtomicConversionStep(QualType Ty); void AddAtomicConversionStep(QualType Ty);
/// Add a new step that performs a load of the given type.
///
/// Although the term "LValueToRValue" is conventional, this applies to both
/// lvalues and xvalues.
void AddLValueToRValueStep(QualType Ty);
/// Add a new step that applies an implicit conversion sequence. /// Add a new step that applies an implicit conversion sequence.
void AddConversionSequenceStep(const ImplicitConversionSequence &ICS, void AddConversionSequenceStep(const ImplicitConversionSequence &ICS,
QualType T, bool TopLevelOfInitList = false); QualType T, bool TopLevelOfInitList = false);

View File

@ -3282,7 +3282,6 @@ void InitializationSequence::Step::Destroy() {
case SK_QualificationConversionXValue: case SK_QualificationConversionXValue:
case SK_QualificationConversionLValue: case SK_QualificationConversionLValue:
case SK_AtomicConversion: case SK_AtomicConversion:
case SK_LValueToRValue:
case SK_ListInitialization: case SK_ListInitialization:
case SK_UnwrapInitList: case SK_UnwrapInitList:
case SK_RewrapInitList: case SK_RewrapInitList:
@ -3466,15 +3465,6 @@ void InitializationSequence::AddAtomicConversionStep(QualType Ty) {
Steps.push_back(S); Steps.push_back(S);
} }
void InitializationSequence::AddLValueToRValueStep(QualType Ty) {
assert(!Ty.hasQualifiers() && "rvalues may not have qualifiers");
Step S;
S.Kind = SK_LValueToRValue;
S.Type = Ty;
Steps.push_back(S);
}
void InitializationSequence::AddConversionSequenceStep( void InitializationSequence::AddConversionSequenceStep(
const ImplicitConversionSequence &ICS, QualType T, const ImplicitConversionSequence &ICS, QualType T,
bool TopLevelOfInitList) { bool TopLevelOfInitList) {
@ -7505,7 +7495,6 @@ ExprResult InitializationSequence::Perform(Sema &S,
case SK_QualificationConversionXValue: case SK_QualificationConversionXValue:
case SK_QualificationConversionRValue: case SK_QualificationConversionRValue:
case SK_AtomicConversion: case SK_AtomicConversion:
case SK_LValueToRValue:
case SK_ConversionSequence: case SK_ConversionSequence:
case SK_ConversionSequenceNoNarrowing: case SK_ConversionSequenceNoNarrowing:
case SK_ListInitialization: case SK_ListInitialization:
@ -7777,18 +7766,6 @@ ExprResult InitializationSequence::Perform(Sema &S,
break; break;
} }
case SK_LValueToRValue: {
assert(CurInit.get()->isGLValue() && "cannot load from a prvalue");
// C++ [conv.lval]p3:
// If T is cv std::nullptr_t, the result is a null pointer constant.
CastKind CK =
Step->Type->isNullPtrType() ? CK_NullToPointer : CK_LValueToRValue;
CurInit =
ImplicitCastExpr::Create(S.Context, Step->Type, CK, CurInit.get(),
/*BasePath=*/nullptr, VK_RValue);
break;
}
case SK_ConversionSequence: case SK_ConversionSequence:
case SK_ConversionSequenceNoNarrowing: { case SK_ConversionSequenceNoNarrowing: {
if (const auto *FromPtrType = if (const auto *FromPtrType =
@ -9010,10 +8987,6 @@ void InitializationSequence::dump(raw_ostream &OS) const {
OS << "non-atomic-to-atomic conversion"; OS << "non-atomic-to-atomic conversion";
break; break;
case SK_LValueToRValue:
OS << "load (lvalue to rvalue)";
break;
case SK_ConversionSequence: case SK_ConversionSequence:
OS << "implicit conversion sequence ("; OS << "implicit conversion sequence (";
S->ICS->dump(); // FIXME: use OS S->ICS->dump(); // FIXME: use OS