clang API Documentation
#include "clang/Sema/SemaInternal.h"#include "clang/AST/ASTContext.h"#include "clang/AST/CXXInheritance.h"#include "clang/AST/ExprCXX.h"#include "clang/AST/ExprObjC.h"#include "clang/AST/RecordLayout.h"#include "clang/Basic/PartialDiagnostic.h"#include "clang/Basic/TargetInfo.h"#include "clang/Sema/Initialization.h"#include "llvm/ADT/SmallVector.h"#include <set>
Go to the source code of this file.
Enumerations | |
| enum | TryCastResult { TC_NotApplicable, TC_Success, TC_Failed } |
| enum | CastType { CT_Const, CT_Static, CT_Reinterpret, CT_Dynamic, CT_CStyle, CT_Functional } |
Functions | |
| static bool | CastsAwayConstness (Sema &Self, QualType SrcType, QualType DestType, bool CheckCVR, bool CheckObjCLifetime) |
| static TryCastResult | TryLValueToRValueCast (Sema &Self, Expr *SrcExpr, QualType DestType, bool CStyle, CastKind &Kind, CXXCastPath &BasePath, unsigned &msg) |
| Tests whether a conversion according to N2844 is valid. | |
| static TryCastResult | TryStaticReferenceDowncast (Sema &Self, Expr *SrcExpr, QualType DestType, bool CStyle, const SourceRange &OpRange, unsigned &msg, CastKind &Kind, CXXCastPath &BasePath) |
| Tests whether a conversion according to C++ 5.2.9p5 is valid. | |
| static TryCastResult | TryStaticPointerDowncast (Sema &Self, QualType SrcType, QualType DestType, bool CStyle, const SourceRange &OpRange, unsigned &msg, CastKind &Kind, CXXCastPath &BasePath) |
| Tests whether a conversion according to C++ 5.2.9p8 is valid. | |
| static TryCastResult | TryStaticDowncast (Sema &Self, CanQualType SrcType, CanQualType DestType, bool CStyle, const SourceRange &OpRange, QualType OrigSrcType, QualType OrigDestType, unsigned &msg, CastKind &Kind, CXXCastPath &BasePath) |
| static TryCastResult | TryStaticMemberPointerUpcast (Sema &Self, ExprResult &SrcExpr, QualType SrcType, QualType DestType, bool CStyle, const SourceRange &OpRange, unsigned &msg, CastKind &Kind, CXXCastPath &BasePath) |
| static TryCastResult | TryStaticImplicitCast (Sema &Self, ExprResult &SrcExpr, QualType DestType, Sema::CheckedConversionKind CCK, const SourceRange &OpRange, unsigned &msg, CastKind &Kind, bool ListInitialization) |
| static TryCastResult | TryStaticCast (Sema &Self, ExprResult &SrcExpr, QualType DestType, Sema::CheckedConversionKind CCK, const SourceRange &OpRange, unsigned &msg, CastKind &Kind, CXXCastPath &BasePath, bool ListInitialization) |
| static TryCastResult | TryConstCast (Sema &Self, ExprResult &SrcExpr, QualType DestType, bool CStyle, unsigned &msg) |
| static TryCastResult | TryReinterpretCast (Sema &Self, ExprResult &SrcExpr, QualType DestType, bool CStyle, const SourceRange &OpRange, unsigned &msg, CastKind &Kind) |
| static bool | tryDiagnoseOverloadedCast (Sema &S, CastType CT, SourceRange range, Expr *src, QualType destType, bool listInitialization) |
| static void | diagnoseBadCast (Sema &S, unsigned msg, CastType castType, SourceRange opRange, Expr *src, QualType destType, bool listInitialization) |
| Diagnose a failed cast. | |
| static bool | UnwrapDissimilarPointerTypes (QualType &T1, QualType &T2) |
| static void | DiagnoseReinterpretUpDownCast (Sema &Self, const Expr *SrcExpr, QualType DestType, SourceRange OpRange) |
| static void | DiagnoseCastOfObjCSEL (Sema &Self, const ExprResult &SrcExpr, QualType DestType) |
| static void | checkIntToPointerCast (bool CStyle, SourceLocation Loc, const Expr *SrcExpr, QualType DestType, Sema &Self) |
| static void | DiagnoseBadFunctionCast (Sema &Self, const ExprResult &SrcExpr, QualType DestType) |
| enum CastType |
| CT_Const |
const_cast |
| CT_Static |
static_cast |
| CT_Reinterpret |
reinterpret_cast |
| CT_Dynamic |
dynamic_cast |
| CT_CStyle |
(Type)expr |
| CT_Functional |
Type(expr) |
Definition at line 39 of file SemaCast.cpp.
| enum TryCastResult |
| TC_NotApplicable |
The cast method is not applicable. |
| TC_Success |
The cast method is appropriate and successful. |
| TC_Failed |
The cast method is appropriate, but failed. A diagnostic has been emitted. |
Definition at line 32 of file SemaCast.cpp.
| static bool CastsAwayConstness | ( | Sema & | Self, |
| QualType | SrcType, | ||
| QualType | DestType, | ||
| bool | CheckCVR, | ||
| bool | CheckObjCLifetime | ||
| ) | [static] |
CastsAwayConstness - Check if the pointer conversion from SrcType to DestType casts away constness as defined in C++ 5.2.11p8ff. This is used by the cast checkers. Both arguments must denote pointer (possibly to member) types.
| CheckCVR | Whether to check for const/volatile/restrict qualifiers. |
| CheckObjCLifetime | Whether to check Objective-C lifetime qualifiers. |
Definition at line 464 of file SemaCast.cpp.
References clang::Qualifiers::compatiblyIncludesObjCLifetime(), clang::Sema::Context, Context, clang::ASTContext::getCanonicalType(), clang::Qualifiers::getCVRQualifiers(), clang::ASTContext::getLangOpts(), clang::ASTContext::getPointerType(), clang::ASTContext::getQualifiedType(), clang::ASTContext::getUnqualifiedArrayType(), clang::Type::isAnyPointerType(), clang::Type::isBlockPointerType(), clang::Type::isMemberPointerType(), clang::Sema::IsQualificationConversion(), clang::Qualifiers::setCVRQualifiers(), UnwrapDissimilarPointerTypes(), and clang::ASTContext::VoidTy.
Referenced by TryReinterpretCast().
| static void checkIntToPointerCast | ( | bool | CStyle, |
| SourceLocation | Loc, | ||
| const Expr * | SrcExpr, | ||
| QualType | DestType, | ||
| Sema & | Self | ||
| ) | [static] |
Definition at line 1677 of file SemaCast.cpp.
References clang::Sema::Context, Diag(), clang::Sema::Diag(), clang::Expr::getType(), clang::ASTContext::getTypeSize(), clang::Type::isBooleanType(), clang::Type::isEnumeralType(), clang::Expr::isIntegerConstantExpr(), clang::Type::isIntegralType(), and clang::Type::isVoidPointerType().
Referenced by TryReinterpretCast().
| static void diagnoseBadCast | ( | Sema & | S, |
| unsigned | msg, | ||
| CastType | castType, | ||
| SourceRange | opRange, | ||
| Expr * | src, | ||
| QualType | destType, | ||
| bool | listInitialization | ||
| ) | [static] |
Diagnose a failed cast.
Definition at line 387 of file SemaCast.cpp.
References clang::Sema::Diag(), clang::SourceRange::getBegin(), clang::Stmt::getSourceRange(), clang::Expr::getType(), and tryDiagnoseOverloadedCast().
| static void DiagnoseBadFunctionCast | ( | Sema & | Self, |
| const ExprResult & | SrcExpr, | ||
| QualType | DestType | ||
| ) | [static] |
DiagnoseBadFunctionCast - Warn whenever a function call is cast to a non-matching type. Such as enum function call to int, int call to pointer; etc. Cast to 'void' is an exception.
Definition at line 2134 of file SemaCast.cpp.
References clang::Sema::Diag(), clang::Sema::Diags, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Expr::getExprLoc(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), clang::Type::isAnyPointerType(), clang::Type::isBlockPointerType(), clang::Type::isBooleanType(), clang::Type::isComplexIntegerType(), clang::Type::isComplexType(), clang::Type::isEnumeralType(), clang::DiagnosticsEngine::isIgnored(), clang::Type::isIntegerType(), clang::Type::isRealFloatingType(), and clang::Type::isVoidType().
| static void DiagnoseCastOfObjCSEL | ( | Sema & | Self, |
| const ExprResult & | SrcExpr, | ||
| QualType | DestType | ||
| ) | [static] |
Definition at line 1660 of file SemaCast.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAs(), clang::Expr::getExprLoc(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), clang::ASTContext::hasSameType(), and clang::Type::isVoidType().
Referenced by TryReinterpretCast().
| static void DiagnoseReinterpretUpDownCast | ( | Sema & | Self, |
| const Expr * | SrcExpr, | ||
| QualType | DestType, | ||
| SourceRange | OpRange | ||
| ) | [static] |
Check that a reinterpret_cast<DestType>(SrcExpr) is not used as upcast or downcast between respective pointers or references.
Definition at line 715 of file SemaCast.cpp.
References clang::CXXBasePaths::begin(), clang::Sema::Context, clang::FixItHint::CreateReplacement(), clang::Sema::Diag(), clang::CXXBasePaths::end(), clang::Type::getAsCXXRecordDecl(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), clang::SourceRange::getBegin(), clang::CXXRecordDecl::getDefinition(), clang::Type::getPointeeCXXRecordDecl(), clang::Expr::getType(), clang::TagDecl::isCompleteDefinition(), clang::CXXRecordDecl::isDerivedFrom(), clang::Decl::isInvalidDecl(), clang::CharUnits::isZero(), and clang::CharUnits::Zero().
| static TryCastResult TryConstCast | ( | Sema & | Self, |
| ExprResult & | SrcExpr, | ||
| QualType | DestType, | ||
| bool | CStyle, | ||
| unsigned & | msg | ||
| ) | [static] |
TryConstCast - See if a const_cast from source to destination is allowed, and perform it if it is.
Definition at line 1493 of file SemaCast.cpp.
References clang::Sema::Context, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::ASTContext::getPointerType(), clang::Expr::getType(), clang::ASTContext::getUnqualifiedArrayType(), clang::Type::isFunctionPointerType(), clang::Expr::isLValue(), clang::Type::isMemberFunctionPointerType(), clang::Type::isMemberPointerType(), clang::Type::isObjCObjectPointerType(), clang::Type::isPointerType(), clang::Type::isRecordType(), clang::Expr::isRValue(), clang::Expr::refersToBitField(), clang::Qualifiers::removeCVRQualifiers(), TC_NotApplicable, TC_Success, and clang::ASTContext::UnwrapSimilarPointerTypes().
| static bool tryDiagnoseOverloadedCast | ( | Sema & | S, |
| CastType | CT, | ||
| SourceRange | range, | ||
| Expr * | src, | ||
| QualType | destType, | ||
| bool | listInitialization | ||
| ) | [static] |
Try to diagnose a failed overloaded cast. Returns true if diagnostics were emitted.
Definition at line 311 of file SemaCast.cpp.
References clang::InitializationKind::CreateCast(), clang::InitializationKind::CreateCStyleCast(), clang::InitializationKind::CreateFunctionalCast(), CT_Const, CT_CStyle, CT_Dynamic, CT_Functional, CT_Reinterpret, CT_Static, clang::Sema::Diag(), clang::OverloadCandidateSet::empty(), clang::InitializationSequence::Failed(), clang::InitializationSequence::FK_ConstructorOverloadFailed, clang::InitializationSequence::FK_UserConversionOverloadFailed, clang::SourceRange::getBegin(), clang::InitializationSequence::getFailedCandidateSet(), clang::InitializationSequence::getFailedOverloadResult(), clang::InitializationSequence::getFailureKind(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::InitializedEntity::InitializeTemporary(), clang::Type::isRecordType(), clang::OverloadCandidateSet::NoteCandidates(), clang::OCD_AllCandidates, clang::OCD_ViableCandidates, clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, and clang::OR_Success.
Referenced by diagnoseBadCast().
| TryCastResult TryLValueToRValueCast | ( | Sema & | Self, |
| Expr * | SrcExpr, | ||
| QualType | DestType, | ||
| bool | CStyle, | ||
| CastKind & | Kind, | ||
| CXXCastPath & | BasePath, | ||
| unsigned & | msg | ||
| ) | [static] |
Tests whether a conversion according to N2844 is valid.
Definition at line 1087 of file SemaCast.cpp.
References clang::Sema::BuildBasePathArray(), clang::CK_DerivedToBase, clang::CK_NoOp, clang::Sema::CompareReferenceRelationship(), clang::Type::getAs(), clang::Stmt::getLocStart(), clang::ReferenceType::getPointeeType(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), clang::Sema::IsDerivedFrom(), clang::Expr::isGLValue(), clang::Sema::Ref_Compatible_With_Added_Qualification, TC_Failed, TC_NotApplicable, and TC_Success.
Referenced by TryStaticCast().
| static TryCastResult TryReinterpretCast | ( | Sema & | Self, |
| ExprResult & | SrcExpr, | ||
| QualType | DestType, | ||
| bool | CStyle, | ||
| const SourceRange & | OpRange, | ||
| unsigned & | msg, | ||
| CastKind & | Kind | ||
| ) | [static] |
Definition at line 1703 of file SemaCast.cpp.
References CastsAwayConstness(), clang::Sema::CheckCompatibleReinterpretCast(), checkIntToPointerCast(), clang::CK_AnyPointerToBlockPointerCast, clang::CK_BitCast, clang::CK_IntegralToPointer, clang::CK_LValueBitCast, clang::CK_NoOp, clang::CK_PointerToIntegral, clang::CK_ReinterpretMemberPointer, clang::Sema::Context, clang::Sema::Diag(), DiagnoseCastOfObjCSEL(), clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAs(), clang::SourceRange::getBegin(), clang::ASTContext::getCanonicalType(), clang::TargetInfo::getCXXABI(), clang::Sema::getLangOpts(), clang::Expr::getObjectKind(), clang::MemberPointerType::getPointeeType(), clang::ASTContext::getPointerType(), clang::Stmt::getSourceRange(), clang::ASTContext::getTargetInfo(), clang::Expr::getType(), clang::ASTContext::getTypeSize(), clang::Expr::getValueKindForType(), clang::Type::isAnyPointerType(), clang::Type::isBlockPointerType(), clang::Type::isBooleanType(), clang::Type::isFunctionPointerType(), clang::Type::isFunctionType(), clang::Expr::isGLValue(), clang::Type::isIntegralOrEnumerationType(), clang::Type::isIntegralType(), clang::Type::isMemberPointerType(), clang::TargetCXXABI::isMicrosoft(), clang::Type::isNullPtrType(), clang::Type::isObjCObjectPointerType(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::Type::isVectorType(), clang::OK_BitField, clang::OK_ObjCProperty, clang::OK_ObjCSubscript, clang::OK_Ordinary, clang::OK_VectorComponent, clang::ASTContext::OverloadTy, clang::Sema::PrepareCastToObjCObjectPointer(), clang::Sema::RequireCompleteType(), clang::Sema::ResolveAndFixSingleFunctionTemplateSpecialization(), TC_Failed, TC_NotApplicable, TC_Success, and clang::VK_RValue.
| static TryCastResult TryStaticCast | ( | Sema & | Self, |
| ExprResult & | SrcExpr, | ||
| QualType | DestType, | ||
| Sema::CheckedConversionKind | CCK, | ||
| const SourceRange & | OpRange, | ||
| unsigned & | msg, | ||
| CastKind & | Kind, | ||
| CXXCastPath & | BasePath, | ||
| bool | ListInitialization | ||
| ) | [static] |
TryStaticCast - Check if a static cast can be performed, and do so if possible. If CStyle, ignore access restrictions on hierarchy casting and casting away constness.
Definition at line 914 of file SemaCast.cpp.
References clang::Sema::CCK_CStyleCast, clang::Sema::CCK_FunctionalCast, clang::Sema::CheckTollFreeBridgeStaticCast(), clang::CK_AnyPointerToBlockPointerCast, clang::CK_BitCast, clang::CK_CPointerToObjCPointerCast, clang::CK_FloatingToIntegral, clang::CK_IntegralCast, clang::CK_IntegralToBoolean, clang::CK_IntegralToFloating, clang::Qualifiers::compatiblyIncludes(), clang::Sema::Context, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::Type::getPointeeType(), clang::PointerType::getPointeeType(), clang::QualType::getQualifiers(), clang::Expr::getType(), clang::Type::isBlockPointerType(), clang::Type::isBooleanType(), clang::Type::isEnumeralType(), clang::Type::isIncompleteOrObjectType(), clang::Type::isIntegralOrEnumerationType(), clang::Type::isIntegralType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Type::isObjCObjectPointerType(), clang::Type::isRealFloatingType(), clang::Type::isVoidType(), clang::Qualifiers::removeObjCGCAttr(), clang::Qualifiers::removeObjCLifetime(), TC_Failed, TC_NotApplicable, TC_Success, TryLValueToRValueCast(), TryStaticImplicitCast(), TryStaticMemberPointerUpcast(), TryStaticPointerDowncast(), and TryStaticReferenceDowncast().
| TryCastResult TryStaticDowncast | ( | Sema & | Self, |
| CanQualType | SrcType, | ||
| CanQualType | DestType, | ||
| bool | CStyle, | ||
| const SourceRange & | OpRange, | ||
| QualType | OrigSrcType, | ||
| QualType | OrigDestType, | ||
| unsigned & | msg, | ||
| CastKind & | Kind, | ||
| CXXCastPath & | BasePath | ||
| ) | [static] |
TryStaticDowncast - Common functionality of TryStaticReferenceDowncast and TryStaticPointerDowncast. Tests whether a static downcast from SrcType to DestType is possible and allowed.
Definition at line 1210 of file SemaCast.cpp.
References clang::Sema::AR_accessible, clang::Sema::AR_delayed, clang::Sema::AR_dependent, clang::Sema::AR_inaccessible, clang::CXXBasePaths::begin(), clang::Sema::BuildBasePathArray(), clang::Sema::CheckBaseClassAccess(), clang::CK_BaseToDerived, clang::CXXBasePaths::clear(), clang::Sema::Diag(), clang::CXXBasePaths::end(), clang::CXXBasePaths::front(), clang::CanQual< T >::getAs(), clang::QualType::getAsString(), clang::SourceRange::getBegin(), clang::CXXBasePaths::getDetectedVirtual(), clang::CanQual< T >::getUnqualifiedType(), clang::QualType::getUnqualifiedType(), clang::CXXBasePaths::isAmbiguous(), clang::CanQual< T >::isAtLeastAsQualifiedAs(), clang::Sema::IsDerivedFrom(), clang::CXXBasePaths::isRecordingPaths(), clang::Sema::RequireCompleteType(), clang::CXXBasePaths::setRecordingPaths(), TC_Failed, TC_NotApplicable, and TC_Success.
Referenced by TryStaticPointerDowncast(), and TryStaticReferenceDowncast().
| TryCastResult TryStaticImplicitCast | ( | Sema & | Self, |
| ExprResult & | SrcExpr, | ||
| QualType | DestType, | ||
| Sema::CheckedConversionKind | CCK, | ||
| const SourceRange & | OpRange, | ||
| unsigned & | msg, | ||
| CastKind & | Kind, | ||
| bool | ListInitialization | ||
| ) | [static] |
TryStaticImplicitCast - Tests whether a conversion according to C++ 5.2.9p2 is valid:
An expression e can be explicitly converted to a type T using a static_cast if the declaration "T t(e);" is well-formed [...].
Definition at line 1437 of file SemaCast.cpp.
References clang::Sema::CCK_CStyleCast, clang::Sema::CCK_FunctionalCast, clang::CK_ConstructorConversion, clang::CK_NoOp, clang::Sema::Context, clang::InitializationKind::CreateCast(), clang::InitializationKind::CreateCStyleCast(), clang::InitializationKind::CreateFunctionalCast(), clang::InitializationSequence::Failed(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::SourceRange::getBegin(), clang::TargetInfo::getCXXABI(), clang::ASTContext::getTargetInfo(), clang::InitializedEntity::InitializeTemporary(), clang::InitializationSequence::isConstructorInitialization(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Type::isMemberPointerType(), clang::TargetCXXABI::isMicrosoft(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::InitializationSequence::Perform(), clang::Sema::RequireCompleteType(), clang::Sema::RequireNonAbstractType(), TC_Failed, TC_NotApplicable, and TC_Success.
Referenced by TryStaticCast().
| TryCastResult TryStaticMemberPointerUpcast | ( | Sema & | Self, |
| ExprResult & | SrcExpr, | ||
| QualType | SrcType, | ||
| QualType | DestType, | ||
| bool | CStyle, | ||
| const SourceRange & | OpRange, | ||
| unsigned & | msg, | ||
| CastKind & | Kind, | ||
| CXXCastPath & | BasePath | ||
| ) | [static] |
TryStaticMemberPointerUpcast - Tests whether a conversion according to C++ 5.2.9p9 is valid:
An rvalue of type "pointer to member of D of type cv1 T" can be converted to an rvalue of type "pointer to member of B of type cv2 T", where B is a base class of D [...].
Definition at line 1325 of file SemaCast.cpp.
References clang::Sema::AR_accessible, clang::Sema::AR_delayed, clang::Sema::AR_dependent, clang::Sema::AR_inaccessible, clang::Sema::BuildBasePathArray(), clang::Sema::CheckBaseClassAccess(), clang::CK_DerivedToBaseMemberPointer, clang::Sema::Context, clang::Sema::Diag(), clang::Sema::FixOverloadedFunctionReference(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Sema::getAmbiguousPathsDisplayString(), clang::Type::getAs(), clang::SourceRange::getBegin(), clang::ASTContext::getCanonicalType(), clang::MemberPointerType::getClass(), clang::ASTContext::getMemberPointerType(), clang::CXXMethodDecl::getParent(), clang::MemberPointerType::getPointeeType(), clang::Expr::getType(), clang::ASTContext::getTypeDeclType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Sema::IsDerivedFrom(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::ASTContext::OverloadTy, clang::Sema::RequireCompleteType(), clang::Sema::ResolveAddressOfOverloadedFunction(), TC_Failed, TC_NotApplicable, and TC_Success.
Referenced by TryStaticCast().
| TryCastResult TryStaticPointerDowncast | ( | Sema & | Self, |
| QualType | SrcType, | ||
| QualType | DestType, | ||
| bool | CStyle, | ||
| const SourceRange & | OpRange, | ||
| unsigned & | msg, | ||
| CastKind & | Kind, | ||
| CXXCastPath & | BasePath | ||
| ) | [static] |
Tests whether a conversion according to C++ 5.2.9p8 is valid.
Definition at line 1176 of file SemaCast.cpp.
References clang::Sema::Context, clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::PointerType::getPointeeType(), TC_NotApplicable, and TryStaticDowncast().
Referenced by TryStaticCast().
| TryCastResult TryStaticReferenceDowncast | ( | Sema & | Self, |
| Expr * | SrcExpr, | ||
| QualType | DestType, | ||
| bool | CStyle, | ||
| const SourceRange & | OpRange, | ||
| unsigned & | msg, | ||
| CastKind & | Kind, | ||
| CXXCastPath & | BasePath | ||
| ) | [static] |
Tests whether a conversion according to C++ 5.2.9p5 is valid.
Definition at line 1138 of file SemaCast.cpp.
References clang::Sema::Context, clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::ReferenceType::getPointeeType(), clang::Expr::getType(), clang::Expr::isLValue(), clang::Type::isRValueReferenceType(), TC_NotApplicable, and TryStaticDowncast().
Referenced by TryStaticCast().
| static bool UnwrapDissimilarPointerTypes | ( | QualType & | T1, |
| QualType & | T2 | ||
| ) | [static] |
UnwrapDissimilarPointerTypes - Like Sema::UnwrapSimilarPointerTypes, this removes one level of indirection from both types, provided that they're the same kind of pointer (plain or to-member). Unlike the Sema function, this one doesn't care if the two pointers-to-member don't point into the same class. This is because CastsAwayConstness doesn't care.
Definition at line 404 of file SemaCast.cpp.
References clang::Type::getAs(), clang::Type::getPointeeType(), clang::PointerType::getPointeeType(), clang::BlockPointerType::getPointeeType(), clang::MemberPointerType::getPointeeType(), and clang::ObjCObjectPointerType::getPointeeType().
Referenced by CastsAwayConstness().