r363430 - Remove unused SK_LValueToRValue initialization step.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 14 10:46:39 PDT 2019


Author: rsmith
Date: Fri Jun 14 10:46:39 2019
New Revision: 363430

URL: http://llvm.org/viewvc/llvm-project?rev=363430&view=rev
Log:
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).

This reinstates r363340, reverted in r363352.

Modified:
    cfe/trunk/include/clang/Sema/Initialization.h
    cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/include/clang/Sema/Initialization.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Initialization.h?rev=363430&r1=363429&r2=363430&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Initialization.h (original)
+++ cfe/trunk/include/clang/Sema/Initialization.h Fri Jun 14 10:46:39 2019
@@ -821,9 +821,6 @@ public:
     /// Perform a conversion adding _Atomic to a type.
     SK_AtomicConversion,
 
-    /// Perform a load from a glvalue, producing an rvalue.
-    SK_LValueToRValue,
-
     /// Perform an implicit conversion sequence.
     SK_ConversionSequence,
 
@@ -1270,12 +1267,6 @@ public:
   /// type.
   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.
   void AddConversionSequenceStep(const ImplicitConversionSequence &ICS,
                                  QualType T, bool TopLevelOfInitList = false);

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=363430&r1=363429&r2=363430&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Jun 14 10:46:39 2019
@@ -3282,7 +3282,6 @@ void InitializationSequence::Step::Destr
   case SK_QualificationConversionXValue:
   case SK_QualificationConversionLValue:
   case SK_AtomicConversion:
-  case SK_LValueToRValue:
   case SK_ListInitialization:
   case SK_UnwrapInitList:
   case SK_RewrapInitList:
@@ -3466,15 +3465,6 @@ void InitializationSequence::AddAtomicCo
   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(
     const ImplicitConversionSequence &ICS, QualType T,
     bool TopLevelOfInitList) {
@@ -7505,7 +7495,6 @@ ExprResult InitializationSequence::Perfo
   case SK_QualificationConversionXValue:
   case SK_QualificationConversionRValue:
   case SK_AtomicConversion:
-  case SK_LValueToRValue:
   case SK_ConversionSequence:
   case SK_ConversionSequenceNoNarrowing:
   case SK_ListInitialization:
@@ -7777,18 +7766,6 @@ ExprResult InitializationSequence::Perfo
       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_ConversionSequenceNoNarrowing: {
       if (const auto *FromPtrType =
@@ -9010,10 +8987,6 @@ void InitializationSequence::dump(raw_os
       OS << "non-atomic-to-atomic conversion";
       break;
 
-    case SK_LValueToRValue:
-      OS << "load (lvalue to rvalue)";
-      break;
-
     case SK_ConversionSequence:
       OS << "implicit conversion sequence (";
       S->ICS->dump(); // FIXME: use OS




More information about the cfe-commits mailing list