diff options
Diffstat (limited to 'include/clang/Sema')
-rw-r--r-- | include/clang/Sema/Initialization.h | 13 | ||||
-rw-r--r-- | include/clang/Sema/Sema.h | 28 |
2 files changed, 27 insertions, 14 deletions
diff --git a/include/clang/Sema/Initialization.h b/include/clang/Sema/Initialization.h index 99bed038f1..f5901d48cb 100644 --- a/include/clang/Sema/Initialization.h +++ b/include/clang/Sema/Initialization.h @@ -340,7 +340,7 @@ private: SIK_Default = IK_Default, ///< Default initialization SIK_Value = IK_Value, ///< Value initialization SIK_ImplicitValue, ///< Implicit value initialization - SIK_DirectCast, ///< Direct initialization due to a cast + SIK_DirectStaticCast, ///< Direct initialization due to a static cast /// \brief Direct initialization due to a C-style cast. SIK_DirectCStyleCast, /// \brief Direct initialization due to a functional-style cast. @@ -372,8 +372,8 @@ public: /// \brief Create a direct initialization due to a cast that isn't a C-style /// or functional cast. - static InitializationKind CreateCast(SourceRange TypeRange) { - return InitializationKind(SIK_DirectCast, + static InitializationKind CreateStaticCast(SourceRange TypeRange) { + return InitializationKind(SIK_DirectStaticCast, TypeRange.getBegin(), TypeRange.getBegin(), TypeRange.getEnd()); } @@ -425,7 +425,7 @@ public: /// \brief Determine whether this initialization is an explicit cast. bool isExplicitCast() const { - return Kind == SIK_DirectCast || + return Kind == SIK_DirectStaticCast || Kind == SIK_DirectCStyleCast || Kind == SIK_DirectFunctionalCast; } @@ -440,6 +440,11 @@ public: return Kind == SIK_DirectCStyleCast; } + /// brief Determine whether this is a static cast. + bool isStaticCast() const { + return Kind == SIK_DirectStaticCast; + } + /// brief Determine whether this is a functional-style cast. bool isFunctionalCast() const { return Kind == SIK_DirectFunctionalCast; diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index da17b248a1..91e805cdd6 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -5557,18 +5557,26 @@ public: CCK_CStyleCast, /// \brief A functional-style cast. CCK_FunctionalCast, + /// \breif A static cast + CCK_StaticCast, /// \brief A cast other than a C-style cast. CCK_OtherCast }; - /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit - /// cast. If there is already an implicit cast, merge into the existing one. - /// If isLvalue, the result of the cast is an lvalue. + /// CastExprToType - If Expr is not of type 'Type', insert a cast of the + /// specified kind. + /// Redundant implicit casts are merged together. + ExprResult CastExprToType(Expr *E, QualType Ty, + CastKind Kind, ExprValueKind VK, + const CXXCastPath *BasePath, + CheckedConversionKind CCK); + + /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast. + /// If there is already an implicit cast, merge into the existing one. + /// The result is of the given category. ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK = VK_RValue, - const CXXCastPath *BasePath = 0, - CheckedConversionKind CCK - = CCK_ImplicitConversion); + const CXXCastPath *BasePath = 0); /// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding /// to the conversion from scalar type ScalarTy to the Boolean type. @@ -5757,10 +5765,10 @@ public: AssignmentAction Action, CheckedConversionKind CCK = CCK_ImplicitConversion); - ExprResult PerformImplicitConversion(Expr *From, QualType ToType, - const StandardConversionSequence& SCS, - AssignmentAction Action, - CheckedConversionKind CCK); + ExprResult PerformConversion(Expr *From, QualType ToType, + const StandardConversionSequence& SCS, + AssignmentAction Action, + CheckedConversionKind CCK); /// the following "Check" methods will return a valid/converted QualType /// or a null QualType (indicating an error diagnostic was issued). |