Lines Matching defs:To
96 // Walk down from the CE to the OrigSrcExpr, and mark all immediate
120 /// Try to handle the given placeholder expression kind. Return
196 // arguments, they return TC_NotApplicable and *may* set diag to a diagnostic
197 // to emit if no other way succeeds. If their way of casting is appropriate but
198 // fails, they return TC_Failed and *must* set diag; they can set it to 0 if
405 /// Try to diagnose a failed overloaded cast. Returns true if
495 // Detect if both types are (ptr to) class, and note any incompleteness.
502 QualType To = src->getType();
503 if (auto Ptr = To->getAs<PointerType>()) {
504 To = Ptr->getPointeeType();
509 auto RecTo = To->getAs<RecordType>();
533 /// a pointer-to-member.
546 /// so that its qualifiers can be directly compared to those of T2 (which will
574 // case, so there is no corresponding "reference to" in T1 to remove.) This
575 // simulates removing a "pointer to" from both sides.
598 // T2 is considered to correspond to T1. Decompose down to the element
622 /// Check if the pointer conversion from SrcType to DestType casts away
624 /// checkers. Both arguments must denote pointer (possibly to member) types.
626 /// \param CheckCVR Whether to check for const/volatile/restrict qualifiers.
627 /// \param CheckObjCLifetime Whether to check Objective-C lifetime qualifiers.
635 // and we're not in ObjC mode, there's nothing to check.
642 "Source type is not pointer or pointer to member.");
645 "Destination type is not pointer or pointer to member.");
660 // Track the worst kind of unwrap we needed to do before we found a
708 // where things start to go wrong.
745 /// Refer to C++ 5.2.7 for details. Dynamic casts are used mostly for runtime-
760 // C++ 5.2.7p1: T shall be a pointer or reference to a complete class type,
761 // or "pointer to cv void".
779 assert(DestPointer && "Reference to void is not possible");
794 // C++0x 5.2.7p2: If T is a pointer type, v shall be an rvalue of a pointer to
816 // If we're dynamic_casting from a prvalue to an rvalue reference, we need
817 // to materialize the prvalue before we bind the reference to it.
885 // As an exception, dynamic_cast to void* is available because it doesn't
910 /// Refer to C++ 5.2.11 for details. const_cast is typically used in code
1125 /// Refer to C++ 5.2.10 for details. reinterpret_cast is typically used in code
1171 /// Refer to C++ 5.2.9 for details. Static casts are mostly used for making
1190 // a non-lvalue-reference target type does not lead to decay.
1191 // C++ 5.2.9p4: Any expression can be explicitly converted to type "cv void".
1197 false, // Decay Function to ptr
1278 // DR 427 specifies that the downcast is to be applied here.
1280 // C++ 5.2.9p4: Any expression can be explicitly converted to type "cv void".
1287 // DR 427 specifies that this is to be applied before paragraph 2.
1294 // A glvalue of type "cv1 T1" can be cast to type "rvalue reference to cv2
1301 // C++ 5.2.9p2: An expression e can be explicitly converted to a type T
1311 // lvalue-to-rvalue, array-to-pointer, function-to-pointer, and boolean
1312 // conversions, subject to further restrictions.
1315 // In the CStyle case, the earlier attempt to const_cast should have taken
1321 // converted to an integral type. [...] A value of a scoped enumeration type
1322 // can also be explicitly converted to a floating-point type [...].
1354 // type, the value is first converted to that type by integral conversion
1382 // Reverse pointer conversion to void*. C++ 4.10.p2 specifies conversion to
1392 // to a qualifier violation. Note that we permit Objective-C lifetime
1413 // Microsoft permits static_cast from 'pointer-to-void' to
1414 // 'pointer-to-function'.
1429 // allow c-style cast of void * to block pointers.
1441 // Allow ns-pointer to cf-pointer conversion in either direction
1447 // See if it looks like the user is trying to convert between
1459 /// Tests whether a conversion according to N2844 is valid.
1465 // A glvalue of type "cv1 T1" can be cast to type "rvalue reference to
1491 // we can provide better diagnostics. In these cases forwarding to
1513 /// Tests whether a conversion according to C++ 5.2.9p5 is valid.
1520 // cast to type "reference to cv2 D", where D is a class derived from B,
1521 // if a valid standard conversion from "pointer to D" to "pointer to B"
1524 // current context. Although the wording of DR54 only applies to the pointer
1525 // variant of this rule, the intent is clearly for it to apply to the this
1551 /// Tests whether a conversion according to C++ 5.2.9p8 is valid.
1557 // C++ 5.2.9p8: An rvalue of type "pointer to cv1 B", where B is a class
1558 // type, can be converted to an rvalue of type "pointer to cv2 D", where D
1560 // to D" to "pointer to B" exists, cv2 >= cv1, and B is not a virtual base
1584 /// TryStaticPointerDowncast. Tests whether a static downcast from SrcType to
1622 // mean more complex code if we're to preserve the nice error message.
1623 // FIXME: Being 100% compliant here would be nice to have.
1632 // This code is analoguous to that in CheckDerivedToBaseConversion, except
1634 // To sum up: record all paths to the base and build a nice string from
1635 // them. Use it to spice up the error message.
1645 // We haven't displayed a path to this particular base
1691 /// TryStaticMemberPointerUpcast - Tests whether a conversion according to
1694 /// An rvalue of type "pointer to member of D of type cv1 T" can be
1695 /// converted to an rvalue of type "pointer to member of B of type cv2 T",
1811 /// TryStaticImplicitCast - Tests whether a conversion according to C++ 5.2.9p2
1814 /// An expression e can be explicitly converted to a type T using a
1846 // or the expression is an overload expression this has to work.
1870 /// TryConstCast - See if a const_cast from source to destination is allowed,
1881 // if a pointer to T1 can be explicitly converted to the type "pointer to
1884 // -- an lvalue of type T1 can be explicitly converted to an lvalue of
1886 // -- a glvalue of type T1 can be explicitly converted to an xvalue of
1889 // converted to an xvalue of type T2 using the cast const_cast<T2&&>.
1892 // Cannot const_cast non-lvalue to lvalue reference type. But if this
1894 // message and tell the parent to keep searching.
1901 // Cannot const_cast non-class prvalue to rvalue reference type. But if
1908 // reference to it.
1926 // C++ 5.2.11p5: For a const_cast involving pointers to data members [...]
1932 // Cannot cast to non-pointer, non-reference type. Note that, if DestType
1933 // was a reference type, we converted it to a pointer above.
1935 // conversion to them is simply invalid.
1954 // We only allow a const_cast to change cvr-qualifiers, not other kinds of
1961 // This is a const_cast from a class prvalue to an rvalue reference type.
1962 // Materialize a temporary to store the result of the conversion.
2042 /// Diagnose casts that change the calling convention of a pointer to a function
2061 // We have a calling convention cast. Check if the source is a pointer to a
2074 // Only warn if we are casting from the default convention to a non-default
2075 // convention. This can happen when the programmer forgot to apply the calling
2076 // convention to the function declaration and then inserted this cast to
2095 // Try to suggest a fixit to change the calling convention of the function
2096 // whose address was taken. Try to use the latest macro for the convention.
2097 // For example, users probably want to write "WINAPI" instead of "__stdcall"
2098 // to match the Windows header declarations.
2139 // Feel free to modify them if you've reason/evidence for an alternative.
2146 // Separate between casts to void* and non-void* pointers.
2149 // Having a separate warning flag allows users to control the warning
2161 // - it is a template with explicit arguments that resolves to an lvalue
2171 Expr::getValueKindForType(DestType) == VK_RValue // Convert Fun to Ptr
2209 // Cannot cast non-glvalue to (lvalue or rvalue) reference type. See the
2261 // C++ 5.2.10p9: An rvalue of type "pointer to member of X of type T1"
2262 // can be explicitly converted to an rvalue of type "pointer to member
2270 // We need to determine the inheritance model that the class will use if
2300 // C++0x 5.2.10p4: A pointer can be explicitly converted to any integral
2301 // type large enough to hold it. A value of std::nullptr_t can be
2302 // converted to an integral type; the conversion has the same meaning
2303 // and validity as a conversion of (void*)0 to the integral type.
2331 // The size we want to consider is eltCount * eltSize.
2360 // C++ 5.2.10p2 has a note that mentions that, subject to all other
2361 // restrictions, a cast to the same type is allowed so long as it does not
2363 // since all other paragraphs explicitly forbid casts to the same type.
2367 // pointer-to-member types. We also won't restrict Obj-C pointers either.
2391 // C++ 5.2.10p4: A pointer can be explicitly converted to any integral
2392 // type large enough to hold it; except in Microsoft mode, where the
2416 // converted to a pointer.
2418 // necessarily converted to a null pointer value.]
2464 // Any pointer can be cast to an Objective-C pointer type with a C-style
2479 // C++ 5.2.10p6: A pointer to a function can be explicitly converted to
2480 // a pointer to a function of a different type.
2484 // C++0x 5.2.10p8: Converting a pointer to a function into a pointer to
2524 // C++ 5.2.10p7: A pointer to an object can be explicitly converted to
2525 // a pointer to an object of different type.
2527 // So we finish by allowing everything that remains - it's got to be two
2537 // spaces at the moment we have to be permissive here.
2539 // Even though the logic below is general enough and can be applied to
2543 // FIXME: Should this be generalized to references? The reference parameter
2545 // Perhaps this is the right behavior though according to C++.
2574 // In OpenCL only conversions between pointers to objects in overlapping
2579 // addrspaces (such as 'generic int *' to 'local int *' or vice versa), but
2635 // C++ 5.2.9p4: Any expression can be explicitly converted to type "cv void".
2637 // a non-lvalue-reference target type does not lead to decay.
2643 SrcExpr, /* Decay Function to ptr */ false,
2743 // If DestType is a function type (not to be confused with the function
2744 // pointer type), it will be possible to resolve the function address,
2771 /// DiagnoseBadFunctionCast - Warn whenever a function call is cast to a
2772 /// non-matching type. Such as enum function call to int, int call to
2773 /// pointer; etc. Cast to 'void' is an exception.
2821 // C99 6.5.4p2: the cast type needs to be void or scalar and the expression
2822 // type needs to be scalar.
2824 // We don't necessarily do lvalue-to-rvalue conversions on this.
2829 // Cast to void allows any expr type.
2845 // Overloads are allowed with C extensions, so we need to support them.
2872 // Allow casting a sizeless built-in type to itself.
2891 // GCC struct/union extension: allow cast to self.
2898 // GCC's cast to union extension.
2914 // OpenCL v2.0 s6.13.10 - Allow casts from '0' to event_t type.
2931 // Reject any other conversions to non-scalar types.
2938 // The type we're casting to is known to be a scalar, a vector, or a matrix.
2940 // Require the operand to be a scalar, a vector, or a matrix.
2989 // Can't cast to or from bfloat
3003 // If either type is a pointer, the other type has to be either an
3028 // C 6.3.2.3p6: Any pointer type may be converted to an integer type.