Lines Matching full:conversion

129 /// GetConversionRank - Retrieve the implicit conversion rank
130 /// corresponding to the given implicit conversion kind.
196 /// implicit conversion.
199 "No conversion", in GetImplicitConversionName()
203 "Function pointer conversion", in GetImplicitConversionName()
208 "Integral conversion", in GetImplicitConversionName()
209 "Floating conversion", in GetImplicitConversionName()
210 "Complex conversion", in GetImplicitConversionName()
211 "Floating-integral conversion", in GetImplicitConversionName()
212 "Pointer conversion", in GetImplicitConversionName()
213 "Pointer-to-member conversion", in GetImplicitConversionName()
214 "Boolean conversion", in GetImplicitConversionName()
215 "Compatible-types conversion", in GetImplicitConversionName()
216 "Derived-to-base conversion", in GetImplicitConversionName()
217 "Vector conversion", in GetImplicitConversionName()
218 "SVE Vector conversion", in GetImplicitConversionName()
219 "RVV Vector conversion", in GetImplicitConversionName()
221 "Complex-real conversion", in GetImplicitConversionName()
222 "Block Pointer conversion", in GetImplicitConversionName()
223 "Transparent Union Conversion", in GetImplicitConversionName()
224 "Writeback conversion", in GetImplicitConversionName()
225 "OpenCL Zero Event Conversion", in GetImplicitConversionName()
226 "OpenCL Zero Queue Conversion", in GetImplicitConversionName()
227 "C specific type conversion", in GetImplicitConversionName()
228 "Incompatible pointer conversion", in GetImplicitConversionName()
229 "Fixed point conversion", in GetImplicitConversionName()
231 "Non-decaying array conversion", in GetImplicitConversionName()
238 /// StandardConversionSequence - Set the standard conversion
239 /// sequence to the identity conversion.
257 /// getRank - Retrieve the rank of this standard conversion sequence
273 /// isPointerConversionToBool - Determines whether this conversion is
274 /// a conversion of a pointer or pointer-to-member to bool. This is
275 /// used as part of the ranking of standard conversion sequences
294 /// conversion is a conversion of a pointer to a void pointer. This is
295 /// used as part of the ranking of standard conversion sequences (C++
304 // array-to-pointer implicit conversion, so check for its presence in isPointerConversionToVoidPointer()
305 // and redo the conversion to get a pointer. in isPointerConversionToVoidPointer()
316 /// Skip any implicit casts which could be either part of a narrowing conversion
317 /// or after one in an implicit conversion.
350 /// Check if this standard conversion sequence represents a narrowing
351 /// conversion, according to C++11 [dcl.init.list]p7.
354 /// \param Converted The result of applying this standard conversion sequence.
355 /// \param ConstantValue If this is an NK_Constant_Narrowing conversion, the
356 /// value of the expression prior to the narrowing conversion.
357 /// \param ConstantType If this is an NK_Constant_Narrowing conversion, the
358 /// type of the expression prior to the narrowing conversion.
368 // A narrowing conversion is an implicit conversion ... in getNarrowingKind()
372 // A conversion to an enumeration type is narrowing if the conversion to in getNarrowingKind()
392 // value after conversion will fit into the target type and will produce in getNarrowingKind()
403 assert(Initializer && "Unknown conversion expression"); in getNarrowingKind()
420 // If the resulting value is different, this was a narrowing conversion. in getNarrowingKind()
435 // conversion is within the range of values that can be represented (even in getNarrowingKind()
492 // conversion will fit into the target type and will produce the original in getNarrowingKind()
536 // If the result is different, this was a narrowing conversion. in getNarrowingKind()
578 /// dump - Print this standard conversion sequence to standard
617 /// dump - Print this user-defined conversion sequence to standard
635 /// dump - Print this implicit conversion sequence to standard
640 OS << "Worst list element conversion: "; in dump()
643 OS << "Standard conversion: "; in dump()
647 OS << "User-defined conversion: "; in dump()
651 OS << "Ellipsis conversion"; in dump()
654 OS << "Ambiguous conversion"; in dump()
657 OS << "Bad conversion"; in dump()
1582 /// Tries a user-defined conversion from From to ToType.
1584 /// Produces an implicit conversion sequence for when a standard conversion
1597 // We're not in the case above, so there is no conversion that in TryUserDefinedConversion()
1603 // Attempt user-defined conversion. in TryUserDefinedConversion()
1613 // A conversion of an expression of class type to the same class in TryUserDefinedConversion()
1614 // type is given Exact Match rank, and a conversion of an in TryUserDefinedConversion()
1616 // given Conversion rank, in spite of the fact that a copy in TryUserDefinedConversion()
1617 // constructor (i.e., a user-defined conversion function) is in TryUserDefinedConversion()
1628 // Turn this into a "standard" conversion sequence, so that it in TryUserDefinedConversion()
1629 // gets ranked with standard conversion sequences. in TryUserDefinedConversion()
1662 /// TryImplicitConversion - Attempt to perform an implicit conversion
1664 /// function returns an implicit conversion sequence that can be used
1670 /// this routine would produce an implicit conversion sequence to
1672 /// conversion sequence containing an lvalue-to-rvalue conversion (C++
1673 /// 4.1) followed by a floating-integral conversion (C++ 4.9).
1675 /// Note that this routine only determines how the conversion can be
1676 /// performed; it does not actually perform the conversion. As such,
1677 /// it will not produce any diagnostics if no conversion is available,
1678 /// but will instead return an implicit conversion sequence of kind
1687 /// writeback conversion, which allows __autoreleasing id* parameters to
1710 // A conversion of an expression of class type to the same class in TryImplicitConversion()
1711 // type is given Exact Match rank, and a conversion of an in TryImplicitConversion()
1713 // given Conversion rank, in spite of the fact that a copy/move in TryImplicitConversion()
1714 // constructor (i.e., a user-defined conversion function) is in TryImplicitConversion()
1731 // Determine whether this is considered a derived-to-base conversion. in TryImplicitConversion()
1763 // Objective-C ARC: Determine whether we will allow the writeback conversion. in PerformImplicitConversion()
1785 // Permit the conversion F(t __attribute__((noreturn))) -> F(t) in IsFunctionConversion()
1806 // A function pointer conversion cannot change the class of the function. in IsFunctionConversion()
1846 // Convert FromFPT's ExtParameterInfo if necessary. The conversion is valid in IsFunctionConversion()
1895 /// Determine whether the conversion from FromType to ToType is a valid
1896 /// floating point conversion.
1904 // We of course allow this conversion if long double is really double. in IsFloatingPointConversion()
1967 /// Determine whether the conversion from FromType to ToType is a valid
1968 /// vector conversion.
1970 /// \param ICK Will be set to the vector conversion kind, if this is a vector
1971 /// conversion.
1977 // conversion. in IsVectorConversion()
2006 // identity conversion. in IsVectorConversion()
2038 // We can perform the conversion between vector types in the following cases: in IsVectorConversion()
2043 // attribute, which inhibits lax vector conversion for overload resolution in IsVectorConversion()
2071 /// conversion sequence (C++ [conv], C++ [over.ics.scs]) from the
2072 /// expression From to the type ToType. Standard conversion sequences
2074 /// types, use TryImplicitConversion. If a conversion exists, SCS will
2075 /// contain the standard conversion sequence required to perform this
2076 /// conversion and this routine will return true. Otherwise, this
2097 // The first conversion can be an lvalue-to-rvalue conversion, in IsStandardConversion()
2098 // array-to-pointer conversion, or function-to-pointer conversion in IsStandardConversion()
2119 // otherwise, only a boolean conversion is standard in IsStandardConversion()
2149 // Lvalue-to-rvalue conversion (C++11 4.1): in IsStandardConversion()
2182 // Array-to-pointer conversion (C++ 4.2) in IsStandardConversion()
2191 // This conversion is deprecated in C++03 (D.4) in IsStandardConversion()
2195 // (13.3.3.1.1), this conversion is considered an in IsStandardConversion()
2196 // array-to-pointer conversion followed by a qualification in IsStandardConversion()
2197 // conversion (4.4). (C++ 4.2p2) in IsStandardConversion()
2205 // Function-to-pointer conversion (C++ 4.3). in IsStandardConversion()
2223 // The second conversion can be an integral promotion, floating in IsStandardConversion()
2224 // point promotion, integral conversion, floating point conversion, in IsStandardConversion()
2225 // floating-integral conversion, pointer conversion, in IsStandardConversion()
2226 // pointer-to-member conversion, or boolean conversion (C++ 4p1). in IsStandardConversion()
2228 // conversion. in IsStandardConversion()
2234 // conversion to do. in IsStandardConversion()
2313 // tryAtomicConversion has updated the standard conversion sequence in IsStandardConversion()
2337 // No second conversion required. in IsStandardConversion()
2342 // The third conversion can be a function pointer conversion or a in IsStandardConversion()
2343 // qualification conversion (C++ [conv.fctptr], [conv.qual]). in IsStandardConversion()
2355 // No conversion required in IsStandardConversion()
2362 // a conversion. [...] in IsStandardConversion()
2378 // this is a bad conversion sequence, unless we're resolving an overload in C. in IsStandardConversion()
2394 // incompatible pointer. Note that an IncompatiblePointer conversion can drop in IsStandardConversion()
2405 // First can only be an lvalue conversion, so we pretend that this was the in IsStandardConversion()
2406 // second conversion. First should already be valid from earlier in the in IsStandardConversion()
2412 // conversion. This could also be ICK_Qualification, but it's simpler to just in IsStandardConversion()
2413 // lump everything in with the second conversion, and we don't gain anything in IsStandardConversion()
2477 // with lowest integer conversion rank (4.13) greater than the rank of long in IsIntegralPromotion()
2487 // C++0x 7.2p9: Note that this implicit enum to int conversion is not in IsIntegralPromotion()
2561 // conversion. in IsIntegralPromotion()
2660 /// BuildSimilarlyQualifiedPointerType - In a pointer conversion from
2732 // Conversion from a null pointer constant to any Objective-C pointer type. in IsPointerConversion()
2788 // pointer conversion, so don't do all of the work below. in IsPointerConversion()
2804 // MSVC allows implicit function to void* type conversion. in IsPointerConversion()
2814 // conversion for compatible-but-not-identical pointee types. in IsPointerConversion()
2829 // necessitates this conversion is ill-formed. The result of the in IsPointerConversion()
2830 // conversion is a pointer to the base class sub-object of the in IsPointerConversion()
2888 // then this is not a pointer conversion. in isObjCPointerConversion()
2893 // Conversion between Objective-C pointers. in isObjCPointerConversion()
2954 // is an Objective-C conversion. in isObjCPointerConversion()
2958 // We always complain about this conversion. in isObjCPointerConversion()
2964 // Allow conversion of pointee being objective-c pointer to another one; in isObjCPointerConversion()
2978 // pointer conversions. If so, we permit the conversion (but in isObjCPointerConversion()
2986 // Objective-C pointer conversion. in isObjCPointerConversion()
3005 // Okay, we have an Objective-C pointer conversion. in isObjCPointerConversion()
3022 // Okay, we have an Objective-C pointer conversion. in isObjCPointerConversion()
3031 // We had an Objective-C conversion. Allow this pointer in isObjCPointerConversion()
3032 // conversion, but complain about it. in isObjCPointerConversion()
3059 // pointer conversions. If so, we permit the conversion. in IsBlockPointerConversion()
3100 // Okay, we have an Objective-C pointer conversion. in IsBlockPointerConversion()
3118 // Okay, we have an Objective-C pointer conversion. in IsBlockPointerConversion()
3336 // We must have a derived-to-base conversion. Check an in CheckPointerConversion()
3337 // ambiguous or inaccessible conversion. in CheckPointerConversion()
3350 // The conversion was successful. in CheckPointerConversion()
3432 // This must be a null pointer to member pointer conversion in CheckMemberPointerConversion()
3479 // Must be a base to derived member conversion. in CheckMemberPointerConversion()
3485 /// Determine whether the lifetime conversion between the two given
3498 /// conversion is valid.
3544 // - in non-top levels it is not a valid conversion. in isQualificationConversionStep()
3557 // The following wording is from C++20, where the result of the conversion in isQualificationConversionStep()
3585 // qualification conversion. in IsQualificationConversion()
3590 // A conversion can add cv-qualifiers at levels other than the first in IsQualificationConversion()
3606 // qualifiers above), then this is a qualification conversion. in IsQualificationConversion()
3610 /// - Determine whether this is a conversion from a scalar type to an
3613 /// If successful, updates \c SCS's second and third steps in the conversion
3614 /// sequence to finish the conversion.
3686 // Record the standard conversion we used and the conversion function. in IsInitializerListConstructorConversion()
3709 /// Determines whether there is a user-defined conversion sequence
3711 /// ToType. If such a conversion exists, User will contain the
3712 /// user-defined conversion sequence that performs such a conversion
3716 /// \param AllowExplicit true if the conversion should consider C++0x
3717 /// "explicit" conversion functions as well as non-explicit conversion
3720 /// \param AllowObjCConversionOnExplicit true if the conversion should
3721 /// allow an extra Objective-C pointer conversion on uses of explicit
3736 // If the type we are conversion to is a class type, enumerate its in IsUserDefinedConversion()
3794 // conversion is to X or reference to cv X, user-defined conversion in IsUserDefinedConversion()
3810 // Allow one user-defined conversion when user specifies a in IsUserDefinedConversion()
3811 // From->ToType conversion via an static cast (c-style, etc). in IsUserDefinedConversion()
3822 // Enumerate conversion functions, if we're allowed to. in IsUserDefinedConversion()
3825 // No conversion functions from incomplete types. in IsUserDefinedConversion()
3830 // Add all of the conversion functions as candidates. in IsUserDefinedConversion()
3866 // Record the standard conversion we used and the conversion function. in IsUserDefinedConversion()
3870 // If the user-defined conversion is specified by a in IsUserDefinedConversion()
3871 // constructor (12.3.1), the initial standard conversion in IsUserDefinedConversion()
3894 if (CXXConversionDecl *Conversion in IsUserDefinedConversion() local
3898 // [...] If the user-defined conversion is specified by a in IsUserDefinedConversion()
3899 // conversion function (12.3.2), the initial standard in IsUserDefinedConversion()
3900 // conversion sequence converts the source type to the in IsUserDefinedConversion()
3901 // implicit object parameter of the conversion function. in IsUserDefinedConversion()
3904 User.ConversionFunction = Conversion; in IsUserDefinedConversion()
3909 // The second standard conversion sequence converts the in IsUserDefinedConversion()
3910 // result of the user-defined conversion to the target type in IsUserDefinedConversion()
3911 // for the sequence. Since an implicit conversion sequence in IsUserDefinedConversion()
3913 // initialization by user-defined conversion apply when in IsUserDefinedConversion()
3914 // selecting the best user-defined conversion for a in IsUserDefinedConversion()
3915 // user-defined conversion sequence (see 13.3.3 and in IsUserDefinedConversion()
3920 llvm_unreachable("Not a constructor or conversion function?"); in IsUserDefinedConversion()
3966 // conversion-operator return value 'points' to, or nullptr.
3979 /// Compare the user-defined conversion functions or constructors
3980 /// of two user-defined conversion sequences to determine whether any ordering
3994 // If both conversion functions are implicitly-declared conversions from in compareConversionFunctions()
3996 // respectively, always prefer the conversion to a function pointer, in compareConversionFunctions()
4007 // In order to support multiple calling conventions for the lambda conversion in compareConversionFunctions()
4050 /// conversion sequences to determine whether one is better than the
4058 // conversion sequences (as defined in 13.3.3.1) in CompareImplicitConversionSequences()
4059 // -- a standard conversion sequence (13.3.3.1.1) is a better in CompareImplicitConversionSequences()
4060 // conversion sequence than a user-defined conversion sequence or in CompareImplicitConversionSequences()
4061 // an ellipsis conversion sequence, and in CompareImplicitConversionSequences()
4062 // -- a user-defined conversion sequence (13.3.3.1.2) is a better in CompareImplicitConversionSequences()
4063 // conversion sequence than an ellipsis conversion sequence in CompareImplicitConversionSequences()
4067 // For the purpose of ranking implicit conversion sequences as in CompareImplicitConversionSequences()
4068 // described in 13.3.3.2, the ambiguous conversion sequence is in CompareImplicitConversionSequences()
4070 // from any other user-defined conversion sequence. in CompareImplicitConversionSequences()
4072 // String literal to 'char *' conversion has been deprecated in C++03. It has in CompareImplicitConversionSequences()
4073 // been removed from C++11. We still accept this conversion, if it happens at in CompareImplicitConversionSequences()
4074 // the best viable function. Otherwise, this conversion is considered worse in CompareImplicitConversionSequences()
4075 // than ellipsis conversion. Consider this as an extension; this is not in the in CompareImplicitConversionSequences()
4084 // conversion is better than string-literal to char* conversion (since there in CompareImplicitConversionSequences()
4085 // is no such conversion in C++11). If there was no #1 at all or #1 couldn't in CompareImplicitConversionSequences()
4087 // If the best viable function has this conversion, a warning will be issued in CompareImplicitConversionSequences()
4104 // The following checks require both conversion sequences to be of in CompareImplicitConversionSequences()
4112 // Two implicit conversion sequences of the same form are in CompareImplicitConversionSequences()
4113 // indistinguishable conversion sequences unless one of the in CompareImplicitConversionSequences()
4116 // List-initialization sequence L1 is a better conversion sequence than in CompareImplicitConversionSequences()
4162 // Standard conversion sequence S1 is a better conversion sequence than in CompareImplicitConversionSequences()
4163 // standard conversion sequence S2 if [...] in CompareImplicitConversionSequences()
4167 // User-defined conversion sequence U1 is a better conversion in CompareImplicitConversionSequences()
4168 // sequence than another user-defined conversion sequence U2 if in CompareImplicitConversionSequences()
4169 // they contain the same user-defined conversion function or in CompareImplicitConversionSequences()
4170 // constructor and if the second standard conversion sequence of in CompareImplicitConversionSequences()
4171 // U1 is better than the second standard conversion sequence of in CompareImplicitConversionSequences()
4187 // Per 13.3.3.2p3, compare the given standard conversion sequences to
4196 // the identity conversion sequence is considered to be a subsequence of in compareStandardConversionSubsets()
4197 // any non-identity conversion sequence in compareStandardConversionSubsets()
4288 /// conversion sequences to determine whether one is better than the
4295 // Standard conversion sequence S1 is a better conversion sequence in CompareStandardConversionSequences()
4296 // than standard conversion sequence S2 if (C++ 13.3.3.2p3): in CompareStandardConversionSequences()
4298 // -- S1 is a proper subsequence of S2 (comparing the conversion in CompareStandardConversionSequences()
4300 // excluding any Lvalue Transformation; the identity conversion in CompareStandardConversionSequences()
4302 // non-identity conversion sequence) or, if not that, in CompareStandardConversionSequences()
4316 // (C++ 13.3.3.2p4): Two conversion sequences with the same rank in CompareStandardConversionSequences()
4320 // A conversion that is not a conversion of a pointer, or in CompareStandardConversionSequences()
4321 // pointer to member, to bool is better than another conversion in CompareStandardConversionSequences()
4322 // that is such a conversion. in CompareStandardConversionSequences()
4331 // A conversion that promotes an enumeration whose underlying type is fixed in CompareStandardConversionSequences()
4345 // conversion of B* to A* is better than conversion of B* to in CompareStandardConversionSequences()
4346 // void*, and conversion of A* to void* is better than conversion in CompareStandardConversionSequences()
4353 // Exactly one of the conversion sequences is a conversion to in CompareStandardConversionSequences()
4354 // a void pointer; it's the worse conversion. in CompareStandardConversionSequences()
4358 // Neither conversion sequence converts to a void pointer; compare in CompareStandardConversionSequences()
4365 // Both conversion sequences are conversions to void in CompareStandardConversionSequences()
4372 // conversion, if we need to. in CompareStandardConversionSequences()
4455 // In Microsoft mode (below 19.28), prefer an integral conversion to a in CompareStandardConversionSequences()
4456 // floating-to-integral conversion if the integral conversion in CompareStandardConversionSequences()
4475 // Prefer a compatible vector conversion over a lax vector conversion in CompareStandardConversionSequences()
4530 /// CompareQualificationConversions - Compares two standard conversion
4538 // -- S1 and S2 differ only in their qualification conversion and in CompareQualificationConversions()
4543 // deprecated string literal array-to-pointer conversion (4.2). in CompareQualificationConversions()
4545 // [...] where T1 can be converted to T2 by a qualification conversion. in CompareQualificationConversions()
4551 // conversion (!) in CompareQualificationConversions()
4566 // Don't ever prefer a standard conversion sequence that uses the deprecated in CompareQualificationConversions()
4567 // string literal array to pointer conversion. in CompareQualificationConversions()
4597 /// CompareDerivedToBaseConversions - Compares two standard conversion
4612 // conversion, if we need to. in CompareDerivedToBaseConversions()
4644 // -- conversion of C* to B* is better than conversion of C* to A*, in CompareDerivedToBaseConversions()
4652 // -- conversion of B* to A* is better than conversion of C* to A*, in CompareDerivedToBaseConversions()
4671 // Apply the same conversion ranking rules for Objective-C pointer types in CompareDerivedToBaseConversions()
4684 // A conversion to an a non-id object pointer type or qualified 'id' in CompareDerivedToBaseConversions()
4685 // type is better than a conversion to 'id'. in CompareDerivedToBaseConversions()
4693 // A conversion to a non-id object pointer type is better than a in CompareDerivedToBaseConversions()
4694 // conversion to a qualified 'id' type in CompareDerivedToBaseConversions()
4700 // A conversion to an a non-Class object pointer type or qualified 'Class' in CompareDerivedToBaseConversions()
4701 // type is better than a conversion to 'Class'. in CompareDerivedToBaseConversions()
4709 // A conversion to a non-Class object pointer type is better than a in CompareDerivedToBaseConversions()
4710 // conversion to a qualified 'Class' type. in CompareDerivedToBaseConversions()
4716 // -- "conversion of C* to B* is better than conversion of C* to A*," in CompareDerivedToBaseConversions()
4721 // "conversion of B<A> * to B * is better than conversion of B * to in CompareDerivedToBaseConversions()
4737 // -- "conversion of B* to A* is better than conversion of C* to A*," in CompareDerivedToBaseConversions()
4761 // conversion of A::* to B::* is better than conversion of A::* to C::*, in CompareDerivedToBaseConversions()
4768 // conversion of B::* to C::* is better than conversion of A::* to C::* in CompareDerivedToBaseConversions()
4778 // -- conversion of C to B is better than conversion of C to A, in CompareDerivedToBaseConversions()
4790 // -- conversion of B to A is better than conversion of C to A. in CompareDerivedToBaseConversions()
4840 // "pointer to cv1 T1" via a standard conversion sequence. in CompareReferenceRelationship()
4863 // We can have a qualification conversion. Compute whether the types are in CompareReferenceRelationship()
4871 // We will need a qualification conversion. in CompareReferenceRelationship()
4874 // Track whether we performed a qualification conversion anywhere other in CompareReferenceRelationship()
4909 /// Look for a user-defined conversion to a value reference-compatible
4937 // If we are initializing an rvalue reference, don't permit conversion in FindConversionForRefInit()
4956 // If the conversion function doesn't return a reference type, in FindConversionForRefInit()
4957 // it can't be considered for this conversion. An rvalue reference in FindConversionForRefInit()
4986 // applying a conversion function to the argument in FindConversionForRefInit()
4987 // expression, the implicit conversion sequence is a in FindConversionForRefInit()
4988 // user-defined conversion sequence (13.3.3.1.2), with the in FindConversionForRefInit()
4989 // second standard conversion sequence either an identity in FindConversionForRefInit()
4990 // conversion or, if the conversion function returns an in FindConversionForRefInit()
4992 // type, a derived-to-base Conversion. in FindConversionForRefInit()
5018 // There was no suitable conversion, or we found a deleted in FindConversionForRefInit()
5019 // conversion; continue with other checks. in FindConversionForRefInit()
5026 /// Compute an implicit conversion sequence for reference
5035 // Most paths end in a failed conversion. in TryReferenceInit()
5063 // FIXME: A reference binding can be a function conversion too. We should in TryReferenceInit()
5073 // conversion as a qualification conversion, not as an identity conversion. in TryReferenceInit()
5107 // to an argument expression, the implicit conversion sequence in TryReferenceInit()
5108 // is the identity conversion, unless the argument expression in TryReferenceInit()
5110 // in which case the implicit conversion sequence is a in TryReferenceInit()
5111 // derived-to-base Conversion (13.3.3.1). in TryReferenceInit()
5116 // computing the implicit conversion sequence (C++ in TryReferenceInit()
5125 // conversion is selected by enumerating the applicable in TryReferenceInit()
5126 // conversion functions (13.3.1.6) and choosing the best in TryReferenceInit()
5173 // expression in the first case and to the result of the conversion in TryReferenceInit()
5182 // and the second standard conversion sequence of the in TryReferenceInit()
5183 // user-defined conversion sequence includes an lvalue-to-rvalue in TryReferenceInit()
5184 // conversion, the program is ill-formed. in TryReferenceInit()
5243 // an argument expression, the conversion sequence is the one in TryReferenceInit()
5246 // 13.3.3.1. Conceptually, this conversion sequence corresponds in TryReferenceInit()
5250 // and does not constitute a conversion. in TryReferenceInit()
5273 // standard conversion sequence cannot be formed if it requires [...] in TryReferenceInit()
5326 // If the initializer list is a designated-initializer-list, a conversion in TryListConversion()
5340 // implicit conversion sequence is the one required to convert the element in TryListConversion()
5346 // implicit conversion sequence is the identity conversion. in TryListConversion()
5376 // conversion sequence is the worst conversion necessary to convert an in TryListConversion()
5383 // can be implicitly converted to X, the implicit conversion sequence is in TryListConversion()
5384 // the worst conversion necessary to convert an element of the list to X. in TryListConversion()
5444 // Keep the worse conversion seen so far. in TryListConversion()
5460 // over.ics.list/6 indicates we should compare that conversion. Again CWG in TryListConversion()
5475 // conversion sequence is a user-defined conversion sequence. If multiple in TryListConversion()
5477 // implicit conversion sequence is a user-defined conversion sequence. in TryListConversion()
5490 // initialized from the initializer list [...] the implicit conversion in TryListConversion()
5491 // sequence is a user-defined conversion sequence. in TryListConversion()
5561 "Sub-initialization cannot result in ellipsis conversion."); in TryListConversion()
5585 // initializer list, the implicit conversion sequence is the one in TryListConversion()
5593 // - if the initializer list has no elements, the implicit conversion in TryListConversion()
5594 // sequence is the identity conversion. in TryListConversion()
5606 // In all cases other than those enumerated above, no conversion is possible in TryListConversion()
5611 /// ToType from the expression From. Return the implicit conversion
5613 /// conversion sequence (meaning that the argument cannot be passed to
5615 /// do not permit any user-defined conversion sequences.
5710 // Set up the conversion sequence as a "bad" conversion, to allow us in TryObjectArgumentInitialization()
5726 // However, when finding an implicit conversion sequence for the argument, we in TryObjectArgumentInitialization()
5755 // affects the conversion rank. in TryObjectArgumentInitialization()
5920 // conversion to bool in which explicit conversions are permitted. in TryContextuallyConvertToBool()
5944 /// Check that the specified conversion is permitted in a converted constant
5945 /// expression, according to C++11 [expr.const]p3. Return true if the conversion
5950 // type, most conversion kinds are impossible. All possible First and Third in CheckConvertedConstantConversions()
5960 // Conversion from an integral or unscoped enumeration type to bool is in CheckConvertedConstantConversions()
5962 // conversion, so we allow it in a converted constant expression. in CheckConvertedConstantConversions()
6003 llvm_unreachable("found a first conversion kind in Second"); in CheckConvertedConstantConversions()
6007 llvm_unreachable("found a third conversion kind in Second"); in CheckConvertedConstantConversions()
6013 llvm_unreachable("unknown conversion kind"); in CheckConvertedConstantConversions()
6017 /// converted constant expression of type T, perform the conversion but
6033 // expression is a constant expression and the implicit conversion in BuildConvertedConstantExpression()
6064 llvm_unreachable("bad conversion in converted constant expression"); in BuildConvertedConstantExpression()
6115 // Check for a narrowing implicit conversion. in BuildConvertedConstantExpression()
6121 // Implicit conversion to a narrower type, but the expression is in BuildConvertedConstantExpression()
6124 // Implicit conversion to a narrower type, and the value is not a constant in BuildConvertedConstantExpression()
6157 /// converted constant expression of type T, perform the conversion and produce
6267 /// dropPointerConversions - If the given standard conversion sequence
6269 /// the result type of the conversion sequence.
6283 // Do an implicit conversion to 'id'. in TryContextuallyConvertToObjCPointer()
6420 CXXConversionDecl *Conversion = in diagnoseNoViableConversion() local
6424 // conversion; use it. in diagnoseNoViableConversion()
6425 QualType ConvTy = Conversion->getConversionType().getNonReferenceType(); in diagnoseNoViableConversion()
6434 Converter.noteExplicitConv(SemaRef, Conversion, ConvTy); in diagnoseNoViableConversion()
6437 // explicit conversion function. in diagnoseNoViableConversion()
6442 ExprResult Result = SemaRef.BuildCXXMemberCallExpr(From, Found, Conversion, in diagnoseNoViableConversion()
6447 // Replace the conversion with a RecoveryExpr, so we don't try to in diagnoseNoViableConversion()
6462 CXXConversionDecl *Conversion = in recordConversion() local
6466 QualType ToType = Conversion->getConversionType().getNonReferenceType(); in recordConversion()
6475 ExprResult Result = SemaRef.BuildCXXMemberCallExpr(From, Found, Conversion, in recordConversion()
6479 // Record usage of conversion in an implicit cast. in recordConversion()
6532 /// must have a single non-explicit conversion function converting to a matching
6533 /// type. In C++1y, there can be multiple such conversion functions, but only
6537 /// conversion.
6541 /// \param Converter Used to control and diagnose the conversion process.
6594 // Look for a conversion to an integral or enumeration type. in PerformContextualImplicitConversion()
6611 CXXConversionDecl *Conversion; in PerformContextualImplicitConversion() local
6615 Conversion = cast<CXXConversionDecl>(ConvTemplate->getTemplatedDecl()); in PerformContextualImplicitConversion()
6617 continue; // C++11 does not consider conversion operator templates(?). in PerformContextualImplicitConversion()
6619 Conversion = cast<CXXConversionDecl>(D); in PerformContextualImplicitConversion()
6622 "Conversion operator templates are considered potentially " in PerformContextualImplicitConversion()
6625 QualType CurToType = Conversion->getConversionType().getNonReferenceType(); in PerformContextualImplicitConversion()
6628 if (Conversion->isExplicit()) { in PerformContextualImplicitConversion()
6652 // for conversion functions whose return type is cv T or reference to in PerformContextualImplicitConversion()
6681 // Apply this conversion. in PerformContextualImplicitConversion()
6714 // Apply this conversion. in PerformContextualImplicitConversion()
6995 // Determine the implicit conversion sequences for each of the in AddOverloadCandidate()
7001 // We already formed a conversion sequence for this parameter during in AddOverloadCandidate()
7005 // exist for each argument an implicit conversion sequence in AddOverloadCandidate()
7476 // function, the implicit conversion sequence is a standard conversion in AddMethodCandidate()
7478 // conversion sequence. in AddMethodCandidate()
7485 // Determine the implicit conversion sequence for the object in AddMethodCandidate()
7517 // Determine the implicit conversion sequences for each of the in AddMethodCandidate()
7523 // We already formed a conversion sequence for this parameter during in AddMethodCandidate()
7527 // exist for each argument an implicit conversion sequence in AddMethodCandidate()
7746 // For a method call, check the 'this' conversion here too. DR1391 doesn't in CheckNonDependentConversions()
7799 /// Determine whether this is an allowable conversion from the result
7800 /// of an explicit conversion operator to the expected type, per C++
7803 /// \param ConvType The return type of the conversion function.
7807 /// \param AllowObjCPointerConversion Allow a conversion from one
7810 /// \returns true if the conversion is allowable, false otherwise.
7831 // Is this an Objective-C pointer conversion? in isAllowableExplicitConversion()
7839 CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, in AddConversionCandidate() argument
7843 assert(!Conversion->getDescribedFunctionTemplate() && in AddConversionCandidate()
7844 "Conversion function templates use AddTemplateConversionCandidate"); in AddConversionCandidate()
7845 QualType ConvType = Conversion->getConversionType().getNonReferenceType(); in AddConversionCandidate()
7846 if (!CandidateSet.isNewCandidate(Conversion)) in AddConversionCandidate()
7849 // If the conversion function has an undeduced return type, trigger its in AddConversionCandidate()
7852 if (DeduceReturnType(Conversion, From->getExprLoc())) in AddConversionCandidate()
7854 ConvType = Conversion->getConversionType().getNonReferenceType(); in AddConversionCandidate()
7857 // If we don't allow any conversion of the result type, ignore conversion in AddConversionCandidate()
7860 !Context.hasSameUnqualifiedType(Conversion->getConversionType(), ToType)) in AddConversionCandidate()
7863 // Per C++ [over.match.conv]p1, [over.match.ref]p1, an explicit conversion in AddConversionCandidate()
7865 // can be converted to the target type with a qualification conversion. in AddConversionCandidate()
7869 if (Conversion->isExplicit() && in AddConversionCandidate()
7881 Candidate.Function = Conversion; in AddConversionCandidate()
7891 if (!AllowExplicit && Conversion->isExplicit()) { in AddConversionCandidate()
7898 // For conversion functions, the function is considered to be a member of in AddConversionCandidate()
7902 // Determine the implicit conversion sequence for the implicit in AddConversionCandidate()
7912 // - the object parameter of a user-defined conversion function in AddConversionCandidate()
7913 // [...] user-defined conversion sequences are not considered. in AddConversionCandidate()
7916 From->Classify(Context), Conversion, ConversionContext, in AddConversionCandidate()
7926 if (Conversion->getTrailingRequiresClause()) { in AddConversionCandidate()
7928 if (CheckFunctionConstraints(Conversion, Satisfaction) || in AddConversionCandidate()
7936 // We won't go through a user-defined type conversion function to convert a in AddConversionCandidate()
7937 // derived to base as such conversions are given Conversion Rank. They only in AddConversionCandidate()
7949 // To determine what the conversion from the result of calling the in AddConversionCandidate()
7950 // conversion function to the type we're eventually trying to in AddConversionCandidate()
7952 // conversion function and attempt copy initialization from it. This in AddConversionCandidate()
7957 DeclRefExpr ConversionRef(Context, Conversion, false, Conversion->getType(), in AddConversionCandidate()
7960 Context.getPointerType(Conversion->getType()), in AddConversionCandidate()
7964 QualType ConversionType = Conversion->getConversionType(); in AddConversionCandidate()
7993 // If the user-defined conversion is specified by a specialization of a in AddConversionCandidate()
7994 // conversion function template, the second standard conversion sequence in AddConversionCandidate()
7996 if (Conversion->getPrimaryTemplate() && in AddConversionCandidate()
8005 // the second standard conversion sequence of the user-defined in AddConversionCandidate()
8006 // conversion sequence includes an lvalue-to-rvalue conversion, the in AddConversionCandidate()
8023 "Can only end up with a standard conversion sequence or failure"); in AddConversionCandidate()
8027 CheckEnableIf(Conversion, CandidateSet.getLocation(), std::nullopt)) { in AddConversionCandidate()
8034 if (isNonViableMultiVersionOverload(Conversion)) { in AddConversionCandidate()
8046 "Only conversion function templates permitted here"); in AddTemplateConversionCandidate()
8083 // Add the conversion function template specialization produced by in AddTemplateConversionCandidate()
8091 void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion, in AddSurrogateCandidate() argument
8098 if (!CandidateSet.isNewCandidate(Conversion)) in AddSurrogateCandidate()
8108 Candidate.Surrogate = Conversion; in AddSurrogateCandidate()
8113 // Determine the implicit conversion sequence for the implicit in AddSurrogateCandidate()
8116 if (Conversion->hasCXXExplicitFunctionObjectParameter()) { in AddSurrogateCandidate()
8118 Conversion->getParamDecl(0)->getType(), in AddSurrogateCandidate()
8124 Object->Classify(Context), Conversion, ActingContext); in AddSurrogateCandidate()
8134 // The first conversion is actually a user-defined conversion whose in AddSurrogateCandidate()
8135 // first conversion is ObjectInit's standard conversion (which is in AddSurrogateCandidate()
8141 Candidate.Conversions[0].UserDefined.ConversionFunction = Conversion; in AddSurrogateCandidate()
8168 // Determine the implicit conversion sequences for each of the in AddSurrogateCandidate()
8173 // exist for each argument an implicit conversion sequence in AddSurrogateCandidate()
8196 if (Conversion->getTrailingRequiresClause()) { in AddSurrogateCandidate()
8198 if (CheckFunctionConstraints(Conversion, Satisfaction, /*Loc*/ {}, in AddSurrogateCandidate()
8208 CheckEnableIf(Conversion, CandidateSet.getLocation(), std::nullopt)) { in AddSurrogateCandidate()
8318 // Determine the implicit conversion sequences for each of the in AddBuiltinCandidate()
8337 "Contextual conversion to bool requires bool type"); in AddBuiltinCandidate()
8562 /// AllowUserConversions is true if we should look at the conversion
8564 /// should also include the explicit conversion functions of a class
8625 // No conversion functions in incomplete types. in AddTypesConvertedFrom()
8634 // Skip conversion function templates; they don't tell us anything in AddTypesConvertedFrom()
8682 /// if any, found in visible type conversion functions found in ArgExpr's type.
10260 // like argument conversion ranks or enable_if partial-ordering. The in isBetterOverloadCandidate()
10327 // The only ill-formed conversion we allow in C++ is the string literal to in isBetterOverloadCandidate()
10328 // char* conversion, which is only considered ill-formed after C++11. in isBetterOverloadCandidate()
10354 // conversion sequence than ICSi(F2), and then... in isBetterOverloadCandidate()
10361 // Cand1 has a better conversion sequence. in isBetterOverloadCandidate()
10373 // better conversion for one argument and a worse conversion for the in isBetterOverloadCandidate()
10374 // other, the implicit conversion sequences are treated as being equally in isBetterOverloadCandidate()
10394 // -- for some argument j, ICSj(F1) is a better conversion sequence than in isBetterOverloadCandidate()
10399 // -- the context is an initialization by user-defined conversion in isBetterOverloadCandidate()
10400 // (see 8.5, 13.3.1.5) and the standard conversion sequence in isBetterOverloadCandidate()
10403 // conversion sequence than the standard conversion sequence in isBetterOverloadCandidate()
10409 // First check whether we prefer one of the conversion functions over the in isBetterOverloadCandidate()
10411 // cases such as the conversion from a lambda closure type to a function in isBetterOverloadCandidate()
10423 // FIXME: Compare kind of reference binding if conversion functions in isBetterOverloadCandidate()
10433 // a conversion function. in isBetterOverloadCandidate()
10860 assert(isa<CXXConversionDecl>(Meth) && "expected conversion"); in ClassifyOverloadCandidate()
11098 /// Diagnoses an ambiguous conversion. The partial diagnostic is the
11100 /// target types of the conversion.
11127 // There's a conversion slot for the object argument if this is a in DiagnoseBadConversion()
11129 // conversion-slot index. in DiagnoseBadConversion()
11347 // If we can fix the conversion, suggest the FixIts. in DiagnoseBadConversion()
12010 // when user-conversion overload fails. Figure out how to handle in NoteFunctionCandidate()
12266 // The conversion that can be fixed with a smaller number of changes, in operator ()()
12368 /// computes up to the first bad conversion. Produces the FixIt set if
12376 // Don't do anything on failures other than bad conversion. in CompleteNonViableCandidate()
12382 // Use a implicit copy initialization to check conversion fixes. in CompleteNonViableCandidate()
12385 // Attempt to fix the bad conversion. in CompleteNonViableCandidate()
12389 assert(ConvIdx != ConvCount && "no bad conversion in candidate"); in CompleteNonViableCandidate()
12412 // Conversion 0 is 'this', which doesn't have a corresponding parameter. in CompleteNonViableCandidate()
12419 // Conversion 0 is 'this', which doesn't have a corresponding parameter. in CompleteNonViableCandidate()
12438 assert(ArgIdx < Args.size() && "no argument for this arg conversion"); in CompleteNonViableCandidate()
12440 // We've already checked this conversion. in CompleteNonViableCandidate()
12576 // ambiguous user-defined conversion. in NoteCandidates()
14094 // Convert the expression to match the conversion function's implicit object in BuildCXXMemberCallExpr()
14107 // This is a lambda conversion to block pointer; check if the argument in BuildCXXMemberCallExpr()
14117 // For the conversion to block pointer on a lambda expression, we in BuildCXXMemberCallExpr()
14491 // Do placeholder-like conversion on the LHS; note that we should in CreateOverloadedBinOp()
14559 // better conversion for either parameter. If so, this call is in CreateOverloadedBinOp()
14900 // apply the temporary materialization conversion to the operands. in BuildSynthesizedThreeWayComparison()
15580 // the conversion operator to function pointer in BuildCallToObjectOfClassType()
15583 // conversion operator as the constraints are always the same. in BuildCallToObjectOfClassType()
15596 // In addition, for each (non-explicit in C++0x) conversion function in BuildCallToObjectOfClassType()
15599 // operator conversion-type-id () cv-qualifier; in BuildCallToObjectOfClassType()
15602 // greater cv-qualification than, cv, and where conversion-type-id in BuildCallToObjectOfClassType()
15609 // functions for each conversion function declared in an in BuildCallToObjectOfClassType()
15621 // Skip over templated conversion functions; they aren't in BuildCallToObjectOfClassType()
15699 // surrogate candidates. Dig out the conversion function. in BuildCallToObjectOfClassType()
15709 "Found Decl & conversion-to-functionptr should be same, right?!"); in BuildCallToObjectOfClassType()
15711 // object parameter to a function pointer. Perform the conversion in BuildCallToObjectOfClassType()
15714 // Create an implicit member expr to refer to the conversion operator. in BuildCallToObjectOfClassType()
15720 // Record usage of conversion in an implicit cast. in BuildCallToObjectOfClassType()
16097 assert(ICE->path_empty() && "fixing up hierarchy conversion?"); in FixOverloadedFunctionReference()