| ... | @@ -541,14 +541,14 @@ static const ZigClangType *qual_type_canon(ZigClangQualType qt) { | ... | @@ -541,14 +541,14 @@ static const ZigClangType *qual_type_canon(ZigClangQualType qt) { |
| 541 | static ZigClangQualType get_expr_qual_type(Context *c, const ZigClangExpr *expr) { | 541 | static ZigClangQualType get_expr_qual_type(Context *c, const ZigClangExpr *expr) { |
| 542 | // String literals in C are `char *` but they should really be `const char *`. | 542 | // String literals in C are `char *` but they should really be `const char *`. |
| 543 | if (ZigClangExpr_getStmtClass(expr) == ZigClangStmt_ImplicitCastExprClass) { | 543 | if (ZigClangExpr_getStmtClass(expr) == ZigClangStmt_ImplicitCastExprClass) { |
| 544 | const clang::ImplicitCastExpr *cast_expr = reinterpret_cast<const clang::ImplicitCastExpr *>(expr); | 544 | const ZigClangImplicitCastExpr *cast_expr = reinterpret_cast<const ZigClangImplicitCastExpr *>(expr); |
| 545 | if ((ZigClangCK)cast_expr->getCastKind() == ZigClangCK_ArrayToPointerDecay) { | 545 | if (ZigClangImplicitCastExpr_getCastKind(cast_expr) == ZigClangCK_ArrayToPointerDecay) { |
| 546 | const ZigClangExpr *sub_expr = bitcast(cast_expr->getSubExpr()); | 546 | const ZigClangExpr *sub_expr = ZigClangImplicitCastExpr_getSubExpr(cast_expr); |
| 547 | if (ZigClangExpr_getStmtClass(sub_expr) == ZigClangStmt_StringLiteralClass) { | 547 | if (ZigClangExpr_getStmtClass(sub_expr) == ZigClangStmt_StringLiteralClass) { |
| 548 | ZigClangQualType array_qt = ZigClangExpr_getType(sub_expr); | 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 | ZigClangQualType_getTypePtr(array_qt)); | 550 | ZigClangQualType_getTypePtr(array_qt)); |
| 551 | ZigClangQualType pointee_qt = bitcast(array_type->getElementType()); | 551 | ZigClangQualType pointee_qt = ZigClangArrayType_getElementType(array_type); |
| 552 | ZigClangQualType_addConst(&pointee_qt); | 552 | ZigClangQualType_addConst(&pointee_qt); |
| 553 | return ZigClangASTContext_getPointerType(c->ctx, pointee_qt); | 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,8 +559,8 @@ static ZigClangQualType get_expr_qual_type(Context *c, const ZigClangExpr *expr) |
| 559 | | 559 | |
| 560 | static ZigClangQualType get_expr_qual_type_before_implicit_cast(Context *c, const ZigClangExpr *expr) { | 560 | static ZigClangQualType get_expr_qual_type_before_implicit_cast(Context *c, const ZigClangExpr *expr) { |
| 561 | if (ZigClangExpr_getStmtClass(expr) == ZigClangStmt_ImplicitCastExprClass) { | 561 | if (ZigClangExpr_getStmtClass(expr) == ZigClangStmt_ImplicitCastExprClass) { |
| 562 | const clang::ImplicitCastExpr *cast_expr = reinterpret_cast<const clang::ImplicitCastExpr *>(expr); | 562 | const ZigClangImplicitCastExpr *cast_expr = reinterpret_cast<const ZigClangImplicitCastExpr *>(expr); |
| 563 | return get_expr_qual_type(c, bitcast(cast_expr->getSubExpr())); | 563 | return get_expr_qual_type(c, ZigClangImplicitCastExpr_getSubExpr(cast_expr)); |
| 564 | } | 564 | } |
| 565 | return ZigClangExpr_getType(expr); | 565 | return ZigClangExpr_getType(expr); |
| 566 | } | 566 | } |
| ... | @@ -1928,88 +1928,93 @@ static AstNode *trans_compound_assign_operator(Context *c, ResultUsed result_use | ... | @@ -1928,88 +1928,93 @@ static AstNode *trans_compound_assign_operator(Context *c, ResultUsed result_use |
| 1928 | zig_unreachable(); | 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) { | 1931 | static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, TransScope *scope, |
| 1932 | switch ((ZigClangCK)stmt->getCastKind()) { | 1932 | const ZigClangImplicitCastExpr *stmt) |
| | 1933 | { |
| | 1934 | switch (ZigClangImplicitCastExpr_getCastKind(stmt)) { |
| 1933 | case ZigClangCK_LValueToRValue: | 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 | case ZigClangCK_IntegralCast: | 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 | if (target_node == nullptr) | 1940 | if (target_node == nullptr) |
| 1939 | return nullptr; | 1941 | return nullptr; |
| 1940 | AstNode *node = trans_c_cast(c, bitcast(stmt->getExprLoc()), bitcast(stmt->getType()), | 1942 | AstNode *node = trans_c_cast(c, ZigClangImplicitCastExpr_getBeginLoc(stmt), |
| 1941 | bitcast(stmt->getSubExpr()->getType()), target_node); | 1943 | ZigClangExpr_getType(reinterpret_cast<const ZigClangExpr *>(stmt)), |
| | 1944 | ZigClangExpr_getType(ZigClangImplicitCastExpr_getSubExpr(stmt)), |
| | 1945 | target_node); |
| 1942 | return maybe_suppress_result(c, result_used, node); | 1946 | return maybe_suppress_result(c, result_used, node); |
| 1943 | } | 1947 | } |
| 1944 | case ZigClangCK_FunctionToPointerDecay: | 1948 | case ZigClangCK_FunctionToPointerDecay: |
| 1945 | case ZigClangCK_ArrayToPointerDecay: | 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 | if (target_node == nullptr) | 1952 | if (target_node == nullptr) |
| 1949 | return nullptr; | 1953 | return nullptr; |
| 1950 | return maybe_suppress_result(c, result_used, target_node); | 1954 | return maybe_suppress_result(c, result_used, target_node); |
| 1951 | } | 1955 | } |
| 1952 | case ZigClangCK_BitCast: | 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 | if (target_node == nullptr) | 1959 | if (target_node == nullptr) |
| 1956 | return nullptr; | 1960 | return nullptr; |
| 1957 | | 1961 | |
| 1958 | const ZigClangQualType dest_type = get_expr_qual_type(c, bitcast(stmt)); | 1962 | const ZigClangQualType dest_type = get_expr_qual_type(c, reinterpret_cast<const ZigClangExpr *>(stmt)); |
| 1959 | const ZigClangQualType src_type = get_expr_qual_type(c, bitcast(stmt->getSubExpr())); | 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 | case ZigClangCK_NullToPointer: | 1968 | case ZigClangCK_NullToPointer: |
| 1964 | return trans_create_node(c, NodeTypeNullLiteral); | 1969 | return trans_create_node(c, NodeTypeNullLiteral); |
| 1965 | case ZigClangCK_NoOp: | 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 | case ZigClangCK_Dependent: | 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 | return nullptr; | 1974 | return nullptr; |
| 1970 | case ZigClangCK_LValueBitCast: | 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 | return nullptr; | 1977 | return nullptr; |
| 1973 | case ZigClangCK_BaseToDerived: | 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 | return nullptr; | 1980 | return nullptr; |
| 1976 | case ZigClangCK_DerivedToBase: | 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 | return nullptr; | 1983 | return nullptr; |
| 1979 | case ZigClangCK_UncheckedDerivedToBase: | 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 | return nullptr; | 1986 | return nullptr; |
| 1982 | case ZigClangCK_Dynamic: | 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 | return nullptr; | 1989 | return nullptr; |
| 1985 | case ZigClangCK_ToUnion: | 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 | return nullptr; | 1992 | return nullptr; |
| 1988 | case ZigClangCK_NullToMemberPointer: | 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 | return nullptr; | 1995 | return nullptr; |
| 1991 | case ZigClangCK_BaseToDerivedMemberPointer: | 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 | return nullptr; | 1998 | return nullptr; |
| 1994 | case ZigClangCK_DerivedToBaseMemberPointer: | 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 | return nullptr; | 2001 | return nullptr; |
| 1997 | case ZigClangCK_MemberPointerToBoolean: | 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 | return nullptr; | 2004 | return nullptr; |
| 2000 | case ZigClangCK_ReinterpretMemberPointer: | 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 | return nullptr; | 2007 | return nullptr; |
| 2003 | case ZigClangCK_UserDefinedConversion: | 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 | return nullptr; | 2010 | return nullptr; |
| 2006 | case ZigClangCK_ConstructorConversion: | 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 | return nullptr; | 2013 | return nullptr; |
| 2009 | case ZigClangCK_PointerToBoolean: | 2014 | case ZigClangCK_PointerToBoolean: |
| 2010 | { | 2015 | { |
| 2011 | const clang::Expr *expr = stmt->getSubExpr(); | 2016 | const ZigClangExpr *expr = ZigClangImplicitCastExpr_getSubExpr(stmt); |
| 2012 | AstNode *val = trans_expr(c, ResultUsedYes, scope, bitcast(expr), TransRValue); | 2017 | AstNode *val = trans_expr(c, ResultUsedYes, scope, expr, TransRValue); |
| 2013 | if (val == nullptr) | 2018 | if (val == nullptr) |
| 2014 | return nullptr; | 2019 | return nullptr; |
| 2015 | | 2020 | |
| ... | @@ -2022,21 +2027,21 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra | ... | @@ -2022,21 +2027,21 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2022 | return trans_create_node_bin_op(c, val_ptr, BinOpTypeCmpNotEq, zero); | 2027 | return trans_create_node_bin_op(c, val_ptr, BinOpTypeCmpNotEq, zero); |
| 2023 | } | 2028 | } |
| 2024 | case ZigClangCK_ToVoid: | 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 | return nullptr; | 2031 | return nullptr; |
| 2027 | case ZigClangCK_VectorSplat: | 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 | return nullptr; | 2034 | return nullptr; |
| 2030 | case ZigClangCK_IntegralToBoolean: | 2035 | case ZigClangCK_IntegralToBoolean: |
| 2031 | { | 2036 | { |
| 2032 | const clang::Expr *expr = stmt->getSubExpr(); | 2037 | const ZigClangExpr *expr = ZigClangImplicitCastExpr_getSubExpr(stmt); |
| 2033 | | 2038 | |
| 2034 | bool expr_val; | 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 | return trans_create_node_bool(c, expr_val); | 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 | if (val == nullptr) | 2045 | if (val == nullptr) |
| 2041 | return nullptr; | 2046 | return nullptr; |
| 2042 | | 2047 | |
| ... | @@ -2047,7 +2052,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra | ... | @@ -2047,7 +2052,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2047 | } | 2052 | } |
| 2048 | case ZigClangCK_PointerToIntegral: | 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 | if (target_node == nullptr) | 2056 | if (target_node == nullptr) |
| 2052 | return nullptr; | 2057 | return nullptr; |
| 2053 | | 2058 | |
| ... | @@ -2066,7 +2071,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra | ... | @@ -2066,7 +2071,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2066 | } | 2071 | } |
| 2067 | case ZigClangCK_IntegralToPointer: | 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 | if (target_node == nullptr) | 2075 | if (target_node == nullptr) |
| 2071 | return nullptr; | 2076 | return nullptr; |
| 2072 | | 2077 | |
| ... | @@ -2083,7 +2088,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra | ... | @@ -2083,7 +2088,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2083 | case ZigClangCK_IntegralToFloating: | 2088 | case ZigClangCK_IntegralToFloating: |
| 2084 | case ZigClangCK_FloatingToIntegral: | 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 | if (target_node == nullptr) | 2092 | if (target_node == nullptr) |
| 2088 | return nullptr; | 2093 | return nullptr; |
| 2089 | | 2094 | |
| ... | @@ -2091,7 +2096,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra | ... | @@ -2091,7 +2096,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2091 | if (dest_type_node == nullptr) | 2096 | if (dest_type_node == nullptr) |
| 2092 | return nullptr; | 2097 | return nullptr; |
| 2093 | | 2098 | |
| 2094 | char const *fn = (ZigClangCK)stmt->getCastKind() == ZigClangCK_IntegralToFloating ? | 2099 | char const *fn = (ZigClangImplicitCastExpr_getCastKind(stmt) == ZigClangCK_IntegralToFloating) ? |
| 2095 | "intToFloat" : "floatToInt"; | 2100 | "intToFloat" : "floatToInt"; |
| 2096 | AstNode *node = trans_create_node_builtin_fn_call_str(c, fn); | 2101 | AstNode *node = trans_create_node_builtin_fn_call_str(c, fn); |
| 2097 | node->data.fn_call_expr.params.append(dest_type_node); | 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,103 +2105,103 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 2100 | return maybe_suppress_result(c, result_used, node); | 2105 | return maybe_suppress_result(c, result_used, node); |
| 2101 | } | 2106 | } |
| 2102 | case ZigClangCK_FixedPointCast: | 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 | return nullptr; | 2109 | return nullptr; |
| 2105 | case ZigClangCK_FixedPointToBoolean: | 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 | return nullptr; | 2112 | return nullptr; |
| 2108 | case ZigClangCK_FloatingToBoolean: | 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 | return nullptr; | 2115 | return nullptr; |
| 2111 | case ZigClangCK_BooleanToSignedIntegral: | 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 | return nullptr; | 2118 | return nullptr; |
| 2114 | case ZigClangCK_FloatingCast: | 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 | return nullptr; | 2121 | return nullptr; |
| 2117 | case ZigClangCK_CPointerToObjCPointerCast: | 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 | return nullptr; | 2124 | return nullptr; |
| 2120 | case ZigClangCK_BlockPointerToObjCPointerCast: | 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 | return nullptr; | 2127 | return nullptr; |
| 2123 | case ZigClangCK_AnyPointerToBlockPointerCast: | 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 | return nullptr; | 2130 | return nullptr; |
| 2126 | case ZigClangCK_ObjCObjectLValueCast: | 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 | return nullptr; | 2133 | return nullptr; |
| 2129 | case ZigClangCK_FloatingRealToComplex: | 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 | return nullptr; | 2136 | return nullptr; |
| 2132 | case ZigClangCK_FloatingComplexToReal: | 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 | return nullptr; | 2139 | return nullptr; |
| 2135 | case ZigClangCK_FloatingComplexToBoolean: | 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 | return nullptr; | 2142 | return nullptr; |
| 2138 | case ZigClangCK_FloatingComplexCast: | 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 | return nullptr; | 2145 | return nullptr; |
| 2141 | case ZigClangCK_FloatingComplexToIntegralComplex: | 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 | return nullptr; | 2148 | return nullptr; |
| 2144 | case ZigClangCK_IntegralRealToComplex: | 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 | return nullptr; | 2151 | return nullptr; |
| 2147 | case ZigClangCK_IntegralComplexToReal: | 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 | return nullptr; | 2154 | return nullptr; |
| 2150 | case ZigClangCK_IntegralComplexToBoolean: | 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 | return nullptr; | 2157 | return nullptr; |
| 2153 | case ZigClangCK_IntegralComplexCast: | 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 | return nullptr; | 2160 | return nullptr; |
| 2156 | case ZigClangCK_IntegralComplexToFloatingComplex: | 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 | return nullptr; | 2163 | return nullptr; |
| 2159 | case ZigClangCK_ARCProduceObject: | 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 | return nullptr; | 2166 | return nullptr; |
| 2162 | case ZigClangCK_ARCConsumeObject: | 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 | return nullptr; | 2169 | return nullptr; |
| 2165 | case ZigClangCK_ARCReclaimReturnedObject: | 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 | return nullptr; | 2172 | return nullptr; |
| 2168 | case ZigClangCK_ARCExtendBlockObject: | 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 | return nullptr; | 2175 | return nullptr; |
| 2171 | case ZigClangCK_AtomicToNonAtomic: | 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 | return nullptr; | 2178 | return nullptr; |
| 2174 | case ZigClangCK_NonAtomicToAtomic: | 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 | return nullptr; | 2181 | return nullptr; |
| 2177 | case ZigClangCK_CopyAndAutoreleaseBlockObject: | 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 | return nullptr; | 2184 | return nullptr; |
| 2180 | case ZigClangCK_BuiltinFnToFnPtr: | 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 | return nullptr; | 2187 | return nullptr; |
| 2183 | case ZigClangCK_ZeroToOCLOpaqueType: | 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 | return nullptr; | 2190 | return nullptr; |
| 2186 | case ZigClangCK_AddressSpaceConversion: | 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 | return nullptr; | 2193 | return nullptr; |
| 2189 | case ZigClangCK_IntToOCLSampler: | 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 | return nullptr; | 2196 | return nullptr; |
| 2192 | case ZigClangCK_LValueToRValueBitCast: | 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 | return nullptr; | 2199 | return nullptr; |
| 2195 | case ZigClangCK_FixedPointToIntegral: | 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 | return nullptr; | 2202 | return nullptr; |
| 2198 | case ZigClangCK_IntegralToFixedPoint: | 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 | return nullptr; | 2205 | return nullptr; |
| 2201 | } | 2206 | } |
| 2202 | zig_unreachable(); | 2207 | zig_unreachable(); |
| ... | @@ -3470,7 +3475,7 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const ZigClangStmt *s | ... | @@ -3470,7 +3475,7 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const ZigClangStmt *s |
| 3470 | trans_compound_assign_operator(c, result_used, scope, (const clang::CompoundAssignOperator *)stmt)); | 3475 | trans_compound_assign_operator(c, result_used, scope, (const clang::CompoundAssignOperator *)stmt)); |
| 3471 | case ZigClangStmt_ImplicitCastExprClass: | 3476 | case ZigClangStmt_ImplicitCastExprClass: |
| 3472 | return wrap_stmt(out_node, out_child_scope, scope, | 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 | case ZigClangStmt_DeclRefExprClass: | 3479 | case ZigClangStmt_DeclRefExprClass: |
| 3475 | return wrap_stmt(out_node, out_child_scope, scope, | 3480 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3476 | trans_decl_ref_expr(c, scope, (const clang::DeclRefExpr *)stmt, lrvalue)); | 3481 | trans_decl_ref_expr(c, scope, (const clang::DeclRefExpr *)stmt, lrvalue)); |