| ... | ... | @@ -541,14 +541,14 @@ static const ZigClangType *qual_type_canon(ZigClangQualType qt) { |
| 541 | 541 | static ZigClangQualType get_expr_qual_type(Context *c, const ZigClangExpr *expr) { |
| 542 | 542 | // String literals in C are `char *` but they should really be `const char *`. |
| 543 | 543 | if (ZigClangExpr_getStmtClass(expr) == ZigClangStmt_ImplicitCastExprClass) { |
| 544 | | const clang::ImplicitCastExpr *cast_expr = reinterpret_cast<const clang::ImplicitCastExpr *>(expr); |
| 545 | | if ((ZigClangCK)cast_expr->getCastKind() == ZigClangCK_ArrayToPointerDecay) { |
| 546 | | const ZigClangExpr *sub_expr = bitcast(cast_expr->getSubExpr()); |
| 544 | const ZigClangImplicitCastExpr *cast_expr = reinterpret_cast<const ZigClangImplicitCastExpr *>(expr); |
| 545 | if (ZigClangImplicitCastExpr_getCastKind(cast_expr) == ZigClangCK_ArrayToPointerDecay) { |
| 546 | const ZigClangExpr *sub_expr = ZigClangImplicitCastExpr_getSubExpr(cast_expr); |
| 547 | 547 | if (ZigClangExpr_getStmtClass(sub_expr) == ZigClangStmt_StringLiteralClass) { |
| 548 | 548 | ZigClangQualType array_qt = ZigClangExpr_getType(sub_expr); |
| 549 | | const clang::ArrayType *array_type = reinterpret_cast<const clang::ArrayType *>( |
| 549 | const ZigClangArrayType *array_type = reinterpret_cast<const ZigClangArrayType *>( |
| 550 | 550 | ZigClangQualType_getTypePtr(array_qt)); |
| 551 | | ZigClangQualType pointee_qt = bitcast(array_type->getElementType()); |
| 551 | ZigClangQualType pointee_qt = ZigClangArrayType_getElementType(array_type); |
| 552 | 552 | ZigClangQualType_addConst(&pointee_qt); |
| 553 | 553 | return ZigClangASTContext_getPointerType(c->ctx, pointee_qt); |
| 554 | 554 | } |
| ... | ... | @@ -559,8 +559,8 @@ static ZigClangQualType get_expr_qual_type(Context *c, const ZigClangExpr *expr) |
| 559 | 559 | |
| 560 | 560 | static ZigClangQualType get_expr_qual_type_before_implicit_cast(Context *c, const ZigClangExpr *expr) { |
| 561 | 561 | if (ZigClangExpr_getStmtClass(expr) == ZigClangStmt_ImplicitCastExprClass) { |
| 562 | | const clang::ImplicitCastExpr *cast_expr = reinterpret_cast<const clang::ImplicitCastExpr *>(expr); |
| 563 | | return get_expr_qual_type(c, bitcast(cast_expr->getSubExpr())); |
| 562 | const ZigClangImplicitCastExpr *cast_expr = reinterpret_cast<const ZigClangImplicitCastExpr *>(expr); |
| 563 | return get_expr_qual_type(c, ZigClangImplicitCastExpr_getSubExpr(cast_expr)); |
| 564 | 564 | } |
| 565 | 565 | return ZigClangExpr_getType(expr); |
| 566 | 566 | } |
| ... | ... | @@ -1928,88 +1928,93 @@ static AstNode *trans_compound_assign_operator(Context *c, ResultUsed result_use |
| 1928 | 1928 | zig_unreachable(); |
| 1929 | 1929 | } |
| 1930 | 1930 | |
| 1931 | | static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, TransScope *scope, const clang::ImplicitCastExpr *stmt) { |
| 1932 | | switch ((ZigClangCK)stmt->getCastKind()) { |
| 1931 | static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, TransScope *scope, |
| 1932 | const ZigClangImplicitCastExpr *stmt) |
| 1933 | { |
| 1934 | switch (ZigClangImplicitCastExpr_getCastKind(stmt)) { |
| 1933 | 1935 | case ZigClangCK_LValueToRValue: |
| 1934 | | return trans_expr(c, ResultUsedYes, scope, bitcast(stmt->getSubExpr()), TransRValue); |
| 1936 | return trans_expr(c, ResultUsedYes, scope, ZigClangImplicitCastExpr_getSubExpr(stmt), TransRValue); |
| 1935 | 1937 | case ZigClangCK_IntegralCast: |
| 1936 | 1938 | { |
| 1937 | | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, bitcast(stmt->getSubExpr()), TransRValue); |
| 1939 | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, ZigClangImplicitCastExpr_getSubExpr(stmt), TransRValue); |
| 1938 | 1940 | if (target_node == nullptr) |
| 1939 | 1941 | return nullptr; |
| 1940 | | AstNode *node = trans_c_cast(c, bitcast(stmt->getExprLoc()), bitcast(stmt->getType()), |
| 1941 | | bitcast(stmt->getSubExpr()->getType()), target_node); |
| 1942 | AstNode *node = trans_c_cast(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), |
| 1943 | ZigClangExpr_getType(reinterpret_cast<const ZigClangExpr *>(stmt)), |
| 1944 | ZigClangExpr_getType(ZigClangImplicitCastExpr_getSubExpr(stmt)), |
| 1945 | target_node); |
| 1942 | 1946 | return maybe_suppress_result(c, result_used, node); |
| 1943 | 1947 | } |
| 1944 | 1948 | case ZigClangCK_FunctionToPointerDecay: |
| 1945 | 1949 | case ZigClangCK_ArrayToPointerDecay: |
| 1946 | 1950 | { |
| 1947 | | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, bitcast(stmt->getSubExpr()), TransRValue); |
| 1951 | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, ZigClangImplicitCastExpr_getSubExpr(stmt), TransRValue); |
| 1948 | 1952 | if (target_node == nullptr) |
| 1949 | 1953 | return nullptr; |
| 1950 | 1954 | return maybe_suppress_result(c, result_used, target_node); |
| 1951 | 1955 | } |
| 1952 | 1956 | case ZigClangCK_BitCast: |
| 1953 | 1957 | { |
| 1954 | | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, bitcast(stmt->getSubExpr()), TransRValue); |
| 1958 | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, ZigClangImplicitCastExpr_getSubExpr(stmt), TransRValue); |
| 1955 | 1959 | if (target_node == nullptr) |
| 1956 | 1960 | return nullptr; |
| 1957 | 1961 | |
| 1958 | | const ZigClangQualType dest_type = get_expr_qual_type(c, bitcast(stmt)); |
| 1959 | | const ZigClangQualType src_type = get_expr_qual_type(c, bitcast(stmt->getSubExpr())); |
| 1962 | const ZigClangQualType dest_type = get_expr_qual_type(c, reinterpret_cast<const ZigClangExpr *>(stmt)); |
| 1963 | const ZigClangQualType src_type = get_expr_qual_type(c, ZigClangImplicitCastExpr_getSubExpr(stmt)); |
| 1960 | 1964 | |
| 1961 | | return trans_c_cast(c, bitcast(stmt->getBeginLoc()), dest_type, src_type, target_node); |
| 1965 | return trans_c_cast(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), |
| 1966 | dest_type, src_type, target_node); |
| 1962 | 1967 | } |
| 1963 | 1968 | case ZigClangCK_NullToPointer: |
| 1964 | 1969 | return trans_create_node(c, NodeTypeNullLiteral); |
| 1965 | 1970 | case ZigClangCK_NoOp: |
| 1966 | | return trans_expr(c, ResultUsedYes, scope, bitcast(stmt->getSubExpr()), TransRValue); |
| 1971 | return trans_expr(c, ResultUsedYes, scope, ZigClangImplicitCastExpr_getSubExpr(stmt), TransRValue); |
| 1967 | 1972 | case ZigClangCK_Dependent: |
| 1968 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_Dependent"); |
| 1973 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_Dependent"); |
| 1969 | 1974 | return nullptr; |
| 1970 | 1975 | case ZigClangCK_LValueBitCast: |
| 1971 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_LValueBitCast"); |
| 1976 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_LValueBitCast"); |
| 1972 | 1977 | return nullptr; |
| 1973 | 1978 | case ZigClangCK_BaseToDerived: |
| 1974 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_BaseToDerived"); |
| 1979 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_BaseToDerived"); |
| 1975 | 1980 | return nullptr; |
| 1976 | 1981 | case ZigClangCK_DerivedToBase: |
| 1977 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_DerivedToBase"); |
| 1982 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_DerivedToBase"); |
| 1978 | 1983 | return nullptr; |
| 1979 | 1984 | case ZigClangCK_UncheckedDerivedToBase: |
| 1980 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_UncheckedDerivedToBase"); |
| 1985 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_UncheckedDerivedToBase"); |
| 1981 | 1986 | return nullptr; |
| 1982 | 1987 | case ZigClangCK_Dynamic: |
| 1983 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_Dynamic"); |
| 1988 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_Dynamic"); |
| 1984 | 1989 | return nullptr; |
| 1985 | 1990 | case ZigClangCK_ToUnion: |
| 1986 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_ToUnion"); |
| 1991 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_ToUnion"); |
| 1987 | 1992 | return nullptr; |
| 1988 | 1993 | case ZigClangCK_NullToMemberPointer: |
| 1989 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_NullToMemberPointer"); |
| 1994 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_NullToMemberPointer"); |
| 1990 | 1995 | return nullptr; |
| 1991 | 1996 | case ZigClangCK_BaseToDerivedMemberPointer: |
| 1992 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_BaseToDerivedMemberPointer"); |
| 1997 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_BaseToDerivedMemberPointer"); |
| 1993 | 1998 | return nullptr; |
| 1994 | 1999 | case ZigClangCK_DerivedToBaseMemberPointer: |
| 1995 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_DerivedToBaseMemberPointer"); |
| 2000 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_DerivedToBaseMemberPointer"); |
| 1996 | 2001 | return nullptr; |
| 1997 | 2002 | case ZigClangCK_MemberPointerToBoolean: |
| 1998 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_MemberPointerToBoolean"); |
| 2003 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_MemberPointerToBoolean"); |
| 1999 | 2004 | return nullptr; |
| 2000 | 2005 | case ZigClangCK_ReinterpretMemberPointer: |
| 2001 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_ReinterpretMemberPointer"); |
| 2006 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_ReinterpretMemberPointer"); |
| 2002 | 2007 | return nullptr; |
| 2003 | 2008 | case ZigClangCK_UserDefinedConversion: |
| 2004 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_UserDefinedConversion"); |
| 2009 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C translation cast CK_UserDefinedConversion"); |
| 2005 | 2010 | return nullptr; |
| 2006 | 2011 | case ZigClangCK_ConstructorConversion: |
| 2007 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ConstructorConversion"); |
| 2012 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_ConstructorConversion"); |
| 2008 | 2013 | return nullptr; |
| 2009 | 2014 | case ZigClangCK_PointerToBoolean: |
| 2010 | 2015 | { |
| 2011 | | const clang::Expr *expr = stmt->getSubExpr(); |
| 2012 | | AstNode *val = trans_expr(c, ResultUsedYes, scope, bitcast(expr), TransRValue); |
| 2016 | const ZigClangExpr *expr = ZigClangImplicitCastExpr_getSubExpr(stmt); |
| 2017 | AstNode *val = trans_expr(c, ResultUsedYes, scope, expr, TransRValue); |
| 2013 | 2018 | if (val == nullptr) |
| 2014 | 2019 | return nullptr; |
| 2015 | 2020 | |
| ... | ... | @@ -2022,21 +2027,21 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2022 | 2027 | return trans_create_node_bin_op(c, val_ptr, BinOpTypeCmpNotEq, zero); |
| 2023 | 2028 | } |
| 2024 | 2029 | case ZigClangCK_ToVoid: |
| 2025 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ToVoid"); |
| 2030 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_ToVoid"); |
| 2026 | 2031 | return nullptr; |
| 2027 | 2032 | case ZigClangCK_VectorSplat: |
| 2028 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_VectorSplat"); |
| 2033 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_VectorSplat"); |
| 2029 | 2034 | return nullptr; |
| 2030 | 2035 | case ZigClangCK_IntegralToBoolean: |
| 2031 | 2036 | { |
| 2032 | | const clang::Expr *expr = stmt->getSubExpr(); |
| 2037 | const ZigClangExpr *expr = ZigClangImplicitCastExpr_getSubExpr(stmt); |
| 2033 | 2038 | |
| 2034 | 2039 | bool expr_val; |
| 2035 | | if (expr->EvaluateAsBooleanCondition(expr_val, *reinterpret_cast<clang::ASTContext *>(c->ctx))) { |
| 2040 | if (ZigClangExpr_EvaluateAsBooleanCondition(expr, &expr_val, c->ctx, false)) { |
| 2036 | 2041 | return trans_create_node_bool(c, expr_val); |
| 2037 | 2042 | } |
| 2038 | 2043 | |
| 2039 | | AstNode *val = trans_expr(c, ResultUsedYes, scope, bitcast(expr), TransRValue); |
| 2044 | AstNode *val = trans_expr(c, ResultUsedYes, scope, expr, TransRValue); |
| 2040 | 2045 | if (val == nullptr) |
| 2041 | 2046 | return nullptr; |
| 2042 | 2047 | |
| ... | ... | @@ -2047,7 +2052,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2047 | 2052 | } |
| 2048 | 2053 | case ZigClangCK_PointerToIntegral: |
| 2049 | 2054 | { |
| 2050 | | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, bitcast(stmt->getSubExpr()), TransRValue); |
| 2055 | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, ZigClangImplicitCastExpr_getSubExpr(stmt), TransRValue); |
| 2051 | 2056 | if (target_node == nullptr) |
| 2052 | 2057 | return nullptr; |
| 2053 | 2058 | |
| ... | ... | @@ -2066,7 +2071,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2066 | 2071 | } |
| 2067 | 2072 | case ZigClangCK_IntegralToPointer: |
| 2068 | 2073 | { |
| 2069 | | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, bitcast(stmt->getSubExpr()), TransRValue); |
| 2074 | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, ZigClangImplicitCastExpr_getSubExpr(stmt), TransRValue); |
| 2070 | 2075 | if (target_node == nullptr) |
| 2071 | 2076 | return nullptr; |
| 2072 | 2077 | |
| ... | ... | @@ -2083,7 +2088,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2083 | 2088 | case ZigClangCK_IntegralToFloating: |
| 2084 | 2089 | case ZigClangCK_FloatingToIntegral: |
| 2085 | 2090 | { |
| 2086 | | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, bitcast(stmt->getSubExpr()), TransRValue); |
| 2091 | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, ZigClangImplicitCastExpr_getSubExpr(stmt), TransRValue); |
| 2087 | 2092 | if (target_node == nullptr) |
| 2088 | 2093 | return nullptr; |
| 2089 | 2094 | |
| ... | ... | @@ -2091,7 +2096,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2091 | 2096 | if (dest_type_node == nullptr) |
| 2092 | 2097 | return nullptr; |
| 2093 | 2098 | |
| 2094 | | char const *fn = (ZigClangCK)stmt->getCastKind() == ZigClangCK_IntegralToFloating ? |
| 2099 | char const *fn = (ZigClangImplicitCastExpr_getCastKind(stmt) == ZigClangCK_IntegralToFloating) ? |
| 2095 | 2100 | "intToFloat" : "floatToInt"; |
| 2096 | 2101 | AstNode *node = trans_create_node_builtin_fn_call_str(c, fn); |
| 2097 | 2102 | node->data.fn_call_expr.params.append(dest_type_node); |
| ... | ... | @@ -2100,103 +2105,103 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2100 | 2105 | return maybe_suppress_result(c, result_used, node); |
| 2101 | 2106 | } |
| 2102 | 2107 | case ZigClangCK_FixedPointCast: |
| 2103 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FixedPointCast"); |
| 2108 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_FixedPointCast"); |
| 2104 | 2109 | return nullptr; |
| 2105 | 2110 | case ZigClangCK_FixedPointToBoolean: |
| 2106 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FixedPointToBoolean"); |
| 2111 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_FixedPointToBoolean"); |
| 2107 | 2112 | return nullptr; |
| 2108 | 2113 | case ZigClangCK_FloatingToBoolean: |
| 2109 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingToBoolean"); |
| 2114 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_FloatingToBoolean"); |
| 2110 | 2115 | return nullptr; |
| 2111 | 2116 | case ZigClangCK_BooleanToSignedIntegral: |
| 2112 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_BooleanToSignedIntegral"); |
| 2117 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_BooleanToSignedIntegral"); |
| 2113 | 2118 | return nullptr; |
| 2114 | 2119 | case ZigClangCK_FloatingCast: |
| 2115 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingCast"); |
| 2120 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_FloatingCast"); |
| 2116 | 2121 | return nullptr; |
| 2117 | 2122 | case ZigClangCK_CPointerToObjCPointerCast: |
| 2118 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_CPointerToObjCPointerCast"); |
| 2123 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_CPointerToObjCPointerCast"); |
| 2119 | 2124 | return nullptr; |
| 2120 | 2125 | case ZigClangCK_BlockPointerToObjCPointerCast: |
| 2121 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_BlockPointerToObjCPointerCast"); |
| 2126 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_BlockPointerToObjCPointerCast"); |
| 2122 | 2127 | return nullptr; |
| 2123 | 2128 | case ZigClangCK_AnyPointerToBlockPointerCast: |
| 2124 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_AnyPointerToBlockPointerCast"); |
| 2129 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_AnyPointerToBlockPointerCast"); |
| 2125 | 2130 | return nullptr; |
| 2126 | 2131 | case ZigClangCK_ObjCObjectLValueCast: |
| 2127 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ObjCObjectLValueCast"); |
| 2132 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_ObjCObjectLValueCast"); |
| 2128 | 2133 | return nullptr; |
| 2129 | 2134 | case ZigClangCK_FloatingRealToComplex: |
| 2130 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingRealToComplex"); |
| 2135 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_FloatingRealToComplex"); |
| 2131 | 2136 | return nullptr; |
| 2132 | 2137 | case ZigClangCK_FloatingComplexToReal: |
| 2133 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingComplexToReal"); |
| 2138 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_FloatingComplexToReal"); |
| 2134 | 2139 | return nullptr; |
| 2135 | 2140 | case ZigClangCK_FloatingComplexToBoolean: |
| 2136 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingComplexToBoolean"); |
| 2141 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_FloatingComplexToBoolean"); |
| 2137 | 2142 | return nullptr; |
| 2138 | 2143 | case ZigClangCK_FloatingComplexCast: |
| 2139 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingComplexCast"); |
| 2144 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_FloatingComplexCast"); |
| 2140 | 2145 | return nullptr; |
| 2141 | 2146 | case ZigClangCK_FloatingComplexToIntegralComplex: |
| 2142 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingComplexToIntegralComplex"); |
| 2147 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_FloatingComplexToIntegralComplex"); |
| 2143 | 2148 | return nullptr; |
| 2144 | 2149 | case ZigClangCK_IntegralRealToComplex: |
| 2145 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralRealToComplex"); |
| 2150 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_IntegralRealToComplex"); |
| 2146 | 2151 | return nullptr; |
| 2147 | 2152 | case ZigClangCK_IntegralComplexToReal: |
| 2148 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralComplexToReal"); |
| 2153 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_IntegralComplexToReal"); |
| 2149 | 2154 | return nullptr; |
| 2150 | 2155 | case ZigClangCK_IntegralComplexToBoolean: |
| 2151 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralComplexToBoolean"); |
| 2156 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_IntegralComplexToBoolean"); |
| 2152 | 2157 | return nullptr; |
| 2153 | 2158 | case ZigClangCK_IntegralComplexCast: |
| 2154 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralComplexCast"); |
| 2159 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_IntegralComplexCast"); |
| 2155 | 2160 | return nullptr; |
| 2156 | 2161 | case ZigClangCK_IntegralComplexToFloatingComplex: |
| 2157 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralComplexToFloatingComplex"); |
| 2162 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_IntegralComplexToFloatingComplex"); |
| 2158 | 2163 | return nullptr; |
| 2159 | 2164 | case ZigClangCK_ARCProduceObject: |
| 2160 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ARCProduceObject"); |
| 2165 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_ARCProduceObject"); |
| 2161 | 2166 | return nullptr; |
| 2162 | 2167 | case ZigClangCK_ARCConsumeObject: |
| 2163 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ARCConsumeObject"); |
| 2168 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_ARCConsumeObject"); |
| 2164 | 2169 | return nullptr; |
| 2165 | 2170 | case ZigClangCK_ARCReclaimReturnedObject: |
| 2166 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ARCReclaimReturnedObject"); |
| 2171 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_ARCReclaimReturnedObject"); |
| 2167 | 2172 | return nullptr; |
| 2168 | 2173 | case ZigClangCK_ARCExtendBlockObject: |
| 2169 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ARCExtendBlockObject"); |
| 2174 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_ARCExtendBlockObject"); |
| 2170 | 2175 | return nullptr; |
| 2171 | 2176 | case ZigClangCK_AtomicToNonAtomic: |
| 2172 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_AtomicToNonAtomic"); |
| 2177 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_AtomicToNonAtomic"); |
| 2173 | 2178 | return nullptr; |
| 2174 | 2179 | case ZigClangCK_NonAtomicToAtomic: |
| 2175 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_NonAtomicToAtomic"); |
| 2180 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_NonAtomicToAtomic"); |
| 2176 | 2181 | return nullptr; |
| 2177 | 2182 | case ZigClangCK_CopyAndAutoreleaseBlockObject: |
| 2178 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_CopyAndAutoreleaseBlockObject"); |
| 2183 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_CopyAndAutoreleaseBlockObject"); |
| 2179 | 2184 | return nullptr; |
| 2180 | 2185 | case ZigClangCK_BuiltinFnToFnPtr: |
| 2181 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_BuiltinFnToFnPtr"); |
| 2186 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_BuiltinFnToFnPtr"); |
| 2182 | 2187 | return nullptr; |
| 2183 | 2188 | case ZigClangCK_ZeroToOCLOpaqueType: |
| 2184 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ZeroToOCLOpaqueType"); |
| 2189 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_ZeroToOCLOpaqueType"); |
| 2185 | 2190 | return nullptr; |
| 2186 | 2191 | case ZigClangCK_AddressSpaceConversion: |
| 2187 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_AddressSpaceConversion"); |
| 2192 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_AddressSpaceConversion"); |
| 2188 | 2193 | return nullptr; |
| 2189 | 2194 | case ZigClangCK_IntToOCLSampler: |
| 2190 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntToOCLSampler"); |
| 2195 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_IntToOCLSampler"); |
| 2191 | 2196 | return nullptr; |
| 2192 | 2197 | case ZigClangCK_LValueToRValueBitCast: |
| 2193 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_LValueToRValueBitCast"); |
| 2198 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_LValueToRValueBitCast"); |
| 2194 | 2199 | return nullptr; |
| 2195 | 2200 | case ZigClangCK_FixedPointToIntegral: |
| 2196 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FixedPointToIntegral"); |
| 2201 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_FixedPointToIntegral"); |
| 2197 | 2202 | return nullptr; |
| 2198 | 2203 | case ZigClangCK_IntegralToFixedPoint: |
| 2199 | | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralToFixedPointral"); |
| 2204 | emit_warning(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), "TODO handle C CK_IntegralToFixedPointral"); |
| 2200 | 2205 | return nullptr; |
| 2201 | 2206 | } |
| 2202 | 2207 | zig_unreachable(); |
| ... | ... | @@ -3470,7 +3475,7 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const ZigClangStmt *s |
| 3470 | 3475 | trans_compound_assign_operator(c, result_used, scope, (const clang::CompoundAssignOperator *)stmt)); |
| 3471 | 3476 | case ZigClangStmt_ImplicitCastExprClass: |
| 3472 | 3477 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3473 | | trans_implicit_cast_expr(c, result_used, scope, (const clang::ImplicitCastExpr *)stmt)); |
| 3478 | trans_implicit_cast_expr(c, result_used, scope, (const ZigClangImplicitCastExpr *)stmt)); |
| 3474 | 3479 | case ZigClangStmt_DeclRefExprClass: |
| 3475 | 3480 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3476 | 3481 | trans_decl_ref_expr(c, scope, (const clang::DeclRefExpr *)stmt, lrvalue)); |