[PATCH] D40016: Use ImplicitConversionSequence::setAsIdentityConversion(QualType). NFC

Alexander Richardson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 14 03:37:31 PST 2017


arichardson created this revision.

Slightly reduces the amount of duplicated code.


https://reviews.llvm.org/D40016

Files:
  lib/Sema/SemaOverload.cpp


Index: lib/Sema/SemaOverload.cpp
===================================================================
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -4752,10 +4752,7 @@
         InitializedEntity::InitializeParameter(S.Context, ToType,
                                                /*Consumed=*/false);
       if (S.CanPerformCopyInitialization(Entity, From)) {
-        Result.setStandard();
-        Result.Standard.setAsIdentityConversion();
-        Result.Standard.setFromType(ToType);
-        Result.Standard.setAllToTypes(ToType);
+        Result.setAsIdentityConversion(ToType);
         return Result;
       }
     }
@@ -4805,10 +4802,7 @@
     // For an empty list, we won't have computed any conversion sequence.
     // Introduce the identity conversion sequence.
     if (From->getNumInits() == 0) {
-      Result.setStandard();
-      Result.Standard.setAsIdentityConversion();
-      Result.Standard.setFromType(ToType);
-      Result.Standard.setAllToTypes(ToType);
+      Result.setAsIdentityConversion(ToType);
     }
 
     Result.setStdInitializerListElement(toStdInitializerList);
@@ -4946,10 +4940,7 @@
     //    - if the initializer list has no elements, the implicit conversion
     //      sequence is the identity conversion.
     else if (NumInits == 0) {
-      Result.setStandard();
-      Result.Standard.setAsIdentityConversion();
-      Result.Standard.setFromType(ToType);
-      Result.Standard.setAllToTypes(ToType);
+      Result.setAsIdentityConversion(ToType);
     }
     return Result;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40016.122815.patch
Type: text/x-patch
Size: 1551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171114/6d6091b3/attachment.bin>


More information about the cfe-commits mailing list