| ... | ... | @@ -112,7 +112,7 @@ static TransScopeSwitch *trans_scope_switch_create(Context *c, TransScope *paren |
| 112 | 112 | |
| 113 | 113 | static TransScopeBlock *trans_scope_block_find(TransScope *scope); |
| 114 | 114 | |
| 115 | | static AstNode *resolve_record_decl(Context *c, const clang::RecordDecl *record_decl); |
| 115 | static AstNode *resolve_record_decl(Context *c, const ZigClangRecordDecl *record_decl); |
| 116 | 116 | static AstNode *resolve_enum_decl(Context *c, const clang::EnumDecl *enum_decl); |
| 117 | 117 | static AstNode *resolve_typedef_decl(Context *c, const clang::TypedefNameDecl *typedef_decl); |
| 118 | 118 | |
| ... | ... | @@ -122,9 +122,9 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const clang::Stmt *st |
| 122 | 122 | TransScope **out_node_scope); |
| 123 | 123 | static TransScope *trans_stmt(Context *c, TransScope *scope, const clang::Stmt *stmt, AstNode **out_node); |
| 124 | 124 | static AstNode *trans_expr(Context *c, ResultUsed result_used, TransScope *scope, const clang::Expr *expr, TransLRValue lrval); |
| 125 | | static AstNode *trans_qual_type(Context *c, clang::QualType qt, const clang::SourceLocation &source_loc); |
| 125 | static AstNode *trans_qual_type(Context *c, clang::QualType qt, ZigClangSourceLocation source_loc); |
| 126 | 126 | static AstNode *trans_bool_expr(Context *c, ResultUsed result_used, TransScope *scope, const clang::Expr *expr, TransLRValue lrval); |
| 127 | | static AstNode *trans_ap_value(Context *c, clang::APValue *ap_value, clang::QualType qt, const clang::SourceLocation &source_loc); |
| 127 | static AstNode *trans_ap_value(Context *c, clang::APValue *ap_value, clang::QualType qt, ZigClangSourceLocation source_loc); |
| 128 | 128 | |
| 129 | 129 | static ZigClangSourceLocation bitcast(clang::SourceLocation src) { |
| 130 | 130 | ZigClangSourceLocation dest; |
| ... | ... | @@ -143,7 +143,7 @@ static clang::QualType bitcast(ZigClangQualType src) { |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | ATTRIBUTE_PRINTF(3, 4) |
| 146 | | static void emit_warning(Context *c, const clang::SourceLocation &clang_sl, const char *format, ...) { |
| 146 | static void emit_warning(Context *c, ZigClangSourceLocation sl, const char *format, ...) { |
| 147 | 147 | if (!c->warnings_on) { |
| 148 | 148 | return; |
| 149 | 149 | } |
| ... | ... | @@ -153,7 +153,6 @@ static void emit_warning(Context *c, const clang::SourceLocation &clang_sl, cons |
| 153 | 153 | Buf *msg = buf_vprintf(format, ap); |
| 154 | 154 | va_end(ap); |
| 155 | 155 | |
| 156 | | ZigClangSourceLocation sl = bitcast(clang_sl); |
| 157 | 156 | const char *filename_bytes = ZigClangSourceManager_getFilename(c->source_manager, |
| 158 | 157 | ZigClangSourceManager_getSpellingLoc(c->source_manager, sl)); |
| 159 | 158 | Buf *path; |
| ... | ... | @@ -489,11 +488,6 @@ static Buf *string_ref_to_buf(llvm::StringRef string_ref) { |
| 489 | 488 | return buf_create_from_mem((const char *)string_ref.bytes_begin(), string_ref.size()); |
| 490 | 489 | } |
| 491 | 490 | |
| 492 | | static const char *decl_name(const clang::Decl *decl) { |
| 493 | | const clang::NamedDecl *named_decl = static_cast<const clang::NamedDecl *>(decl); |
| 494 | | return (const char *)named_decl->getName().bytes_begin(); |
| 495 | | } |
| 496 | | |
| 497 | 491 | static AstNode *trans_create_node_apint(Context *c, const llvm::APSInt &aps_int) { |
| 498 | 492 | AstNode *node = trans_create_node(c, NodeTypeIntLiteral); |
| 499 | 493 | node->data.int_literal.bigint = allocate<BigInt>(1); |
| ... | ... | @@ -539,7 +533,7 @@ static clang::QualType get_expr_qual_type_before_implicit_cast(Context *c, const |
| 539 | 533 | } |
| 540 | 534 | |
| 541 | 535 | static AstNode *get_expr_type(Context *c, const clang::Expr *expr) { |
| 542 | | return trans_qual_type(c, get_expr_qual_type(c, expr), expr->getBeginLoc()); |
| 536 | return trans_qual_type(c, get_expr_qual_type(c, expr), bitcast(expr->getBeginLoc())); |
| 543 | 537 | } |
| 544 | 538 | |
| 545 | 539 | static bool qual_types_equal(clang::QualType t1, clang::QualType t2) { |
| ... | ... | @@ -598,7 +592,7 @@ static bool qual_type_is_fn_ptr(clang::QualType qt) { |
| 598 | 592 | return false; |
| 599 | 593 | } |
| 600 | 594 | |
| 601 | | static uint32_t qual_type_int_bit_width(Context *c, const clang::QualType &qt, const clang::SourceLocation &source_loc) { |
| 595 | static uint32_t qual_type_int_bit_width(Context *c, const clang::QualType &qt, ZigClangSourceLocation source_loc) { |
| 602 | 596 | const clang::Type *ty = qt.getTypePtr(); |
| 603 | 597 | switch (ty->getTypeClass()) { |
| 604 | 598 | case clang::Type::Builtin: |
| ... | ... | @@ -622,7 +616,7 @@ static uint32_t qual_type_int_bit_width(Context *c, const clang::QualType &qt, c |
| 622 | 616 | { |
| 623 | 617 | const clang::TypedefType *typedef_ty = static_cast<const clang::TypedefType*>(ty); |
| 624 | 618 | const clang::TypedefNameDecl *typedef_decl = typedef_ty->getDecl(); |
| 625 | | const char *type_name = decl_name(typedef_decl); |
| 619 | const char *type_name = ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)typedef_decl); |
| 626 | 620 | if (strcmp(type_name, "uint8_t") == 0 || strcmp(type_name, "int8_t") == 0) { |
| 627 | 621 | return 8; |
| 628 | 622 | } else if (strcmp(type_name, "uint16_t") == 0 || strcmp(type_name, "int16_t") == 0) { |
| ... | ... | @@ -643,7 +637,7 @@ static uint32_t qual_type_int_bit_width(Context *c, const clang::QualType &qt, c |
| 643 | 637 | |
| 644 | 638 | |
| 645 | 639 | static AstNode *qual_type_to_log2_int_ref(Context *c, const clang::QualType &qt, |
| 646 | | const clang::SourceLocation &source_loc) |
| 640 | ZigClangSourceLocation source_loc) |
| 647 | 641 | { |
| 648 | 642 | uint32_t int_bit_width = qual_type_int_bit_width(c, qt, source_loc); |
| 649 | 643 | if (int_bit_width != 0) { |
| ... | ... | @@ -688,7 +682,7 @@ static bool qual_type_child_is_fn_proto(const clang::QualType &qt) { |
| 688 | 682 | return false; |
| 689 | 683 | } |
| 690 | 684 | |
| 691 | | static AstNode* trans_c_cast(Context *c, const clang::SourceLocation &source_location, clang::QualType dest_type, |
| 685 | static AstNode* trans_c_cast(Context *c, ZigClangSourceLocation source_location, clang::QualType dest_type, |
| 692 | 686 | clang::QualType src_type, AstNode *expr) |
| 693 | 687 | { |
| 694 | 688 | // The only way void pointer casts are valid C code, is if |
| ... | ... | @@ -788,7 +782,7 @@ static bool qual_type_has_wrapping_overflow(Context *c, clang::QualType qt) { |
| 788 | 782 | } |
| 789 | 783 | } |
| 790 | 784 | |
| 791 | | static bool type_is_opaque(Context *c, const clang::Type *ty, const clang::SourceLocation &source_loc) { |
| 785 | static bool type_is_opaque(Context *c, const clang::Type *ty, ZigClangSourceLocation source_loc) { |
| 792 | 786 | switch (ty->getTypeClass()) { |
| 793 | 787 | case clang::Type::Builtin: { |
| 794 | 788 | const clang::BuiltinType *builtin_ty = static_cast<const clang::BuiltinType*>(ty); |
| ... | ... | @@ -812,7 +806,7 @@ static bool type_is_opaque(Context *c, const clang::Type *ty, const clang::Sourc |
| 812 | 806 | } |
| 813 | 807 | } |
| 814 | 808 | |
| 815 | | static AstNode *trans_type(Context *c, const clang::Type *ty, const clang::SourceLocation &source_loc) { |
| 809 | static AstNode *trans_type(Context *c, const clang::Type *ty, ZigClangSourceLocation source_loc) { |
| 816 | 810 | switch (ty->getTypeClass()) { |
| 817 | 811 | case clang::Type::Builtin: |
| 818 | 812 | { |
| ... | ... | @@ -1129,8 +1123,8 @@ static AstNode *trans_type(Context *c, const clang::Type *ty, const clang::Sourc |
| 1129 | 1123 | } |
| 1130 | 1124 | case clang::Type::Record: |
| 1131 | 1125 | { |
| 1132 | | const clang::RecordType *record_ty = static_cast<const clang::RecordType*>(ty); |
| 1133 | | return resolve_record_decl(c, record_ty->getDecl()); |
| 1126 | const ZigClangRecordType *record_ty = reinterpret_cast<const ZigClangRecordType*>(ty); |
| 1127 | return resolve_record_decl(c, ZigClangRecordType_getDecl(record_ty)); |
| 1134 | 1128 | } |
| 1135 | 1129 | case clang::Type::Enum: |
| 1136 | 1130 | { |
| ... | ... | @@ -1217,7 +1211,7 @@ static AstNode *trans_type(Context *c, const clang::Type *ty, const clang::Sourc |
| 1217 | 1211 | zig_unreachable(); |
| 1218 | 1212 | } |
| 1219 | 1213 | |
| 1220 | | static AstNode *trans_qual_type(Context *c, clang::QualType qt, const clang::SourceLocation &source_loc) { |
| 1214 | static AstNode *trans_qual_type(Context *c, clang::QualType qt, ZigClangSourceLocation source_loc) { |
| 1221 | 1215 | return trans_type(c, qt.getTypePtr(), source_loc); |
| 1222 | 1216 | } |
| 1223 | 1217 | |
| ... | ... | @@ -1289,7 +1283,7 @@ static AstNode *trans_return_stmt(Context *c, TransScope *scope, const clang::Re |
| 1289 | 1283 | static AstNode *trans_integer_literal(Context *c, ResultUsed result_used, const clang::IntegerLiteral *stmt) { |
| 1290 | 1284 | clang::Expr::EvalResult result; |
| 1291 | 1285 | if (!stmt->EvaluateAsInt(result, *reinterpret_cast<clang::ASTContext *>(c->ctx))) { |
| 1292 | | emit_warning(c, stmt->getBeginLoc(), "invalid integer literal"); |
| 1286 | emit_warning(c, bitcast(stmt->getBeginLoc()), "invalid integer literal"); |
| 1293 | 1287 | return nullptr; |
| 1294 | 1288 | } |
| 1295 | 1289 | AstNode *node = trans_create_node_apint(c, result.Val.getInt()); |
| ... | ... | @@ -1301,10 +1295,10 @@ static AstNode *trans_constant_expr(Context *c, ResultUsed result_used, const cl |
| 1301 | 1295 | if (!expr->EvaluateAsConstantExpr(result, clang::Expr::EvaluateForCodeGen, |
| 1302 | 1296 | *reinterpret_cast<clang::ASTContext *>(c->ctx))) |
| 1303 | 1297 | { |
| 1304 | | emit_warning(c, expr->getBeginLoc(), "invalid constant expression"); |
| 1298 | emit_warning(c, bitcast(expr->getBeginLoc()), "invalid constant expression"); |
| 1305 | 1299 | return nullptr; |
| 1306 | 1300 | } |
| 1307 | | AstNode *node = trans_ap_value(c, &result.Val, expr->getType(), expr->getBeginLoc()); |
| 1301 | AstNode *node = trans_ap_value(c, &result.Val, expr->getType(), bitcast(expr->getBeginLoc())); |
| 1308 | 1302 | return maybe_suppress_result(c, result_used, node); |
| 1309 | 1303 | } |
| 1310 | 1304 | |
| ... | ... | @@ -1417,7 +1411,7 @@ static AstNode *trans_create_assign(Context *c, ResultUsed result_used, TransSco |
| 1417 | 1411 | static AstNode *trans_create_shift_op(Context *c, TransScope *scope, clang::QualType result_type, |
| 1418 | 1412 | clang::Expr *lhs_expr, BinOpType bin_op, clang::Expr *rhs_expr) |
| 1419 | 1413 | { |
| 1420 | | const clang::SourceLocation &rhs_location = rhs_expr->getBeginLoc(); |
| 1414 | ZigClangSourceLocation rhs_location = bitcast(rhs_expr->getBeginLoc()); |
| 1421 | 1415 | AstNode *rhs_type = qual_type_to_log2_int_ref(c, result_type, rhs_location); |
| 1422 | 1416 | // lhs >> u5(rh) |
| 1423 | 1417 | |
| ... | ... | @@ -1434,13 +1428,13 @@ static AstNode *trans_create_shift_op(Context *c, TransScope *scope, clang::Qual |
| 1434 | 1428 | static AstNode *trans_binary_operator(Context *c, ResultUsed result_used, TransScope *scope, const clang::BinaryOperator *stmt) { |
| 1435 | 1429 | switch (stmt->getOpcode()) { |
| 1436 | 1430 | case clang::BO_PtrMemD: |
| 1437 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle more C binary operators: BO_PtrMemD"); |
| 1431 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle more C binary operators: BO_PtrMemD"); |
| 1438 | 1432 | return nullptr; |
| 1439 | 1433 | case clang::BO_PtrMemI: |
| 1440 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle more C binary operators: BO_PtrMemI"); |
| 1434 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle more C binary operators: BO_PtrMemI"); |
| 1441 | 1435 | return nullptr; |
| 1442 | 1436 | case clang::BO_Cmp: |
| 1443 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle more C binary operators: BO_Cmp"); |
| 1437 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle more C binary operators: BO_Cmp"); |
| 1444 | 1438 | return nullptr; |
| 1445 | 1439 | case clang::BO_Mul: { |
| 1446 | 1440 | AstNode *node = trans_create_bin_op(c, scope, stmt->getLHS(), |
| ... | ... | @@ -1584,7 +1578,7 @@ static AstNode *trans_binary_operator(Context *c, ResultUsed result_used, TransS |
| 1584 | 1578 | static AstNode *trans_create_compound_assign_shift(Context *c, ResultUsed result_used, TransScope *scope, |
| 1585 | 1579 | const clang::CompoundAssignOperator *stmt, BinOpType assign_op, BinOpType bin_op) |
| 1586 | 1580 | { |
| 1587 | | const clang::SourceLocation &rhs_location = stmt->getRHS()->getBeginLoc(); |
| 1581 | ZigClangSourceLocation rhs_location = bitcast(stmt->getRHS()->getBeginLoc()); |
| 1588 | 1582 | AstNode *rhs_type = qual_type_to_log2_int_ref(c, stmt->getComputationLHSType(), rhs_location); |
| 1589 | 1583 | |
| 1590 | 1584 | bool use_intermediate_casts = stmt->getComputationLHSType().getTypePtr() != stmt->getComputationResultType().getTypePtr(); |
| ... | ... | @@ -1733,13 +1727,13 @@ static AstNode *trans_compound_assign_operator(Context *c, ResultUsed result_use |
| 1733 | 1727 | else |
| 1734 | 1728 | return trans_create_compound_assign(c, result_used, scope, stmt, BinOpTypeAssignTimes, BinOpTypeMult); |
| 1735 | 1729 | case clang::BO_DivAssign: |
| 1736 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle more C compound assign operators: BO_DivAssign"); |
| 1730 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle more C compound assign operators: BO_DivAssign"); |
| 1737 | 1731 | return nullptr; |
| 1738 | 1732 | case clang::BO_RemAssign: |
| 1739 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle more C compound assign operators: BO_RemAssign"); |
| 1733 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle more C compound assign operators: BO_RemAssign"); |
| 1740 | 1734 | return nullptr; |
| 1741 | 1735 | case clang::BO_Cmp: |
| 1742 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle more C compound assign operators: BO_Cmp"); |
| 1736 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle more C compound assign operators: BO_Cmp"); |
| 1743 | 1737 | return nullptr; |
| 1744 | 1738 | case clang::BO_AddAssign: |
| 1745 | 1739 | if (qual_type_has_wrapping_overflow(c, stmt->getType())) |
| ... | ... | @@ -1798,7 +1792,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 1798 | 1792 | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, stmt->getSubExpr(), TransRValue); |
| 1799 | 1793 | if (target_node == nullptr) |
| 1800 | 1794 | return nullptr; |
| 1801 | | AstNode *node = trans_c_cast(c, stmt->getExprLoc(), stmt->getType(), |
| 1795 | AstNode *node = trans_c_cast(c, bitcast(stmt->getExprLoc()), stmt->getType(), |
| 1802 | 1796 | stmt->getSubExpr()->getType(), target_node); |
| 1803 | 1797 | return maybe_suppress_result(c, result_used, node); |
| 1804 | 1798 | } |
| ... | ... | @@ -1832,160 +1826,160 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 1832 | 1826 | case clang::CK_NoOp: |
| 1833 | 1827 | return trans_expr(c, ResultUsedYes, scope, stmt->getSubExpr(), TransRValue); |
| 1834 | 1828 | case clang::CK_Dependent: |
| 1835 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_Dependent"); |
| 1829 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_Dependent"); |
| 1836 | 1830 | return nullptr; |
| 1837 | 1831 | case clang::CK_LValueBitCast: |
| 1838 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_LValueBitCast"); |
| 1832 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_LValueBitCast"); |
| 1839 | 1833 | return nullptr; |
| 1840 | 1834 | case clang::CK_BaseToDerived: |
| 1841 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_BaseToDerived"); |
| 1835 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_BaseToDerived"); |
| 1842 | 1836 | return nullptr; |
| 1843 | 1837 | case clang::CK_DerivedToBase: |
| 1844 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_DerivedToBase"); |
| 1838 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_DerivedToBase"); |
| 1845 | 1839 | return nullptr; |
| 1846 | 1840 | case clang::CK_UncheckedDerivedToBase: |
| 1847 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_UncheckedDerivedToBase"); |
| 1841 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_UncheckedDerivedToBase"); |
| 1848 | 1842 | return nullptr; |
| 1849 | 1843 | case clang::CK_Dynamic: |
| 1850 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_Dynamic"); |
| 1844 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_Dynamic"); |
| 1851 | 1845 | return nullptr; |
| 1852 | 1846 | case clang::CK_ToUnion: |
| 1853 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_ToUnion"); |
| 1847 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_ToUnion"); |
| 1854 | 1848 | return nullptr; |
| 1855 | 1849 | case clang::CK_NullToMemberPointer: |
| 1856 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_NullToMemberPointer"); |
| 1850 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_NullToMemberPointer"); |
| 1857 | 1851 | return nullptr; |
| 1858 | 1852 | case clang::CK_BaseToDerivedMemberPointer: |
| 1859 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_BaseToDerivedMemberPointer"); |
| 1853 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_BaseToDerivedMemberPointer"); |
| 1860 | 1854 | return nullptr; |
| 1861 | 1855 | case clang::CK_DerivedToBaseMemberPointer: |
| 1862 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_DerivedToBaseMemberPointer"); |
| 1856 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_DerivedToBaseMemberPointer"); |
| 1863 | 1857 | return nullptr; |
| 1864 | 1858 | case clang::CK_MemberPointerToBoolean: |
| 1865 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_MemberPointerToBoolean"); |
| 1859 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_MemberPointerToBoolean"); |
| 1866 | 1860 | return nullptr; |
| 1867 | 1861 | case clang::CK_ReinterpretMemberPointer: |
| 1868 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_ReinterpretMemberPointer"); |
| 1862 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_ReinterpretMemberPointer"); |
| 1869 | 1863 | return nullptr; |
| 1870 | 1864 | case clang::CK_UserDefinedConversion: |
| 1871 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_UserDefinedConversion"); |
| 1865 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation cast CK_UserDefinedConversion"); |
| 1872 | 1866 | return nullptr; |
| 1873 | 1867 | case clang::CK_ConstructorConversion: |
| 1874 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_ConstructorConversion"); |
| 1868 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ConstructorConversion"); |
| 1875 | 1869 | return nullptr; |
| 1876 | 1870 | case clang::CK_IntegralToPointer: |
| 1877 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_IntegralToPointer"); |
| 1871 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralToPointer"); |
| 1878 | 1872 | return nullptr; |
| 1879 | 1873 | case clang::CK_PointerToIntegral: |
| 1880 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_PointerToIntegral"); |
| 1874 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_PointerToIntegral"); |
| 1881 | 1875 | return nullptr; |
| 1882 | 1876 | case clang::CK_PointerToBoolean: |
| 1883 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_PointerToBoolean"); |
| 1877 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_PointerToBoolean"); |
| 1884 | 1878 | return nullptr; |
| 1885 | 1879 | case clang::CK_ToVoid: |
| 1886 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_ToVoid"); |
| 1880 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ToVoid"); |
| 1887 | 1881 | return nullptr; |
| 1888 | 1882 | case clang::CK_VectorSplat: |
| 1889 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_VectorSplat"); |
| 1883 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_VectorSplat"); |
| 1890 | 1884 | return nullptr; |
| 1891 | 1885 | case clang::CK_IntegralToBoolean: |
| 1892 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_IntegralToBoolean"); |
| 1886 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralToBoolean"); |
| 1893 | 1887 | return nullptr; |
| 1894 | 1888 | case clang::CK_IntegralToFloating: |
| 1895 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_IntegralToFloating"); |
| 1889 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralToFloating"); |
| 1896 | 1890 | return nullptr; |
| 1897 | 1891 | case clang::CK_FixedPointCast: |
| 1898 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_FixedPointCast"); |
| 1892 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FixedPointCast"); |
| 1899 | 1893 | return nullptr; |
| 1900 | 1894 | case clang::CK_FixedPointToBoolean: |
| 1901 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_FixedPointToBoolean"); |
| 1895 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FixedPointToBoolean"); |
| 1902 | 1896 | return nullptr; |
| 1903 | 1897 | case clang::CK_FloatingToIntegral: |
| 1904 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_FloatingToIntegral"); |
| 1898 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingToIntegral"); |
| 1905 | 1899 | return nullptr; |
| 1906 | 1900 | case clang::CK_FloatingToBoolean: |
| 1907 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_FloatingToBoolean"); |
| 1901 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingToBoolean"); |
| 1908 | 1902 | return nullptr; |
| 1909 | 1903 | case clang::CK_BooleanToSignedIntegral: |
| 1910 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_BooleanToSignedIntegral"); |
| 1904 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_BooleanToSignedIntegral"); |
| 1911 | 1905 | return nullptr; |
| 1912 | 1906 | case clang::CK_FloatingCast: |
| 1913 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_FloatingCast"); |
| 1907 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingCast"); |
| 1914 | 1908 | return nullptr; |
| 1915 | 1909 | case clang::CK_CPointerToObjCPointerCast: |
| 1916 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_CPointerToObjCPointerCast"); |
| 1910 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_CPointerToObjCPointerCast"); |
| 1917 | 1911 | return nullptr; |
| 1918 | 1912 | case clang::CK_BlockPointerToObjCPointerCast: |
| 1919 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_BlockPointerToObjCPointerCast"); |
| 1913 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_BlockPointerToObjCPointerCast"); |
| 1920 | 1914 | return nullptr; |
| 1921 | 1915 | case clang::CK_AnyPointerToBlockPointerCast: |
| 1922 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_AnyPointerToBlockPointerCast"); |
| 1916 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_AnyPointerToBlockPointerCast"); |
| 1923 | 1917 | return nullptr; |
| 1924 | 1918 | case clang::CK_ObjCObjectLValueCast: |
| 1925 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_ObjCObjectLValueCast"); |
| 1919 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ObjCObjectLValueCast"); |
| 1926 | 1920 | return nullptr; |
| 1927 | 1921 | case clang::CK_FloatingRealToComplex: |
| 1928 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_FloatingRealToComplex"); |
| 1922 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingRealToComplex"); |
| 1929 | 1923 | return nullptr; |
| 1930 | 1924 | case clang::CK_FloatingComplexToReal: |
| 1931 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_FloatingComplexToReal"); |
| 1925 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingComplexToReal"); |
| 1932 | 1926 | return nullptr; |
| 1933 | 1927 | case clang::CK_FloatingComplexToBoolean: |
| 1934 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_FloatingComplexToBoolean"); |
| 1928 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingComplexToBoolean"); |
| 1935 | 1929 | return nullptr; |
| 1936 | 1930 | case clang::CK_FloatingComplexCast: |
| 1937 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_FloatingComplexCast"); |
| 1931 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingComplexCast"); |
| 1938 | 1932 | return nullptr; |
| 1939 | 1933 | case clang::CK_FloatingComplexToIntegralComplex: |
| 1940 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_FloatingComplexToIntegralComplex"); |
| 1934 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_FloatingComplexToIntegralComplex"); |
| 1941 | 1935 | return nullptr; |
| 1942 | 1936 | case clang::CK_IntegralRealToComplex: |
| 1943 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_IntegralRealToComplex"); |
| 1937 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralRealToComplex"); |
| 1944 | 1938 | return nullptr; |
| 1945 | 1939 | case clang::CK_IntegralComplexToReal: |
| 1946 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_IntegralComplexToReal"); |
| 1940 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralComplexToReal"); |
| 1947 | 1941 | return nullptr; |
| 1948 | 1942 | case clang::CK_IntegralComplexToBoolean: |
| 1949 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_IntegralComplexToBoolean"); |
| 1943 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralComplexToBoolean"); |
| 1950 | 1944 | return nullptr; |
| 1951 | 1945 | case clang::CK_IntegralComplexCast: |
| 1952 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_IntegralComplexCast"); |
| 1946 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralComplexCast"); |
| 1953 | 1947 | return nullptr; |
| 1954 | 1948 | case clang::CK_IntegralComplexToFloatingComplex: |
| 1955 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_IntegralComplexToFloatingComplex"); |
| 1949 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntegralComplexToFloatingComplex"); |
| 1956 | 1950 | return nullptr; |
| 1957 | 1951 | case clang::CK_ARCProduceObject: |
| 1958 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_ARCProduceObject"); |
| 1952 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ARCProduceObject"); |
| 1959 | 1953 | return nullptr; |
| 1960 | 1954 | case clang::CK_ARCConsumeObject: |
| 1961 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_ARCConsumeObject"); |
| 1955 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ARCConsumeObject"); |
| 1962 | 1956 | return nullptr; |
| 1963 | 1957 | case clang::CK_ARCReclaimReturnedObject: |
| 1964 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_ARCReclaimReturnedObject"); |
| 1958 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ARCReclaimReturnedObject"); |
| 1965 | 1959 | return nullptr; |
| 1966 | 1960 | case clang::CK_ARCExtendBlockObject: |
| 1967 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_ARCExtendBlockObject"); |
| 1961 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ARCExtendBlockObject"); |
| 1968 | 1962 | return nullptr; |
| 1969 | 1963 | case clang::CK_AtomicToNonAtomic: |
| 1970 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_AtomicToNonAtomic"); |
| 1964 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_AtomicToNonAtomic"); |
| 1971 | 1965 | return nullptr; |
| 1972 | 1966 | case clang::CK_NonAtomicToAtomic: |
| 1973 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_NonAtomicToAtomic"); |
| 1967 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_NonAtomicToAtomic"); |
| 1974 | 1968 | return nullptr; |
| 1975 | 1969 | case clang::CK_CopyAndAutoreleaseBlockObject: |
| 1976 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_CopyAndAutoreleaseBlockObject"); |
| 1970 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_CopyAndAutoreleaseBlockObject"); |
| 1977 | 1971 | return nullptr; |
| 1978 | 1972 | case clang::CK_BuiltinFnToFnPtr: |
| 1979 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_BuiltinFnToFnPtr"); |
| 1973 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_BuiltinFnToFnPtr"); |
| 1980 | 1974 | return nullptr; |
| 1981 | 1975 | case clang::CK_ZeroToOCLOpaqueType: |
| 1982 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_ZeroToOCLOpaqueType"); |
| 1976 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_ZeroToOCLOpaqueType"); |
| 1983 | 1977 | return nullptr; |
| 1984 | 1978 | case clang::CK_AddressSpaceConversion: |
| 1985 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_AddressSpaceConversion"); |
| 1979 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_AddressSpaceConversion"); |
| 1986 | 1980 | return nullptr; |
| 1987 | 1981 | case clang::CK_IntToOCLSampler: |
| 1988 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CK_IntToOCLSampler"); |
| 1982 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CK_IntToOCLSampler"); |
| 1989 | 1983 | return nullptr; |
| 1990 | 1984 | } |
| 1991 | 1985 | zig_unreachable(); |
| ... | ... | @@ -1993,7 +1987,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, ResultUsed result_used, Tra |
| 1993 | 1987 | |
| 1994 | 1988 | static AstNode *trans_decl_ref_expr(Context *c, TransScope *scope, const clang::DeclRefExpr *stmt, TransLRValue lrval) { |
| 1995 | 1989 | const clang::ValueDecl *value_decl = stmt->getDecl(); |
| 1996 | | Buf *c_symbol_name = buf_create_from_str(decl_name(value_decl)); |
| 1990 | Buf *c_symbol_name = buf_create_from_str(ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)value_decl)); |
| 1997 | 1991 | Buf *zig_symbol_name = trans_lookup_zig_symbol(c, scope, c_symbol_name); |
| 1998 | 1992 | if (lrval == TransLValue) { |
| 1999 | 1993 | c->ptr_params.put(zig_symbol_name, true); |
| ... | ... | @@ -2148,7 +2142,7 @@ static AstNode *trans_unary_operator(Context *c, ResultUsed result_used, TransSc |
| 2148 | 2142 | return trans_create_node_ptr_deref(c, unwrapped); |
| 2149 | 2143 | } |
| 2150 | 2144 | case clang::UO_Plus: |
| 2151 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation UO_Plus"); |
| 2145 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation UO_Plus"); |
| 2152 | 2146 | return nullptr; |
| 2153 | 2147 | case clang::UO_Minus: |
| 2154 | 2148 | { |
| ... | ... | @@ -2174,7 +2168,7 @@ static AstNode *trans_unary_operator(Context *c, ResultUsed result_used, TransSc |
| 2174 | 2168 | node->data.bin_op_expr.bin_op = BinOpTypeSubWrap; |
| 2175 | 2169 | return node; |
| 2176 | 2170 | } else { |
| 2177 | | emit_warning(c, stmt->getBeginLoc(), "C negation with non float non integer"); |
| 2171 | emit_warning(c, bitcast(stmt->getBeginLoc()), "C negation with non float non integer"); |
| 2178 | 2172 | return nullptr; |
| 2179 | 2173 | } |
| 2180 | 2174 | } |
| ... | ... | @@ -2197,15 +2191,15 @@ static AstNode *trans_unary_operator(Context *c, ResultUsed result_used, TransSc |
| 2197 | 2191 | return trans_create_node_prefix_op(c, PrefixOpBoolNot, sub_node); |
| 2198 | 2192 | } |
| 2199 | 2193 | case clang::UO_Real: |
| 2200 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation UO_Real"); |
| 2194 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation UO_Real"); |
| 2201 | 2195 | return nullptr; |
| 2202 | 2196 | case clang::UO_Imag: |
| 2203 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation UO_Imag"); |
| 2197 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation UO_Imag"); |
| 2204 | 2198 | return nullptr; |
| 2205 | 2199 | case clang::UO_Extension: |
| 2206 | 2200 | return trans_expr(c, result_used, scope, stmt->getSubExpr(), TransLValue); |
| 2207 | 2201 | case clang::UO_Coawait: |
| 2208 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation UO_Coawait"); |
| 2202 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C translation UO_Coawait"); |
| 2209 | 2203 | return nullptr; |
| 2210 | 2204 | } |
| 2211 | 2205 | zig_unreachable(); |
| ... | ... | @@ -2235,11 +2229,11 @@ static int trans_local_declaration(Context *c, TransScope *scope, const clang::D |
| 2235 | 2229 | } else { |
| 2236 | 2230 | init_node = trans_create_node(c, NodeTypeUndefinedLiteral); |
| 2237 | 2231 | } |
| 2238 | | AstNode *type_node = trans_qual_type(c, qual_type, stmt->getBeginLoc()); |
| 2232 | AstNode *type_node = trans_qual_type(c, qual_type, bitcast(stmt->getBeginLoc())); |
| 2239 | 2233 | if (type_node == nullptr) |
| 2240 | 2234 | return ErrorUnexpected; |
| 2241 | 2235 | |
| 2242 | | Buf *c_symbol_name = buf_create_from_str(decl_name(var_decl)); |
| 2236 | Buf *c_symbol_name = buf_create_from_str(ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)var_decl)); |
| 2243 | 2237 | |
| 2244 | 2238 | TransScopeVar *var_scope = trans_scope_var_create(c, scope, c_symbol_name); |
| 2245 | 2239 | scope = &var_scope->base; |
| ... | ... | @@ -2251,223 +2245,223 @@ static int trans_local_declaration(Context *c, TransScope *scope, const clang::D |
| 2251 | 2245 | continue; |
| 2252 | 2246 | } |
| 2253 | 2247 | case clang::Decl::AccessSpec: |
| 2254 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle decl kind AccessSpec"); |
| 2248 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle decl kind AccessSpec"); |
| 2255 | 2249 | return ErrorUnexpected; |
| 2256 | 2250 | case clang::Decl::Block: |
| 2257 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Block"); |
| 2251 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Block"); |
| 2258 | 2252 | return ErrorUnexpected; |
| 2259 | 2253 | case clang::Decl::Captured: |
| 2260 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Captured"); |
| 2254 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Captured"); |
| 2261 | 2255 | return ErrorUnexpected; |
| 2262 | 2256 | case clang::Decl::ClassScopeFunctionSpecialization: |
| 2263 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ClassScopeFunctionSpecialization"); |
| 2257 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ClassScopeFunctionSpecialization"); |
| 2264 | 2258 | return ErrorUnexpected; |
| 2265 | 2259 | case clang::Decl::Empty: |
| 2266 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Empty"); |
| 2260 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Empty"); |
| 2267 | 2261 | return ErrorUnexpected; |
| 2268 | 2262 | case clang::Decl::Export: |
| 2269 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Export"); |
| 2263 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Export"); |
| 2270 | 2264 | return ErrorUnexpected; |
| 2271 | 2265 | case clang::Decl::ExternCContext: |
| 2272 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ExternCContext"); |
| 2266 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ExternCContext"); |
| 2273 | 2267 | return ErrorUnexpected; |
| 2274 | 2268 | case clang::Decl::FileScopeAsm: |
| 2275 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C FileScopeAsm"); |
| 2269 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C FileScopeAsm"); |
| 2276 | 2270 | return ErrorUnexpected; |
| 2277 | 2271 | case clang::Decl::Friend: |
| 2278 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Friend"); |
| 2272 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Friend"); |
| 2279 | 2273 | return ErrorUnexpected; |
| 2280 | 2274 | case clang::Decl::FriendTemplate: |
| 2281 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C FriendTemplate"); |
| 2275 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C FriendTemplate"); |
| 2282 | 2276 | return ErrorUnexpected; |
| 2283 | 2277 | case clang::Decl::Import: |
| 2284 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Import"); |
| 2278 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Import"); |
| 2285 | 2279 | return ErrorUnexpected; |
| 2286 | 2280 | case clang::Decl::LinkageSpec: |
| 2287 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C LinkageSpec"); |
| 2281 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C LinkageSpec"); |
| 2288 | 2282 | return ErrorUnexpected; |
| 2289 | 2283 | case clang::Decl::Label: |
| 2290 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Label"); |
| 2284 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Label"); |
| 2291 | 2285 | return ErrorUnexpected; |
| 2292 | 2286 | case clang::Decl::Namespace: |
| 2293 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Namespace"); |
| 2287 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Namespace"); |
| 2294 | 2288 | return ErrorUnexpected; |
| 2295 | 2289 | case clang::Decl::NamespaceAlias: |
| 2296 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C NamespaceAlias"); |
| 2290 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C NamespaceAlias"); |
| 2297 | 2291 | return ErrorUnexpected; |
| 2298 | 2292 | case clang::Decl::ObjCCompatibleAlias: |
| 2299 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCCompatibleAlias"); |
| 2293 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCCompatibleAlias"); |
| 2300 | 2294 | return ErrorUnexpected; |
| 2301 | 2295 | case clang::Decl::ObjCCategory: |
| 2302 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCCategory"); |
| 2296 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCCategory"); |
| 2303 | 2297 | return ErrorUnexpected; |
| 2304 | 2298 | case clang::Decl::ObjCCategoryImpl: |
| 2305 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCCategoryImpl"); |
| 2299 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCCategoryImpl"); |
| 2306 | 2300 | return ErrorUnexpected; |
| 2307 | 2301 | case clang::Decl::ObjCImplementation: |
| 2308 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCImplementation"); |
| 2302 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCImplementation"); |
| 2309 | 2303 | return ErrorUnexpected; |
| 2310 | 2304 | case clang::Decl::ObjCInterface: |
| 2311 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCInterface"); |
| 2305 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCInterface"); |
| 2312 | 2306 | return ErrorUnexpected; |
| 2313 | 2307 | case clang::Decl::ObjCProtocol: |
| 2314 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCProtocol"); |
| 2308 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCProtocol"); |
| 2315 | 2309 | return ErrorUnexpected; |
| 2316 | 2310 | case clang::Decl::ObjCMethod: |
| 2317 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCMethod"); |
| 2311 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCMethod"); |
| 2318 | 2312 | return ErrorUnexpected; |
| 2319 | 2313 | case clang::Decl::ObjCProperty: |
| 2320 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCProperty"); |
| 2314 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCProperty"); |
| 2321 | 2315 | return ErrorUnexpected; |
| 2322 | 2316 | case clang::Decl::BuiltinTemplate: |
| 2323 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C BuiltinTemplate"); |
| 2317 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C BuiltinTemplate"); |
| 2324 | 2318 | return ErrorUnexpected; |
| 2325 | 2319 | case clang::Decl::ClassTemplate: |
| 2326 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ClassTemplate"); |
| 2320 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ClassTemplate"); |
| 2327 | 2321 | return ErrorUnexpected; |
| 2328 | 2322 | case clang::Decl::FunctionTemplate: |
| 2329 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C FunctionTemplate"); |
| 2323 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C FunctionTemplate"); |
| 2330 | 2324 | return ErrorUnexpected; |
| 2331 | 2325 | case clang::Decl::TypeAliasTemplate: |
| 2332 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C TypeAliasTemplate"); |
| 2326 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C TypeAliasTemplate"); |
| 2333 | 2327 | return ErrorUnexpected; |
| 2334 | 2328 | case clang::Decl::VarTemplate: |
| 2335 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C VarTemplate"); |
| 2329 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C VarTemplate"); |
| 2336 | 2330 | return ErrorUnexpected; |
| 2337 | 2331 | case clang::Decl::TemplateTemplateParm: |
| 2338 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C TemplateTemplateParm"); |
| 2332 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C TemplateTemplateParm"); |
| 2339 | 2333 | return ErrorUnexpected; |
| 2340 | 2334 | case clang::Decl::Enum: |
| 2341 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Enum"); |
| 2335 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Enum"); |
| 2342 | 2336 | return ErrorUnexpected; |
| 2343 | 2337 | case clang::Decl::Record: |
| 2344 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Record"); |
| 2338 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Record"); |
| 2345 | 2339 | return ErrorUnexpected; |
| 2346 | 2340 | case clang::Decl::CXXRecord: |
| 2347 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXRecord"); |
| 2341 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXRecord"); |
| 2348 | 2342 | return ErrorUnexpected; |
| 2349 | 2343 | case clang::Decl::ClassTemplateSpecialization: |
| 2350 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ClassTemplateSpecialization"); |
| 2344 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ClassTemplateSpecialization"); |
| 2351 | 2345 | return ErrorUnexpected; |
| 2352 | 2346 | case clang::Decl::ClassTemplatePartialSpecialization: |
| 2353 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ClassTemplatePartialSpecialization"); |
| 2347 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ClassTemplatePartialSpecialization"); |
| 2354 | 2348 | return ErrorUnexpected; |
| 2355 | 2349 | case clang::Decl::TemplateTypeParm: |
| 2356 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C TemplateTypeParm"); |
| 2350 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C TemplateTypeParm"); |
| 2357 | 2351 | return ErrorUnexpected; |
| 2358 | 2352 | case clang::Decl::ObjCTypeParam: |
| 2359 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCTypeParam"); |
| 2353 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCTypeParam"); |
| 2360 | 2354 | return ErrorUnexpected; |
| 2361 | 2355 | case clang::Decl::TypeAlias: |
| 2362 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C TypeAlias"); |
| 2356 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C TypeAlias"); |
| 2363 | 2357 | return ErrorUnexpected; |
| 2364 | 2358 | case clang::Decl::Typedef: |
| 2365 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Typedef"); |
| 2359 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Typedef"); |
| 2366 | 2360 | return ErrorUnexpected; |
| 2367 | 2361 | case clang::Decl::UnresolvedUsingTypename: |
| 2368 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C UnresolvedUsingTypename"); |
| 2362 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C UnresolvedUsingTypename"); |
| 2369 | 2363 | return ErrorUnexpected; |
| 2370 | 2364 | case clang::Decl::Using: |
| 2371 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Using"); |
| 2365 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Using"); |
| 2372 | 2366 | return ErrorUnexpected; |
| 2373 | 2367 | case clang::Decl::UsingDirective: |
| 2374 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C UsingDirective"); |
| 2368 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C UsingDirective"); |
| 2375 | 2369 | return ErrorUnexpected; |
| 2376 | 2370 | case clang::Decl::UsingPack: |
| 2377 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C UsingPack"); |
| 2371 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C UsingPack"); |
| 2378 | 2372 | return ErrorUnexpected; |
| 2379 | 2373 | case clang::Decl::UsingShadow: |
| 2380 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C UsingShadow"); |
| 2374 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C UsingShadow"); |
| 2381 | 2375 | return ErrorUnexpected; |
| 2382 | 2376 | case clang::Decl::ConstructorUsingShadow: |
| 2383 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ConstructorUsingShadow"); |
| 2377 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ConstructorUsingShadow"); |
| 2384 | 2378 | return ErrorUnexpected; |
| 2385 | 2379 | case clang::Decl::Binding: |
| 2386 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Binding"); |
| 2380 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Binding"); |
| 2387 | 2381 | return ErrorUnexpected; |
| 2388 | 2382 | case clang::Decl::Field: |
| 2389 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Field"); |
| 2383 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Field"); |
| 2390 | 2384 | return ErrorUnexpected; |
| 2391 | 2385 | case clang::Decl::ObjCAtDefsField: |
| 2392 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCAtDefsField"); |
| 2386 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCAtDefsField"); |
| 2393 | 2387 | return ErrorUnexpected; |
| 2394 | 2388 | case clang::Decl::ObjCIvar: |
| 2395 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCIvar"); |
| 2389 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCIvar"); |
| 2396 | 2390 | return ErrorUnexpected; |
| 2397 | 2391 | case clang::Decl::Function: |
| 2398 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Function"); |
| 2392 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Function"); |
| 2399 | 2393 | return ErrorUnexpected; |
| 2400 | 2394 | case clang::Decl::CXXDeductionGuide: |
| 2401 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXDeductionGuide"); |
| 2395 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXDeductionGuide"); |
| 2402 | 2396 | return ErrorUnexpected; |
| 2403 | 2397 | case clang::Decl::CXXMethod: |
| 2404 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXMethod"); |
| 2398 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXMethod"); |
| 2405 | 2399 | return ErrorUnexpected; |
| 2406 | 2400 | case clang::Decl::CXXConstructor: |
| 2407 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXConstructor"); |
| 2401 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXConstructor"); |
| 2408 | 2402 | return ErrorUnexpected; |
| 2409 | 2403 | case clang::Decl::CXXConversion: |
| 2410 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXConversion"); |
| 2404 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXConversion"); |
| 2411 | 2405 | return ErrorUnexpected; |
| 2412 | 2406 | case clang::Decl::CXXDestructor: |
| 2413 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXDestructor"); |
| 2407 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXDestructor"); |
| 2414 | 2408 | return ErrorUnexpected; |
| 2415 | 2409 | case clang::Decl::MSProperty: |
| 2416 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C MSProperty"); |
| 2410 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C MSProperty"); |
| 2417 | 2411 | return ErrorUnexpected; |
| 2418 | 2412 | case clang::Decl::NonTypeTemplateParm: |
| 2419 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C NonTypeTemplateParm"); |
| 2413 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C NonTypeTemplateParm"); |
| 2420 | 2414 | return ErrorUnexpected; |
| 2421 | 2415 | case clang::Decl::Decomposition: |
| 2422 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C Decomposition"); |
| 2416 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C Decomposition"); |
| 2423 | 2417 | return ErrorUnexpected; |
| 2424 | 2418 | case clang::Decl::ImplicitParam: |
| 2425 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ImplicitParam"); |
| 2419 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ImplicitParam"); |
| 2426 | 2420 | return ErrorUnexpected; |
| 2427 | 2421 | case clang::Decl::OMPCapturedExpr: |
| 2428 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPCapturedExpr"); |
| 2422 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPCapturedExpr"); |
| 2429 | 2423 | return ErrorUnexpected; |
| 2430 | 2424 | case clang::Decl::ParmVar: |
| 2431 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ParmVar"); |
| 2425 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ParmVar"); |
| 2432 | 2426 | return ErrorUnexpected; |
| 2433 | 2427 | case clang::Decl::VarTemplateSpecialization: |
| 2434 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C VarTemplateSpecialization"); |
| 2428 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C VarTemplateSpecialization"); |
| 2435 | 2429 | return ErrorUnexpected; |
| 2436 | 2430 | case clang::Decl::VarTemplatePartialSpecialization: |
| 2437 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C VarTemplatePartialSpecialization"); |
| 2431 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C VarTemplatePartialSpecialization"); |
| 2438 | 2432 | return ErrorUnexpected; |
| 2439 | 2433 | case clang::Decl::EnumConstant: |
| 2440 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C EnumConstant"); |
| 2434 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C EnumConstant"); |
| 2441 | 2435 | return ErrorUnexpected; |
| 2442 | 2436 | case clang::Decl::IndirectField: |
| 2443 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C IndirectField"); |
| 2437 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C IndirectField"); |
| 2444 | 2438 | return ErrorUnexpected; |
| 2445 | 2439 | case clang::Decl::OMPDeclareReduction: |
| 2446 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPDeclareReduction"); |
| 2440 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPDeclareReduction"); |
| 2447 | 2441 | return ErrorUnexpected; |
| 2448 | 2442 | case clang::Decl::UnresolvedUsingValue: |
| 2449 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C UnresolvedUsingValue"); |
| 2443 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C UnresolvedUsingValue"); |
| 2450 | 2444 | return ErrorUnexpected; |
| 2451 | 2445 | case clang::Decl::OMPRequires: |
| 2452 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPRequires"); |
| 2446 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPRequires"); |
| 2453 | 2447 | return ErrorUnexpected; |
| 2454 | 2448 | case clang::Decl::OMPThreadPrivate: |
| 2455 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPThreadPrivate"); |
| 2449 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPThreadPrivate"); |
| 2456 | 2450 | return ErrorUnexpected; |
| 2457 | 2451 | case clang::Decl::ObjCPropertyImpl: |
| 2458 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCPropertyImpl"); |
| 2452 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCPropertyImpl"); |
| 2459 | 2453 | return ErrorUnexpected; |
| 2460 | 2454 | case clang::Decl::PragmaComment: |
| 2461 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C PragmaComment"); |
| 2455 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C PragmaComment"); |
| 2462 | 2456 | return ErrorUnexpected; |
| 2463 | 2457 | case clang::Decl::PragmaDetectMismatch: |
| 2464 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C PragmaDetectMismatch"); |
| 2458 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C PragmaDetectMismatch"); |
| 2465 | 2459 | return ErrorUnexpected; |
| 2466 | 2460 | case clang::Decl::StaticAssert: |
| 2467 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C StaticAssert"); |
| 2461 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C StaticAssert"); |
| 2468 | 2462 | return ErrorUnexpected; |
| 2469 | 2463 | case clang::Decl::TranslationUnit: |
| 2470 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C TranslationUnit"); |
| 2464 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C TranslationUnit"); |
| 2471 | 2465 | return ErrorUnexpected; |
| 2472 | 2466 | } |
| 2473 | 2467 | zig_unreachable(); |
| ... | ... | @@ -2689,7 +2683,7 @@ static AstNode *trans_bool_expr(Context *c, ResultUsed result_used, TransScope * |
| 2689 | 2683 | const clang::ElaboratedType *elaborated_ty = static_cast<const clang::ElaboratedType*>(ty); |
| 2690 | 2684 | switch (elaborated_ty->getKeyword()) { |
| 2691 | 2685 | case clang::ETK_Enum: { |
| 2692 | | AstNode *enum_type = trans_qual_type(c, elaborated_ty->getNamedType(), expr->getBeginLoc()); |
| 2686 | AstNode *enum_type = trans_qual_type(c, elaborated_ty->getNamedType(), bitcast(expr->getBeginLoc())); |
| 2693 | 2687 | return to_enum_zero_cmp(c, res, enum_type); |
| 2694 | 2688 | } |
| 2695 | 2689 | case clang::ETK_Struct: |
| ... | ... | @@ -2846,7 +2840,7 @@ static AstNode *trans_member_expr(Context *c, ResultUsed result_used, TransScope |
| 2846 | 2840 | container_node = trans_create_node_unwrap_null(c, container_node); |
| 2847 | 2841 | } |
| 2848 | 2842 | |
| 2849 | | const char *name = decl_name(stmt->getMemberDecl()); |
| 2843 | const char *name = ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)stmt->getMemberDecl()); |
| 2850 | 2844 | |
| 2851 | 2845 | AstNode *node = trans_create_node_field_access_str(c, container_node, name); |
| 2852 | 2846 | return maybe_suppress_result(c, result_used, node); |
| ... | ... | @@ -2875,7 +2869,7 @@ static AstNode *trans_c_style_cast_expr(Context *c, ResultUsed result_used, Tran |
| 2875 | 2869 | if (sub_expr_node == nullptr) |
| 2876 | 2870 | return nullptr; |
| 2877 | 2871 | |
| 2878 | | AstNode *cast = trans_c_cast(c, stmt->getBeginLoc(), stmt->getType(), stmt->getSubExpr()->getType(), sub_expr_node); |
| 2872 | AstNode *cast = trans_c_cast(c, bitcast(stmt->getBeginLoc()), stmt->getType(), stmt->getSubExpr()->getType(), sub_expr_node); |
| 2879 | 2873 | if (cast == nullptr) |
| 2880 | 2874 | return nullptr; |
| 2881 | 2875 | |
| ... | ... | @@ -2885,7 +2879,7 @@ static AstNode *trans_c_style_cast_expr(Context *c, ResultUsed result_used, Tran |
| 2885 | 2879 | static AstNode *trans_unary_expr_or_type_trait_expr(Context *c, ResultUsed result_used, |
| 2886 | 2880 | TransScope *scope, const clang::UnaryExprOrTypeTraitExpr *stmt) |
| 2887 | 2881 | { |
| 2888 | | AstNode *type_node = trans_qual_type(c, stmt->getTypeOfArgument(), stmt->getBeginLoc()); |
| 2882 | AstNode *type_node = trans_qual_type(c, stmt->getTypeOfArgument(), bitcast(stmt->getBeginLoc())); |
| 2889 | 2883 | if (type_node == nullptr) |
| 2890 | 2884 | return nullptr; |
| 2891 | 2885 | |
| ... | ... | @@ -3092,7 +3086,7 @@ static int trans_switch_case(Context *c, TransScope *parent_scope, const clang:: |
| 3092 | 3086 | *out_node = nullptr; |
| 3093 | 3087 | |
| 3094 | 3088 | if (stmt->getRHS() != nullptr) { |
| 3095 | | emit_warning(c, stmt->getBeginLoc(), "TODO support GNU switch case a ... b extension"); |
| 3089 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO support GNU switch case a ... b extension"); |
| 3096 | 3090 | return ErrorUnexpected; |
| 3097 | 3091 | } |
| 3098 | 3092 | |
| ... | ... | @@ -3177,13 +3171,13 @@ static AstNode *trans_string_literal(Context *c, ResultUsed result_used, TransSc |
| 3177 | 3171 | return maybe_suppress_result(c, result_used, node); |
| 3178 | 3172 | } |
| 3179 | 3173 | case clang::StringLiteral::UTF16: |
| 3180 | | emit_warning(c, stmt->getBeginLoc(), "TODO support UTF16 string literals"); |
| 3174 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO support UTF16 string literals"); |
| 3181 | 3175 | return nullptr; |
| 3182 | 3176 | case clang::StringLiteral::UTF32: |
| 3183 | | emit_warning(c, stmt->getBeginLoc(), "TODO support UTF32 string literals"); |
| 3177 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO support UTF32 string literals"); |
| 3184 | 3178 | return nullptr; |
| 3185 | 3179 | case clang::StringLiteral::Wide: |
| 3186 | | emit_warning(c, stmt->getBeginLoc(), "TODO support wide string literals"); |
| 3180 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO support wide string literals"); |
| 3187 | 3181 | return nullptr; |
| 3188 | 3182 | } |
| 3189 | 3183 | zig_unreachable(); |
| ... | ... | @@ -3328,505 +3322,505 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const clang::Stmt *st |
| 3328 | 3322 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3329 | 3323 | trans_stmt_expr(c, result_used, scope, (const clang::StmtExpr *)stmt, out_node_scope)); |
| 3330 | 3324 | case clang::Stmt::NoStmtClass: |
| 3331 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C NoStmtClass"); |
| 3325 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C NoStmtClass"); |
| 3332 | 3326 | return ErrorUnexpected; |
| 3333 | 3327 | case clang::Stmt::GCCAsmStmtClass: |
| 3334 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C GCCAsmStmtClass"); |
| 3328 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C GCCAsmStmtClass"); |
| 3335 | 3329 | return ErrorUnexpected; |
| 3336 | 3330 | case clang::Stmt::MSAsmStmtClass: |
| 3337 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C MSAsmStmtClass"); |
| 3331 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C MSAsmStmtClass"); |
| 3338 | 3332 | return ErrorUnexpected; |
| 3339 | 3333 | case clang::Stmt::AttributedStmtClass: |
| 3340 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C AttributedStmtClass"); |
| 3334 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C AttributedStmtClass"); |
| 3341 | 3335 | return ErrorUnexpected; |
| 3342 | 3336 | case clang::Stmt::CXXCatchStmtClass: |
| 3343 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXCatchStmtClass"); |
| 3337 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXCatchStmtClass"); |
| 3344 | 3338 | return ErrorUnexpected; |
| 3345 | 3339 | case clang::Stmt::CXXForRangeStmtClass: |
| 3346 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXForRangeStmtClass"); |
| 3340 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXForRangeStmtClass"); |
| 3347 | 3341 | return ErrorUnexpected; |
| 3348 | 3342 | case clang::Stmt::CXXTryStmtClass: |
| 3349 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXTryStmtClass"); |
| 3343 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXTryStmtClass"); |
| 3350 | 3344 | return ErrorUnexpected; |
| 3351 | 3345 | case clang::Stmt::CapturedStmtClass: |
| 3352 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CapturedStmtClass"); |
| 3346 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CapturedStmtClass"); |
| 3353 | 3347 | return ErrorUnexpected; |
| 3354 | 3348 | case clang::Stmt::CoreturnStmtClass: |
| 3355 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CoreturnStmtClass"); |
| 3349 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CoreturnStmtClass"); |
| 3356 | 3350 | return ErrorUnexpected; |
| 3357 | 3351 | case clang::Stmt::CoroutineBodyStmtClass: |
| 3358 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CoroutineBodyStmtClass"); |
| 3352 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CoroutineBodyStmtClass"); |
| 3359 | 3353 | return ErrorUnexpected; |
| 3360 | 3354 | case clang::Stmt::BinaryConditionalOperatorClass: |
| 3361 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C BinaryConditionalOperatorClass"); |
| 3355 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C BinaryConditionalOperatorClass"); |
| 3362 | 3356 | return ErrorUnexpected; |
| 3363 | 3357 | case clang::Stmt::AddrLabelExprClass: |
| 3364 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C AddrLabelExprClass"); |
| 3358 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C AddrLabelExprClass"); |
| 3365 | 3359 | return ErrorUnexpected; |
| 3366 | 3360 | case clang::Stmt::ArrayInitIndexExprClass: |
| 3367 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ArrayInitIndexExprClass"); |
| 3361 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ArrayInitIndexExprClass"); |
| 3368 | 3362 | return ErrorUnexpected; |
| 3369 | 3363 | case clang::Stmt::ArrayInitLoopExprClass: |
| 3370 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ArrayInitLoopExprClass"); |
| 3364 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ArrayInitLoopExprClass"); |
| 3371 | 3365 | return ErrorUnexpected; |
| 3372 | 3366 | case clang::Stmt::ArrayTypeTraitExprClass: |
| 3373 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ArrayTypeTraitExprClass"); |
| 3367 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ArrayTypeTraitExprClass"); |
| 3374 | 3368 | return ErrorUnexpected; |
| 3375 | 3369 | case clang::Stmt::AsTypeExprClass: |
| 3376 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C AsTypeExprClass"); |
| 3370 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C AsTypeExprClass"); |
| 3377 | 3371 | return ErrorUnexpected; |
| 3378 | 3372 | case clang::Stmt::AtomicExprClass: |
| 3379 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C AtomicExprClass"); |
| 3373 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C AtomicExprClass"); |
| 3380 | 3374 | return ErrorUnexpected; |
| 3381 | 3375 | case clang::Stmt::BlockExprClass: |
| 3382 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C BlockExprClass"); |
| 3376 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C BlockExprClass"); |
| 3383 | 3377 | return ErrorUnexpected; |
| 3384 | 3378 | case clang::Stmt::CXXBindTemporaryExprClass: |
| 3385 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXBindTemporaryExprClass"); |
| 3379 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXBindTemporaryExprClass"); |
| 3386 | 3380 | return ErrorUnexpected; |
| 3387 | 3381 | case clang::Stmt::CXXBoolLiteralExprClass: |
| 3388 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXBoolLiteralExprClass"); |
| 3382 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXBoolLiteralExprClass"); |
| 3389 | 3383 | return ErrorUnexpected; |
| 3390 | 3384 | case clang::Stmt::CXXConstructExprClass: |
| 3391 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXConstructExprClass"); |
| 3385 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXConstructExprClass"); |
| 3392 | 3386 | return ErrorUnexpected; |
| 3393 | 3387 | case clang::Stmt::CXXTemporaryObjectExprClass: |
| 3394 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXTemporaryObjectExprClass"); |
| 3388 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXTemporaryObjectExprClass"); |
| 3395 | 3389 | return ErrorUnexpected; |
| 3396 | 3390 | case clang::Stmt::CXXDefaultArgExprClass: |
| 3397 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXDefaultArgExprClass"); |
| 3391 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXDefaultArgExprClass"); |
| 3398 | 3392 | return ErrorUnexpected; |
| 3399 | 3393 | case clang::Stmt::CXXDefaultInitExprClass: |
| 3400 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXDefaultInitExprClass"); |
| 3394 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXDefaultInitExprClass"); |
| 3401 | 3395 | return ErrorUnexpected; |
| 3402 | 3396 | case clang::Stmt::CXXDeleteExprClass: |
| 3403 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXDeleteExprClass"); |
| 3397 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXDeleteExprClass"); |
| 3404 | 3398 | return ErrorUnexpected; |
| 3405 | 3399 | case clang::Stmt::CXXDependentScopeMemberExprClass: |
| 3406 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXDependentScopeMemberExprClass"); |
| 3400 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXDependentScopeMemberExprClass"); |
| 3407 | 3401 | return ErrorUnexpected; |
| 3408 | 3402 | case clang::Stmt::CXXFoldExprClass: |
| 3409 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXFoldExprClass"); |
| 3403 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXFoldExprClass"); |
| 3410 | 3404 | return ErrorUnexpected; |
| 3411 | 3405 | case clang::Stmt::CXXInheritedCtorInitExprClass: |
| 3412 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXInheritedCtorInitExprClass"); |
| 3406 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXInheritedCtorInitExprClass"); |
| 3413 | 3407 | return ErrorUnexpected; |
| 3414 | 3408 | case clang::Stmt::CXXNewExprClass: |
| 3415 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXNewExprClass"); |
| 3409 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXNewExprClass"); |
| 3416 | 3410 | return ErrorUnexpected; |
| 3417 | 3411 | case clang::Stmt::CXXNoexceptExprClass: |
| 3418 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXNoexceptExprClass"); |
| 3412 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXNoexceptExprClass"); |
| 3419 | 3413 | return ErrorUnexpected; |
| 3420 | 3414 | case clang::Stmt::CXXNullPtrLiteralExprClass: |
| 3421 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXNullPtrLiteralExprClass"); |
| 3415 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXNullPtrLiteralExprClass"); |
| 3422 | 3416 | return ErrorUnexpected; |
| 3423 | 3417 | case clang::Stmt::CXXPseudoDestructorExprClass: |
| 3424 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXPseudoDestructorExprClass"); |
| 3418 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXPseudoDestructorExprClass"); |
| 3425 | 3419 | return ErrorUnexpected; |
| 3426 | 3420 | case clang::Stmt::CXXScalarValueInitExprClass: |
| 3427 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXScalarValueInitExprClass"); |
| 3421 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXScalarValueInitExprClass"); |
| 3428 | 3422 | return ErrorUnexpected; |
| 3429 | 3423 | case clang::Stmt::CXXStdInitializerListExprClass: |
| 3430 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXStdInitializerListExprClass"); |
| 3424 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXStdInitializerListExprClass"); |
| 3431 | 3425 | return ErrorUnexpected; |
| 3432 | 3426 | case clang::Stmt::CXXThisExprClass: |
| 3433 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXThisExprClass"); |
| 3427 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXThisExprClass"); |
| 3434 | 3428 | return ErrorUnexpected; |
| 3435 | 3429 | case clang::Stmt::CXXThrowExprClass: |
| 3436 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXThrowExprClass"); |
| 3430 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXThrowExprClass"); |
| 3437 | 3431 | return ErrorUnexpected; |
| 3438 | 3432 | case clang::Stmt::CXXTypeidExprClass: |
| 3439 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXTypeidExprClass"); |
| 3433 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXTypeidExprClass"); |
| 3440 | 3434 | return ErrorUnexpected; |
| 3441 | 3435 | case clang::Stmt::CXXUnresolvedConstructExprClass: |
| 3442 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXUnresolvedConstructExprClass"); |
| 3436 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXUnresolvedConstructExprClass"); |
| 3443 | 3437 | return ErrorUnexpected; |
| 3444 | 3438 | case clang::Stmt::CXXUuidofExprClass: |
| 3445 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXUuidofExprClass"); |
| 3439 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXUuidofExprClass"); |
| 3446 | 3440 | return ErrorUnexpected; |
| 3447 | 3441 | case clang::Stmt::CUDAKernelCallExprClass: |
| 3448 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CUDAKernelCallExprClass"); |
| 3442 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CUDAKernelCallExprClass"); |
| 3449 | 3443 | return ErrorUnexpected; |
| 3450 | 3444 | case clang::Stmt::CXXMemberCallExprClass: |
| 3451 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXMemberCallExprClass"); |
| 3445 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXMemberCallExprClass"); |
| 3452 | 3446 | return ErrorUnexpected; |
| 3453 | 3447 | case clang::Stmt::CXXOperatorCallExprClass: |
| 3454 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXOperatorCallExprClass"); |
| 3448 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXOperatorCallExprClass"); |
| 3455 | 3449 | return ErrorUnexpected; |
| 3456 | 3450 | case clang::Stmt::UserDefinedLiteralClass: |
| 3457 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C UserDefinedLiteralClass"); |
| 3451 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C UserDefinedLiteralClass"); |
| 3458 | 3452 | return ErrorUnexpected; |
| 3459 | 3453 | case clang::Stmt::CXXFunctionalCastExprClass: |
| 3460 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXFunctionalCastExprClass"); |
| 3454 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXFunctionalCastExprClass"); |
| 3461 | 3455 | return ErrorUnexpected; |
| 3462 | 3456 | case clang::Stmt::CXXConstCastExprClass: |
| 3463 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXConstCastExprClass"); |
| 3457 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXConstCastExprClass"); |
| 3464 | 3458 | return ErrorUnexpected; |
| 3465 | 3459 | case clang::Stmt::CXXDynamicCastExprClass: |
| 3466 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXDynamicCastExprClass"); |
| 3460 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXDynamicCastExprClass"); |
| 3467 | 3461 | return ErrorUnexpected; |
| 3468 | 3462 | case clang::Stmt::CXXReinterpretCastExprClass: |
| 3469 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXReinterpretCastExprClass"); |
| 3463 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXReinterpretCastExprClass"); |
| 3470 | 3464 | return ErrorUnexpected; |
| 3471 | 3465 | case clang::Stmt::CXXStaticCastExprClass: |
| 3472 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CXXStaticCastExprClass"); |
| 3466 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CXXStaticCastExprClass"); |
| 3473 | 3467 | return ErrorUnexpected; |
| 3474 | 3468 | case clang::Stmt::ObjCBridgedCastExprClass: |
| 3475 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCBridgedCastExprClass"); |
| 3469 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCBridgedCastExprClass"); |
| 3476 | 3470 | return ErrorUnexpected; |
| 3477 | 3471 | case clang::Stmt::CharacterLiteralClass: |
| 3478 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CharacterLiteralClass"); |
| 3472 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CharacterLiteralClass"); |
| 3479 | 3473 | return ErrorUnexpected; |
| 3480 | 3474 | case clang::Stmt::ChooseExprClass: |
| 3481 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ChooseExprClass"); |
| 3475 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ChooseExprClass"); |
| 3482 | 3476 | return ErrorUnexpected; |
| 3483 | 3477 | case clang::Stmt::CompoundLiteralExprClass: |
| 3484 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CompoundLiteralExprClass"); |
| 3478 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CompoundLiteralExprClass"); |
| 3485 | 3479 | return ErrorUnexpected; |
| 3486 | 3480 | case clang::Stmt::ConvertVectorExprClass: |
| 3487 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ConvertVectorExprClass"); |
| 3481 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ConvertVectorExprClass"); |
| 3488 | 3482 | return ErrorUnexpected; |
| 3489 | 3483 | case clang::Stmt::CoawaitExprClass: |
| 3490 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CoawaitExprClass"); |
| 3484 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CoawaitExprClass"); |
| 3491 | 3485 | return ErrorUnexpected; |
| 3492 | 3486 | case clang::Stmt::CoyieldExprClass: |
| 3493 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C CoyieldExprClass"); |
| 3487 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C CoyieldExprClass"); |
| 3494 | 3488 | return ErrorUnexpected; |
| 3495 | 3489 | case clang::Stmt::DependentCoawaitExprClass: |
| 3496 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C DependentCoawaitExprClass"); |
| 3490 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C DependentCoawaitExprClass"); |
| 3497 | 3491 | return ErrorUnexpected; |
| 3498 | 3492 | case clang::Stmt::DependentScopeDeclRefExprClass: |
| 3499 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C DependentScopeDeclRefExprClass"); |
| 3493 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C DependentScopeDeclRefExprClass"); |
| 3500 | 3494 | return ErrorUnexpected; |
| 3501 | 3495 | case clang::Stmt::DesignatedInitExprClass: |
| 3502 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C DesignatedInitExprClass"); |
| 3496 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C DesignatedInitExprClass"); |
| 3503 | 3497 | return ErrorUnexpected; |
| 3504 | 3498 | case clang::Stmt::DesignatedInitUpdateExprClass: |
| 3505 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C DesignatedInitUpdateExprClass"); |
| 3499 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C DesignatedInitUpdateExprClass"); |
| 3506 | 3500 | return ErrorUnexpected; |
| 3507 | 3501 | case clang::Stmt::ExpressionTraitExprClass: |
| 3508 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ExpressionTraitExprClass"); |
| 3502 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ExpressionTraitExprClass"); |
| 3509 | 3503 | return ErrorUnexpected; |
| 3510 | 3504 | case clang::Stmt::ExtVectorElementExprClass: |
| 3511 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ExtVectorElementExprClass"); |
| 3505 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ExtVectorElementExprClass"); |
| 3512 | 3506 | return ErrorUnexpected; |
| 3513 | 3507 | case clang::Stmt::FixedPointLiteralClass: |
| 3514 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C FixedPointLiteralClass"); |
| 3508 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C FixedPointLiteralClass"); |
| 3515 | 3509 | return ErrorUnexpected; |
| 3516 | 3510 | case clang::Stmt::FloatingLiteralClass: |
| 3517 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C FloatingLiteralClass"); |
| 3511 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C FloatingLiteralClass"); |
| 3518 | 3512 | return ErrorUnexpected; |
| 3519 | 3513 | case clang::Stmt::ExprWithCleanupsClass: |
| 3520 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ExprWithCleanupsClass"); |
| 3514 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ExprWithCleanupsClass"); |
| 3521 | 3515 | return ErrorUnexpected; |
| 3522 | 3516 | case clang::Stmt::FunctionParmPackExprClass: |
| 3523 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C FunctionParmPackExprClass"); |
| 3517 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C FunctionParmPackExprClass"); |
| 3524 | 3518 | return ErrorUnexpected; |
| 3525 | 3519 | case clang::Stmt::GNUNullExprClass: |
| 3526 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C GNUNullExprClass"); |
| 3520 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C GNUNullExprClass"); |
| 3527 | 3521 | return ErrorUnexpected; |
| 3528 | 3522 | case clang::Stmt::GenericSelectionExprClass: |
| 3529 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C GenericSelectionExprClass"); |
| 3523 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C GenericSelectionExprClass"); |
| 3530 | 3524 | return ErrorUnexpected; |
| 3531 | 3525 | case clang::Stmt::ImaginaryLiteralClass: |
| 3532 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ImaginaryLiteralClass"); |
| 3526 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ImaginaryLiteralClass"); |
| 3533 | 3527 | return ErrorUnexpected; |
| 3534 | 3528 | case clang::Stmt::ImplicitValueInitExprClass: |
| 3535 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ImplicitValueInitExprClass"); |
| 3529 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ImplicitValueInitExprClass"); |
| 3536 | 3530 | return ErrorUnexpected; |
| 3537 | 3531 | case clang::Stmt::InitListExprClass: |
| 3538 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C InitListExprClass"); |
| 3532 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C InitListExprClass"); |
| 3539 | 3533 | return ErrorUnexpected; |
| 3540 | 3534 | case clang::Stmt::LambdaExprClass: |
| 3541 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C LambdaExprClass"); |
| 3535 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C LambdaExprClass"); |
| 3542 | 3536 | return ErrorUnexpected; |
| 3543 | 3537 | case clang::Stmt::MSPropertyRefExprClass: |
| 3544 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C MSPropertyRefExprClass"); |
| 3538 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C MSPropertyRefExprClass"); |
| 3545 | 3539 | return ErrorUnexpected; |
| 3546 | 3540 | case clang::Stmt::MSPropertySubscriptExprClass: |
| 3547 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C MSPropertySubscriptExprClass"); |
| 3541 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C MSPropertySubscriptExprClass"); |
| 3548 | 3542 | return ErrorUnexpected; |
| 3549 | 3543 | case clang::Stmt::MaterializeTemporaryExprClass: |
| 3550 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C MaterializeTemporaryExprClass"); |
| 3544 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C MaterializeTemporaryExprClass"); |
| 3551 | 3545 | return ErrorUnexpected; |
| 3552 | 3546 | case clang::Stmt::NoInitExprClass: |
| 3553 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C NoInitExprClass"); |
| 3547 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C NoInitExprClass"); |
| 3554 | 3548 | return ErrorUnexpected; |
| 3555 | 3549 | case clang::Stmt::OMPArraySectionExprClass: |
| 3556 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPArraySectionExprClass"); |
| 3550 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPArraySectionExprClass"); |
| 3557 | 3551 | return ErrorUnexpected; |
| 3558 | 3552 | case clang::Stmt::ObjCArrayLiteralClass: |
| 3559 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCArrayLiteralClass"); |
| 3553 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCArrayLiteralClass"); |
| 3560 | 3554 | return ErrorUnexpected; |
| 3561 | 3555 | case clang::Stmt::ObjCAvailabilityCheckExprClass: |
| 3562 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCAvailabilityCheckExprClass"); |
| 3556 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCAvailabilityCheckExprClass"); |
| 3563 | 3557 | return ErrorUnexpected; |
| 3564 | 3558 | case clang::Stmt::ObjCBoolLiteralExprClass: |
| 3565 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCBoolLiteralExprClass"); |
| 3559 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCBoolLiteralExprClass"); |
| 3566 | 3560 | return ErrorUnexpected; |
| 3567 | 3561 | case clang::Stmt::ObjCBoxedExprClass: |
| 3568 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCBoxedExprClass"); |
| 3562 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCBoxedExprClass"); |
| 3569 | 3563 | return ErrorUnexpected; |
| 3570 | 3564 | case clang::Stmt::ObjCDictionaryLiteralClass: |
| 3571 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCDictionaryLiteralClass"); |
| 3565 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCDictionaryLiteralClass"); |
| 3572 | 3566 | return ErrorUnexpected; |
| 3573 | 3567 | case clang::Stmt::ObjCEncodeExprClass: |
| 3574 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCEncodeExprClass"); |
| 3568 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCEncodeExprClass"); |
| 3575 | 3569 | return ErrorUnexpected; |
| 3576 | 3570 | case clang::Stmt::ObjCIndirectCopyRestoreExprClass: |
| 3577 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCIndirectCopyRestoreExprClass"); |
| 3571 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCIndirectCopyRestoreExprClass"); |
| 3578 | 3572 | return ErrorUnexpected; |
| 3579 | 3573 | case clang::Stmt::ObjCIsaExprClass: |
| 3580 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCIsaExprClass"); |
| 3574 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCIsaExprClass"); |
| 3581 | 3575 | return ErrorUnexpected; |
| 3582 | 3576 | case clang::Stmt::ObjCIvarRefExprClass: |
| 3583 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCIvarRefExprClass"); |
| 3577 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCIvarRefExprClass"); |
| 3584 | 3578 | return ErrorUnexpected; |
| 3585 | 3579 | case clang::Stmt::ObjCMessageExprClass: |
| 3586 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCMessageExprClass"); |
| 3580 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCMessageExprClass"); |
| 3587 | 3581 | return ErrorUnexpected; |
| 3588 | 3582 | case clang::Stmt::ObjCPropertyRefExprClass: |
| 3589 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCPropertyRefExprClass"); |
| 3583 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCPropertyRefExprClass"); |
| 3590 | 3584 | return ErrorUnexpected; |
| 3591 | 3585 | case clang::Stmt::ObjCProtocolExprClass: |
| 3592 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCProtocolExprClass"); |
| 3586 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCProtocolExprClass"); |
| 3593 | 3587 | return ErrorUnexpected; |
| 3594 | 3588 | case clang::Stmt::ObjCSelectorExprClass: |
| 3595 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCSelectorExprClass"); |
| 3589 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCSelectorExprClass"); |
| 3596 | 3590 | return ErrorUnexpected; |
| 3597 | 3591 | case clang::Stmt::ObjCStringLiteralClass: |
| 3598 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCStringLiteralClass"); |
| 3592 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCStringLiteralClass"); |
| 3599 | 3593 | return ErrorUnexpected; |
| 3600 | 3594 | case clang::Stmt::ObjCSubscriptRefExprClass: |
| 3601 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCSubscriptRefExprClass"); |
| 3595 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCSubscriptRefExprClass"); |
| 3602 | 3596 | return ErrorUnexpected; |
| 3603 | 3597 | case clang::Stmt::OffsetOfExprClass: |
| 3604 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OffsetOfExprClass"); |
| 3598 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OffsetOfExprClass"); |
| 3605 | 3599 | return ErrorUnexpected; |
| 3606 | 3600 | case clang::Stmt::OpaqueValueExprClass: |
| 3607 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OpaqueValueExprClass"); |
| 3601 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OpaqueValueExprClass"); |
| 3608 | 3602 | return ErrorUnexpected; |
| 3609 | 3603 | case clang::Stmt::UnresolvedLookupExprClass: |
| 3610 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C UnresolvedLookupExprClass"); |
| 3604 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C UnresolvedLookupExprClass"); |
| 3611 | 3605 | return ErrorUnexpected; |
| 3612 | 3606 | case clang::Stmt::UnresolvedMemberExprClass: |
| 3613 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C UnresolvedMemberExprClass"); |
| 3607 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C UnresolvedMemberExprClass"); |
| 3614 | 3608 | return ErrorUnexpected; |
| 3615 | 3609 | case clang::Stmt::PackExpansionExprClass: |
| 3616 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C PackExpansionExprClass"); |
| 3610 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C PackExpansionExprClass"); |
| 3617 | 3611 | return ErrorUnexpected; |
| 3618 | 3612 | case clang::Stmt::ParenListExprClass: |
| 3619 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ParenListExprClass"); |
| 3613 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ParenListExprClass"); |
| 3620 | 3614 | return ErrorUnexpected; |
| 3621 | 3615 | case clang::Stmt::PseudoObjectExprClass: |
| 3622 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C PseudoObjectExprClass"); |
| 3616 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C PseudoObjectExprClass"); |
| 3623 | 3617 | return ErrorUnexpected; |
| 3624 | 3618 | case clang::Stmt::ShuffleVectorExprClass: |
| 3625 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ShuffleVectorExprClass"); |
| 3619 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ShuffleVectorExprClass"); |
| 3626 | 3620 | return ErrorUnexpected; |
| 3627 | 3621 | case clang::Stmt::SizeOfPackExprClass: |
| 3628 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C SizeOfPackExprClass"); |
| 3622 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C SizeOfPackExprClass"); |
| 3629 | 3623 | return ErrorUnexpected; |
| 3630 | 3624 | case clang::Stmt::SubstNonTypeTemplateParmExprClass: |
| 3631 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C SubstNonTypeTemplateParmExprClass"); |
| 3625 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C SubstNonTypeTemplateParmExprClass"); |
| 3632 | 3626 | return ErrorUnexpected; |
| 3633 | 3627 | case clang::Stmt::SubstNonTypeTemplateParmPackExprClass: |
| 3634 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C SubstNonTypeTemplateParmPackExprClass"); |
| 3628 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C SubstNonTypeTemplateParmPackExprClass"); |
| 3635 | 3629 | return ErrorUnexpected; |
| 3636 | 3630 | case clang::Stmt::TypeTraitExprClass: |
| 3637 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C TypeTraitExprClass"); |
| 3631 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C TypeTraitExprClass"); |
| 3638 | 3632 | return ErrorUnexpected; |
| 3639 | 3633 | case clang::Stmt::TypoExprClass: |
| 3640 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C TypoExprClass"); |
| 3634 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C TypoExprClass"); |
| 3641 | 3635 | return ErrorUnexpected; |
| 3642 | 3636 | case clang::Stmt::VAArgExprClass: |
| 3643 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C VAArgExprClass"); |
| 3637 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C VAArgExprClass"); |
| 3644 | 3638 | return ErrorUnexpected; |
| 3645 | 3639 | case clang::Stmt::GotoStmtClass: |
| 3646 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C GotoStmtClass"); |
| 3640 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C GotoStmtClass"); |
| 3647 | 3641 | return ErrorUnexpected; |
| 3648 | 3642 | case clang::Stmt::IndirectGotoStmtClass: |
| 3649 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C IndirectGotoStmtClass"); |
| 3643 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C IndirectGotoStmtClass"); |
| 3650 | 3644 | return ErrorUnexpected; |
| 3651 | 3645 | case clang::Stmt::LabelStmtClass: |
| 3652 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C LabelStmtClass"); |
| 3646 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C LabelStmtClass"); |
| 3653 | 3647 | return ErrorUnexpected; |
| 3654 | 3648 | case clang::Stmt::MSDependentExistsStmtClass: |
| 3655 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C MSDependentExistsStmtClass"); |
| 3649 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C MSDependentExistsStmtClass"); |
| 3656 | 3650 | return ErrorUnexpected; |
| 3657 | 3651 | case clang::Stmt::OMPAtomicDirectiveClass: |
| 3658 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPAtomicDirectiveClass"); |
| 3652 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPAtomicDirectiveClass"); |
| 3659 | 3653 | return ErrorUnexpected; |
| 3660 | 3654 | case clang::Stmt::OMPBarrierDirectiveClass: |
| 3661 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPBarrierDirectiveClass"); |
| 3655 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPBarrierDirectiveClass"); |
| 3662 | 3656 | return ErrorUnexpected; |
| 3663 | 3657 | case clang::Stmt::OMPCancelDirectiveClass: |
| 3664 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPCancelDirectiveClass"); |
| 3658 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPCancelDirectiveClass"); |
| 3665 | 3659 | return ErrorUnexpected; |
| 3666 | 3660 | case clang::Stmt::OMPCancellationPointDirectiveClass: |
| 3667 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPCancellationPointDirectiveClass"); |
| 3661 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPCancellationPointDirectiveClass"); |
| 3668 | 3662 | return ErrorUnexpected; |
| 3669 | 3663 | case clang::Stmt::OMPCriticalDirectiveClass: |
| 3670 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPCriticalDirectiveClass"); |
| 3664 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPCriticalDirectiveClass"); |
| 3671 | 3665 | return ErrorUnexpected; |
| 3672 | 3666 | case clang::Stmt::OMPFlushDirectiveClass: |
| 3673 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPFlushDirectiveClass"); |
| 3667 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPFlushDirectiveClass"); |
| 3674 | 3668 | return ErrorUnexpected; |
| 3675 | 3669 | case clang::Stmt::OMPDistributeDirectiveClass: |
| 3676 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPDistributeDirectiveClass"); |
| 3670 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPDistributeDirectiveClass"); |
| 3677 | 3671 | return ErrorUnexpected; |
| 3678 | 3672 | case clang::Stmt::OMPDistributeParallelForDirectiveClass: |
| 3679 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPDistributeParallelForDirectiveClass"); |
| 3673 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPDistributeParallelForDirectiveClass"); |
| 3680 | 3674 | return ErrorUnexpected; |
| 3681 | 3675 | case clang::Stmt::OMPDistributeParallelForSimdDirectiveClass: |
| 3682 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPDistributeParallelForSimdDirectiveClass"); |
| 3676 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPDistributeParallelForSimdDirectiveClass"); |
| 3683 | 3677 | return ErrorUnexpected; |
| 3684 | 3678 | case clang::Stmt::OMPDistributeSimdDirectiveClass: |
| 3685 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPDistributeSimdDirectiveClass"); |
| 3679 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPDistributeSimdDirectiveClass"); |
| 3686 | 3680 | return ErrorUnexpected; |
| 3687 | 3681 | case clang::Stmt::OMPForDirectiveClass: |
| 3688 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPForDirectiveClass"); |
| 3682 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPForDirectiveClass"); |
| 3689 | 3683 | return ErrorUnexpected; |
| 3690 | 3684 | case clang::Stmt::OMPForSimdDirectiveClass: |
| 3691 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPForSimdDirectiveClass"); |
| 3685 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPForSimdDirectiveClass"); |
| 3692 | 3686 | return ErrorUnexpected; |
| 3693 | 3687 | case clang::Stmt::OMPParallelForDirectiveClass: |
| 3694 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPParallelForDirectiveClass"); |
| 3688 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPParallelForDirectiveClass"); |
| 3695 | 3689 | return ErrorUnexpected; |
| 3696 | 3690 | case clang::Stmt::OMPParallelForSimdDirectiveClass: |
| 3697 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPParallelForSimdDirectiveClass"); |
| 3691 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPParallelForSimdDirectiveClass"); |
| 3698 | 3692 | return ErrorUnexpected; |
| 3699 | 3693 | case clang::Stmt::OMPSimdDirectiveClass: |
| 3700 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPSimdDirectiveClass"); |
| 3694 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPSimdDirectiveClass"); |
| 3701 | 3695 | return ErrorUnexpected; |
| 3702 | 3696 | case clang::Stmt::OMPTargetParallelForSimdDirectiveClass: |
| 3703 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetParallelForSimdDirectiveClass"); |
| 3697 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetParallelForSimdDirectiveClass"); |
| 3704 | 3698 | return ErrorUnexpected; |
| 3705 | 3699 | case clang::Stmt::OMPTargetSimdDirectiveClass: |
| 3706 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetSimdDirectiveClass"); |
| 3700 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetSimdDirectiveClass"); |
| 3707 | 3701 | return ErrorUnexpected; |
| 3708 | 3702 | case clang::Stmt::OMPTargetTeamsDistributeDirectiveClass: |
| 3709 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetTeamsDistributeDirectiveClass"); |
| 3703 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetTeamsDistributeDirectiveClass"); |
| 3710 | 3704 | return ErrorUnexpected; |
| 3711 | 3705 | case clang::Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass: |
| 3712 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetTeamsDistributeParallelForDirectiveClass"); |
| 3706 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetTeamsDistributeParallelForDirectiveClass"); |
| 3713 | 3707 | return ErrorUnexpected; |
| 3714 | 3708 | case clang::Stmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass: |
| 3715 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetTeamsDistributeParallelForSimdDirectiveClass"); |
| 3709 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetTeamsDistributeParallelForSimdDirectiveClass"); |
| 3716 | 3710 | return ErrorUnexpected; |
| 3717 | 3711 | case clang::Stmt::OMPTargetTeamsDistributeSimdDirectiveClass: |
| 3718 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetTeamsDistributeSimdDirectiveClass"); |
| 3712 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetTeamsDistributeSimdDirectiveClass"); |
| 3719 | 3713 | return ErrorUnexpected; |
| 3720 | 3714 | case clang::Stmt::OMPTaskLoopDirectiveClass: |
| 3721 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTaskLoopDirectiveClass"); |
| 3715 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTaskLoopDirectiveClass"); |
| 3722 | 3716 | return ErrorUnexpected; |
| 3723 | 3717 | case clang::Stmt::OMPTaskLoopSimdDirectiveClass: |
| 3724 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTaskLoopSimdDirectiveClass"); |
| 3718 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTaskLoopSimdDirectiveClass"); |
| 3725 | 3719 | return ErrorUnexpected; |
| 3726 | 3720 | case clang::Stmt::OMPTeamsDistributeDirectiveClass: |
| 3727 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTeamsDistributeDirectiveClass"); |
| 3721 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTeamsDistributeDirectiveClass"); |
| 3728 | 3722 | return ErrorUnexpected; |
| 3729 | 3723 | case clang::Stmt::OMPTeamsDistributeParallelForDirectiveClass: |
| 3730 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTeamsDistributeParallelForDirectiveClass"); |
| 3724 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTeamsDistributeParallelForDirectiveClass"); |
| 3731 | 3725 | return ErrorUnexpected; |
| 3732 | 3726 | case clang::Stmt::OMPTeamsDistributeParallelForSimdDirectiveClass: |
| 3733 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTeamsDistributeParallelForSimdDirectiveClass"); |
| 3727 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTeamsDistributeParallelForSimdDirectiveClass"); |
| 3734 | 3728 | return ErrorUnexpected; |
| 3735 | 3729 | case clang::Stmt::OMPTeamsDistributeSimdDirectiveClass: |
| 3736 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTeamsDistributeSimdDirectiveClass"); |
| 3730 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTeamsDistributeSimdDirectiveClass"); |
| 3737 | 3731 | return ErrorUnexpected; |
| 3738 | 3732 | case clang::Stmt::OMPMasterDirectiveClass: |
| 3739 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPMasterDirectiveClass"); |
| 3733 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPMasterDirectiveClass"); |
| 3740 | 3734 | return ErrorUnexpected; |
| 3741 | 3735 | case clang::Stmt::OMPOrderedDirectiveClass: |
| 3742 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPOrderedDirectiveClass"); |
| 3736 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPOrderedDirectiveClass"); |
| 3743 | 3737 | return ErrorUnexpected; |
| 3744 | 3738 | case clang::Stmt::OMPParallelDirectiveClass: |
| 3745 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPParallelDirectiveClass"); |
| 3739 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPParallelDirectiveClass"); |
| 3746 | 3740 | return ErrorUnexpected; |
| 3747 | 3741 | case clang::Stmt::OMPParallelSectionsDirectiveClass: |
| 3748 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPParallelSectionsDirectiveClass"); |
| 3742 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPParallelSectionsDirectiveClass"); |
| 3749 | 3743 | return ErrorUnexpected; |
| 3750 | 3744 | case clang::Stmt::OMPSectionDirectiveClass: |
| 3751 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPSectionDirectiveClass"); |
| 3745 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPSectionDirectiveClass"); |
| 3752 | 3746 | return ErrorUnexpected; |
| 3753 | 3747 | case clang::Stmt::OMPSectionsDirectiveClass: |
| 3754 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPSectionsDirectiveClass"); |
| 3748 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPSectionsDirectiveClass"); |
| 3755 | 3749 | return ErrorUnexpected; |
| 3756 | 3750 | case clang::Stmt::OMPSingleDirectiveClass: |
| 3757 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPSingleDirectiveClass"); |
| 3751 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPSingleDirectiveClass"); |
| 3758 | 3752 | return ErrorUnexpected; |
| 3759 | 3753 | case clang::Stmt::OMPTargetDataDirectiveClass: |
| 3760 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetDataDirectiveClass"); |
| 3754 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetDataDirectiveClass"); |
| 3761 | 3755 | return ErrorUnexpected; |
| 3762 | 3756 | case clang::Stmt::OMPTargetDirectiveClass: |
| 3763 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetDirectiveClass"); |
| 3757 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetDirectiveClass"); |
| 3764 | 3758 | return ErrorUnexpected; |
| 3765 | 3759 | case clang::Stmt::OMPTargetEnterDataDirectiveClass: |
| 3766 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetEnterDataDirectiveClass"); |
| 3760 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetEnterDataDirectiveClass"); |
| 3767 | 3761 | return ErrorUnexpected; |
| 3768 | 3762 | case clang::Stmt::OMPTargetExitDataDirectiveClass: |
| 3769 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetExitDataDirectiveClass"); |
| 3763 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetExitDataDirectiveClass"); |
| 3770 | 3764 | return ErrorUnexpected; |
| 3771 | 3765 | case clang::Stmt::OMPTargetParallelDirectiveClass: |
| 3772 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetParallelDirectiveClass"); |
| 3766 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetParallelDirectiveClass"); |
| 3773 | 3767 | return ErrorUnexpected; |
| 3774 | 3768 | case clang::Stmt::OMPTargetParallelForDirectiveClass: |
| 3775 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetParallelForDirectiveClass"); |
| 3769 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetParallelForDirectiveClass"); |
| 3776 | 3770 | return ErrorUnexpected; |
| 3777 | 3771 | case clang::Stmt::OMPTargetTeamsDirectiveClass: |
| 3778 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetTeamsDirectiveClass"); |
| 3772 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetTeamsDirectiveClass"); |
| 3779 | 3773 | return ErrorUnexpected; |
| 3780 | 3774 | case clang::Stmt::OMPTargetUpdateDirectiveClass: |
| 3781 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTargetUpdateDirectiveClass"); |
| 3775 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTargetUpdateDirectiveClass"); |
| 3782 | 3776 | return ErrorUnexpected; |
| 3783 | 3777 | case clang::Stmt::OMPTaskDirectiveClass: |
| 3784 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTaskDirectiveClass"); |
| 3778 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTaskDirectiveClass"); |
| 3785 | 3779 | return ErrorUnexpected; |
| 3786 | 3780 | case clang::Stmt::OMPTaskgroupDirectiveClass: |
| 3787 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTaskgroupDirectiveClass"); |
| 3781 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTaskgroupDirectiveClass"); |
| 3788 | 3782 | return ErrorUnexpected; |
| 3789 | 3783 | case clang::Stmt::OMPTaskwaitDirectiveClass: |
| 3790 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTaskwaitDirectiveClass"); |
| 3784 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTaskwaitDirectiveClass"); |
| 3791 | 3785 | return ErrorUnexpected; |
| 3792 | 3786 | case clang::Stmt::OMPTaskyieldDirectiveClass: |
| 3793 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTaskyieldDirectiveClass"); |
| 3787 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTaskyieldDirectiveClass"); |
| 3794 | 3788 | return ErrorUnexpected; |
| 3795 | 3789 | case clang::Stmt::OMPTeamsDirectiveClass: |
| 3796 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C OMPTeamsDirectiveClass"); |
| 3790 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C OMPTeamsDirectiveClass"); |
| 3797 | 3791 | return ErrorUnexpected; |
| 3798 | 3792 | case clang::Stmt::ObjCAtCatchStmtClass: |
| 3799 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCAtCatchStmtClass"); |
| 3793 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCAtCatchStmtClass"); |
| 3800 | 3794 | return ErrorUnexpected; |
| 3801 | 3795 | case clang::Stmt::ObjCAtFinallyStmtClass: |
| 3802 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCAtFinallyStmtClass"); |
| 3796 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCAtFinallyStmtClass"); |
| 3803 | 3797 | return ErrorUnexpected; |
| 3804 | 3798 | case clang::Stmt::ObjCAtSynchronizedStmtClass: |
| 3805 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCAtSynchronizedStmtClass"); |
| 3799 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCAtSynchronizedStmtClass"); |
| 3806 | 3800 | return ErrorUnexpected; |
| 3807 | 3801 | case clang::Stmt::ObjCAtThrowStmtClass: |
| 3808 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCAtThrowStmtClass"); |
| 3802 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCAtThrowStmtClass"); |
| 3809 | 3803 | return ErrorUnexpected; |
| 3810 | 3804 | case clang::Stmt::ObjCAtTryStmtClass: |
| 3811 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCAtTryStmtClass"); |
| 3805 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCAtTryStmtClass"); |
| 3812 | 3806 | return ErrorUnexpected; |
| 3813 | 3807 | case clang::Stmt::ObjCAutoreleasePoolStmtClass: |
| 3814 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCAutoreleasePoolStmtClass"); |
| 3808 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCAutoreleasePoolStmtClass"); |
| 3815 | 3809 | return ErrorUnexpected; |
| 3816 | 3810 | case clang::Stmt::ObjCForCollectionStmtClass: |
| 3817 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C ObjCForCollectionStmtClass"); |
| 3811 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C ObjCForCollectionStmtClass"); |
| 3818 | 3812 | return ErrorUnexpected; |
| 3819 | 3813 | case clang::Stmt::SEHExceptStmtClass: |
| 3820 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C SEHExceptStmtClass"); |
| 3814 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C SEHExceptStmtClass"); |
| 3821 | 3815 | return ErrorUnexpected; |
| 3822 | 3816 | case clang::Stmt::SEHFinallyStmtClass: |
| 3823 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C SEHFinallyStmtClass"); |
| 3817 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C SEHFinallyStmtClass"); |
| 3824 | 3818 | return ErrorUnexpected; |
| 3825 | 3819 | case clang::Stmt::SEHLeaveStmtClass: |
| 3826 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C SEHLeaveStmtClass"); |
| 3820 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C SEHLeaveStmtClass"); |
| 3827 | 3821 | return ErrorUnexpected; |
| 3828 | 3822 | case clang::Stmt::SEHTryStmtClass: |
| 3829 | | emit_warning(c, stmt->getBeginLoc(), "TODO handle C SEHTryStmtClass"); |
| 3823 | emit_warning(c, bitcast(stmt->getBeginLoc()), "TODO handle C SEHTryStmtClass"); |
| 3830 | 3824 | return ErrorUnexpected; |
| 3831 | 3825 | } |
| 3832 | 3826 | zig_unreachable(); |
| ... | ... | @@ -3855,16 +3849,16 @@ static TransScope *trans_stmt(Context *c, TransScope *scope, const clang::Stmt * |
| 3855 | 3849 | } |
| 3856 | 3850 | |
| 3857 | 3851 | static void visit_fn_decl(Context *c, const clang::FunctionDecl *fn_decl) { |
| 3858 | | Buf *fn_name = buf_create_from_str(decl_name(fn_decl)); |
| 3852 | Buf *fn_name = buf_create_from_str(ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)fn_decl)); |
| 3859 | 3853 | |
| 3860 | 3854 | if (get_global(c, fn_name)) { |
| 3861 | 3855 | // we already saw this function |
| 3862 | 3856 | return; |
| 3863 | 3857 | } |
| 3864 | 3858 | |
| 3865 | | AstNode *proto_node = trans_qual_type(c, fn_decl->getType(), fn_decl->getLocation()); |
| 3859 | AstNode *proto_node = trans_qual_type(c, fn_decl->getType(), bitcast(fn_decl->getLocation())); |
| 3866 | 3860 | if (proto_node == nullptr) { |
| 3867 | | emit_warning(c, fn_decl->getLocation(), "unable to resolve prototype of function '%s'", buf_ptr(fn_name)); |
| 3861 | emit_warning(c, bitcast(fn_decl->getLocation()), "unable to resolve prototype of function '%s'", buf_ptr(fn_name)); |
| 3868 | 3862 | return; |
| 3869 | 3863 | } |
| 3870 | 3864 | |
| ... | ... | @@ -3878,10 +3872,10 @@ static void visit_fn_decl(Context *c, const clang::FunctionDecl *fn_decl) { |
| 3878 | 3872 | } else if (sc == clang::SC_Extern || sc == clang::SC_Static) { |
| 3879 | 3873 | proto_node->data.fn_proto.visib_mod = c->visib_mod; |
| 3880 | 3874 | } else if (sc == clang::SC_PrivateExtern) { |
| 3881 | | emit_warning(c, fn_decl->getLocation(), "unsupported storage class: private extern"); |
| 3875 | emit_warning(c, bitcast(fn_decl->getLocation()), "unsupported storage class: private extern"); |
| 3882 | 3876 | return; |
| 3883 | 3877 | } else { |
| 3884 | | emit_warning(c, fn_decl->getLocation(), "unsupported storage class: unknown"); |
| 3878 | emit_warning(c, bitcast(fn_decl->getLocation()), "unsupported storage class: unknown"); |
| 3885 | 3879 | return; |
| 3886 | 3880 | } |
| 3887 | 3881 | |
| ... | ... | @@ -3890,7 +3884,7 @@ static void visit_fn_decl(Context *c, const clang::FunctionDecl *fn_decl) { |
| 3890 | 3884 | for (size_t i = 0; i < proto_node->data.fn_proto.params.length; i += 1) { |
| 3891 | 3885 | AstNode *param_node = proto_node->data.fn_proto.params.at(i); |
| 3892 | 3886 | const clang::ParmVarDecl *param = fn_decl->getParamDecl(i); |
| 3893 | | const char *name = decl_name(param); |
| 3887 | const char *name = ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)param); |
| 3894 | 3888 | |
| 3895 | 3889 | Buf *proto_param_name; |
| 3896 | 3890 | if (strlen(name) != 0) { |
| ... | ... | @@ -3920,7 +3914,7 @@ static void visit_fn_decl(Context *c, const clang::FunctionDecl *fn_decl) { |
| 3920 | 3914 | AstNode *actual_body_node; |
| 3921 | 3915 | TransScope *result_scope = trans_stmt(c, scope, body, &actual_body_node); |
| 3922 | 3916 | if (result_scope == nullptr) { |
| 3923 | | emit_warning(c, fn_decl->getLocation(), "unable to translate function"); |
| 3917 | emit_warning(c, bitcast(fn_decl->getLocation()), "unable to translate function"); |
| 3924 | 3918 | return; |
| 3925 | 3919 | } |
| 3926 | 3920 | assert(actual_body_node != nullptr); |
| ... | ... | @@ -3971,7 +3965,7 @@ static AstNode *resolve_typedef_decl(Context *c, const clang::TypedefNameDecl *t |
| 3971 | 3965 | } |
| 3972 | 3966 | |
| 3973 | 3967 | clang::QualType child_qt = typedef_decl->getUnderlyingType(); |
| 3974 | | Buf *type_name = buf_create_from_str(decl_name(typedef_decl)); |
| 3968 | Buf *type_name = buf_create_from_str(ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)typedef_decl)); |
| 3975 | 3969 | |
| 3976 | 3970 | if (buf_eql_str(type_name, "uint8_t")) { |
| 3977 | 3971 | return resolve_typdef_as_builtin(c, typedef_decl, "u8"); |
| ... | ... | @@ -4007,9 +4001,9 @@ static AstNode *resolve_typedef_decl(Context *c, const clang::TypedefNameDecl *t |
| 4007 | 4001 | AstNode *symbol_node = trans_create_node_symbol(c, type_name); |
| 4008 | 4002 | c->decl_table.put(typedef_decl->getCanonicalDecl(), symbol_node); |
| 4009 | 4003 | |
| 4010 | | AstNode *type_node = trans_qual_type(c, child_qt, typedef_decl->getLocation()); |
| 4004 | AstNode *type_node = trans_qual_type(c, child_qt, bitcast(typedef_decl->getLocation())); |
| 4011 | 4005 | if (type_node == nullptr) { |
| 4012 | | emit_warning(c, typedef_decl->getLocation(), "typedef %s - unresolved child type", buf_ptr(type_name)); |
| 4006 | emit_warning(c, bitcast(typedef_decl->getLocation()), "typedef %s - unresolved child type", buf_ptr(type_name)); |
| 4013 | 4007 | c->decl_table.put(typedef_decl, nullptr); |
| 4014 | 4008 | // TODO add global var with type_name equal to @compileError("unable to resolve C type") |
| 4015 | 4009 | return nullptr; |
| ... | ... | @@ -4040,7 +4034,7 @@ static AstNode *resolve_enum_decl(Context *c, const clang::EnumDecl *enum_decl) |
| 4040 | 4034 | return existing_entry->value; |
| 4041 | 4035 | } |
| 4042 | 4036 | |
| 4043 | | const char *raw_name = decl_name(enum_decl); |
| 4037 | const char *raw_name = ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)enum_decl); |
| 4044 | 4038 | bool is_anonymous = (raw_name[0] == 0); |
| 4045 | 4039 | Buf *bare_name = is_anonymous ? nullptr : buf_create_from_str(raw_name); |
| 4046 | 4040 | Buf *full_type_name = is_anonymous ? nullptr : buf_sprintf("enum_%s", buf_ptr(bare_name)); |
| ... | ... | @@ -4062,7 +4056,7 @@ static AstNode *resolve_enum_decl(Context *c, const clang::EnumDecl *enum_decl) |
| 4062 | 4056 | pure_enum = false; |
| 4063 | 4057 | } |
| 4064 | 4058 | } |
| 4065 | | AstNode *tag_int_type = trans_qual_type(c, enum_decl->getIntegerType(), enum_decl->getLocation()); |
| 4059 | AstNode *tag_int_type = trans_qual_type(c, enum_decl->getIntegerType(), bitcast(enum_decl->getLocation())); |
| 4066 | 4060 | assert(tag_int_type); |
| 4067 | 4061 | |
| 4068 | 4062 | AstNode *enum_node = trans_create_node(c, NodeTypeContainerDecl); |
| ... | ... | @@ -4084,7 +4078,7 @@ static AstNode *resolve_enum_decl(Context *c, const clang::EnumDecl *enum_decl) |
| 4084 | 4078 | { |
| 4085 | 4079 | const clang::EnumConstantDecl *enum_const = *it; |
| 4086 | 4080 | |
| 4087 | | Buf *enum_val_name = buf_create_from_str(decl_name(enum_const)); |
| 4081 | Buf *enum_val_name = buf_create_from_str(ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)enum_const)); |
| 4088 | 4082 | Buf *field_name; |
| 4089 | 4083 | if (bare_name != nullptr && buf_starts_with_buf(enum_val_name, bare_name)) { |
| 4090 | 4084 | field_name = buf_slice(enum_val_name, buf_len(bare_name), buf_len(enum_val_name)); |
| ... | ... | @@ -4102,7 +4096,7 @@ static AstNode *resolve_enum_decl(Context *c, const clang::EnumDecl *enum_decl) |
| 4102 | 4096 | // in C each enum value is in the global namespace. so we put them there too. |
| 4103 | 4097 | // at this point we can rely on the enum emitting successfully |
| 4104 | 4098 | if (is_anonymous) { |
| 4105 | | Buf *enum_val_name = buf_create_from_str(decl_name(enum_const)); |
| 4099 | Buf *enum_val_name = buf_create_from_str(ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)enum_const)); |
| 4106 | 4100 | add_global_var(c, enum_val_name, int_node); |
| 4107 | 4101 | } else { |
| 4108 | 4102 | AstNode *field_access_node = trans_create_node_field_access(c, |
| ... | ... | @@ -4123,62 +4117,63 @@ static AstNode *resolve_enum_decl(Context *c, const clang::EnumDecl *enum_decl) |
| 4123 | 4117 | } |
| 4124 | 4118 | } |
| 4125 | 4119 | |
| 4126 | | static AstNode *demote_struct_to_opaque(Context *c, const clang::RecordDecl *record_decl, |
| 4120 | static AstNode *demote_struct_to_opaque(Context *c, const ZigClangRecordDecl *record_decl, |
| 4127 | 4121 | Buf *full_type_name, Buf *bare_name) |
| 4128 | 4122 | { |
| 4129 | 4123 | AstNode *opaque_node = trans_create_node_opaque(c); |
| 4130 | 4124 | if (full_type_name == nullptr) { |
| 4131 | | c->decl_table.put(record_decl->getCanonicalDecl(), opaque_node); |
| 4125 | c->decl_table.put(ZigClangRecordDecl_getCanonicalDecl(record_decl), opaque_node); |
| 4132 | 4126 | return opaque_node; |
| 4133 | 4127 | } |
| 4134 | 4128 | AstNode *symbol_node = trans_create_node_symbol(c, full_type_name); |
| 4135 | 4129 | add_global_weak_alias(c, bare_name, full_type_name); |
| 4136 | 4130 | add_global_var(c, full_type_name, opaque_node); |
| 4137 | | c->decl_table.put(record_decl->getCanonicalDecl(), symbol_node); |
| 4131 | c->decl_table.put(ZigClangRecordDecl_getCanonicalDecl(record_decl), symbol_node); |
| 4138 | 4132 | return symbol_node; |
| 4139 | 4133 | } |
| 4140 | 4134 | |
| 4141 | | static AstNode *resolve_record_decl(Context *c, const clang::RecordDecl *record_decl) { |
| 4142 | | auto existing_entry = c->decl_table.maybe_get((void*)record_decl->getCanonicalDecl()); |
| 4135 | static AstNode *resolve_record_decl(Context *c, const ZigClangRecordDecl *record_decl) { |
| 4136 | auto existing_entry = c->decl_table.maybe_get(ZigClangRecordDecl_getCanonicalDecl(record_decl)); |
| 4143 | 4137 | if (existing_entry) { |
| 4144 | 4138 | return existing_entry->value; |
| 4145 | 4139 | } |
| 4146 | 4140 | |
| 4147 | | const char *raw_name = decl_name(record_decl); |
| 4141 | const char *raw_name = ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)record_decl); |
| 4148 | 4142 | const char *container_kind_name; |
| 4149 | 4143 | ContainerKind container_kind; |
| 4150 | | if (record_decl->isUnion()) { |
| 4144 | if (ZigClangRecordDecl_isUnion(record_decl)) { |
| 4151 | 4145 | container_kind_name = "union"; |
| 4152 | 4146 | container_kind = ContainerKindUnion; |
| 4153 | | } else if (record_decl->isStruct()) { |
| 4147 | } else if (ZigClangRecordDecl_isStruct(record_decl)) { |
| 4154 | 4148 | container_kind_name = "struct"; |
| 4155 | 4149 | container_kind = ContainerKindStruct; |
| 4156 | 4150 | } else { |
| 4157 | | emit_warning(c, record_decl->getLocation(), "skipping record %s, not a struct or union", raw_name); |
| 4158 | | c->decl_table.put(record_decl->getCanonicalDecl(), nullptr); |
| 4151 | emit_warning(c, ZigClangRecordDecl_getLocation(record_decl), |
| 4152 | "skipping record %s, not a struct or union", raw_name); |
| 4153 | c->decl_table.put(ZigClangRecordDecl_getCanonicalDecl(record_decl), nullptr); |
| 4159 | 4154 | return nullptr; |
| 4160 | 4155 | } |
| 4161 | 4156 | |
| 4162 | | bool is_anonymous = record_decl->isAnonymousStructOrUnion() || raw_name[0] == 0; |
| 4157 | bool is_anonymous = ZigClangRecordDecl_isAnonymousStructOrUnion(record_decl) || raw_name[0] == 0; |
| 4163 | 4158 | Buf *bare_name = is_anonymous ? nullptr : buf_create_from_str(raw_name); |
| 4164 | 4159 | Buf *full_type_name = (bare_name == nullptr) ? |
| 4165 | 4160 | nullptr : buf_sprintf("%s_%s", container_kind_name, buf_ptr(bare_name)); |
| 4166 | 4161 | |
| 4167 | | clang::RecordDecl *record_def = record_decl->getDefinition(); |
| 4162 | const ZigClangRecordDecl *record_def = ZigClangRecordDecl_getDefinition(record_decl); |
| 4168 | 4163 | if (record_def == nullptr) { |
| 4169 | 4164 | return demote_struct_to_opaque(c, record_decl, full_type_name, bare_name); |
| 4170 | 4165 | } |
| 4171 | 4166 | |
| 4172 | 4167 | // count fields and validate |
| 4173 | 4168 | uint32_t field_count = 0; |
| 4174 | | for (auto it = record_def->field_begin(), |
| 4175 | | it_end = record_def->field_end(); |
| 4169 | for (auto it = reinterpret_cast<const clang::RecordDecl *>(record_def)->field_begin(), |
| 4170 | it_end = reinterpret_cast<const clang::RecordDecl *>(record_def)->field_end(); |
| 4176 | 4171 | it != it_end; ++it, field_count += 1) |
| 4177 | 4172 | { |
| 4178 | 4173 | const clang::FieldDecl *field_decl = *it; |
| 4179 | 4174 | |
| 4180 | 4175 | if (field_decl->isBitField()) { |
| 4181 | | emit_warning(c, field_decl->getLocation(), "%s %s demoted to opaque type - has bitfield", |
| 4176 | emit_warning(c, bitcast(field_decl->getLocation()), "%s %s demoted to opaque type - has bitfield", |
| 4182 | 4177 | container_kind_name, |
| 4183 | 4178 | is_anonymous ? "(anon)" : buf_ptr(bare_name)); |
| 4184 | 4179 | return demote_struct_to_opaque(c, record_decl, full_type_name, bare_name); |
| ... | ... | @@ -4195,24 +4190,25 @@ static AstNode *resolve_record_decl(Context *c, const clang::RecordDecl *record_ |
| 4195 | 4190 | |
| 4196 | 4191 | // must be before fields in case a circular reference happens |
| 4197 | 4192 | if (is_anonymous) { |
| 4198 | | c->decl_table.put(record_decl->getCanonicalDecl(), struct_node); |
| 4193 | c->decl_table.put(ZigClangRecordDecl_getCanonicalDecl(record_decl), struct_node); |
| 4199 | 4194 | } else { |
| 4200 | | c->decl_table.put(record_decl->getCanonicalDecl(), trans_create_node_symbol(c, full_type_name)); |
| 4195 | c->decl_table.put(ZigClangRecordDecl_getCanonicalDecl(record_decl), trans_create_node_symbol(c, full_type_name)); |
| 4201 | 4196 | } |
| 4202 | 4197 | |
| 4203 | 4198 | uint32_t i = 0; |
| 4204 | | for (auto it = record_def->field_begin(), |
| 4205 | | it_end = record_def->field_end(); |
| 4199 | for (auto it = reinterpret_cast<const clang::RecordDecl *>(record_def)->field_begin(), |
| 4200 | it_end = reinterpret_cast<const clang::RecordDecl *>(record_def)->field_end(); |
| 4206 | 4201 | it != it_end; ++it, i += 1) |
| 4207 | 4202 | { |
| 4208 | 4203 | const clang::FieldDecl *field_decl = *it; |
| 4209 | 4204 | |
| 4210 | 4205 | AstNode *field_node = trans_create_node(c, NodeTypeStructField); |
| 4211 | | field_node->data.struct_field.name = buf_create_from_str(decl_name(field_decl)); |
| 4212 | | field_node->data.struct_field.type = trans_qual_type(c, field_decl->getType(), field_decl->getLocation()); |
| 4206 | field_node->data.struct_field.name = buf_create_from_str(ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)field_decl)); |
| 4207 | field_node->data.struct_field.type = trans_qual_type(c, field_decl->getType(), |
| 4208 | bitcast(field_decl->getLocation())); |
| 4213 | 4209 | |
| 4214 | 4210 | if (field_node->data.struct_field.type == nullptr) { |
| 4215 | | emit_warning(c, field_decl->getLocation(), |
| 4211 | emit_warning(c, bitcast(field_decl->getLocation()), |
| 4216 | 4212 | "%s %s demoted to opaque type - unresolved type", |
| 4217 | 4213 | container_kind_name, |
| 4218 | 4214 | is_anonymous ? "(anon)" : buf_ptr(bare_name)); |
| ... | ... | @@ -4232,7 +4228,7 @@ static AstNode *resolve_record_decl(Context *c, const clang::RecordDecl *record_ |
| 4232 | 4228 | } |
| 4233 | 4229 | } |
| 4234 | 4230 | |
| 4235 | | static AstNode *trans_ap_value(Context *c, clang::APValue *ap_value, clang::QualType qt, const clang::SourceLocation &source_loc) { |
| 4231 | static AstNode *trans_ap_value(Context *c, clang::APValue *ap_value, clang::QualType qt, ZigClangSourceLocation source_loc) { |
| 4236 | 4232 | switch (ap_value->getKind()) { |
| 4237 | 4233 | case clang::APValue::Int: |
| 4238 | 4234 | return trans_create_node_apint(c, ap_value->getInt()); |
| ... | ... | @@ -4331,25 +4327,25 @@ static AstNode *trans_ap_value(Context *c, clang::APValue *ap_value, clang::Qual |
| 4331 | 4327 | } |
| 4332 | 4328 | |
| 4333 | 4329 | static void visit_var_decl(Context *c, const clang::VarDecl *var_decl) { |
| 4334 | | Buf *name = buf_create_from_str(decl_name(var_decl)); |
| 4330 | Buf *name = buf_create_from_str(ZigClangDecl_getName_bytes_begin((const ZigClangDecl *)var_decl)); |
| 4335 | 4331 | |
| 4336 | 4332 | switch (var_decl->getTLSKind()) { |
| 4337 | 4333 | case clang::VarDecl::TLS_None: |
| 4338 | 4334 | break; |
| 4339 | 4335 | case clang::VarDecl::TLS_Static: |
| 4340 | | emit_warning(c, var_decl->getLocation(), |
| 4336 | emit_warning(c, bitcast(var_decl->getLocation()), |
| 4341 | 4337 | "ignoring variable '%s' - static thread local storage", buf_ptr(name)); |
| 4342 | 4338 | return; |
| 4343 | 4339 | case clang::VarDecl::TLS_Dynamic: |
| 4344 | | emit_warning(c, var_decl->getLocation(), |
| 4340 | emit_warning(c, bitcast(var_decl->getLocation()), |
| 4345 | 4341 | "ignoring variable '%s' - dynamic thread local storage", buf_ptr(name)); |
| 4346 | 4342 | return; |
| 4347 | 4343 | } |
| 4348 | 4344 | |
| 4349 | 4345 | clang::QualType qt = var_decl->getType(); |
| 4350 | | AstNode *var_type = trans_qual_type(c, qt, var_decl->getLocation()); |
| 4346 | AstNode *var_type = trans_qual_type(c, qt, bitcast(var_decl->getLocation())); |
| 4351 | 4347 | if (var_type == nullptr) { |
| 4352 | | emit_warning(c, var_decl->getLocation(), "ignoring variable '%s' - unresolved type", buf_ptr(name)); |
| 4348 | emit_warning(c, bitcast(var_decl->getLocation()), "ignoring variable '%s' - unresolved type", buf_ptr(name)); |
| 4353 | 4349 | return; |
| 4354 | 4350 | } |
| 4355 | 4351 | |
| ... | ... | @@ -4362,11 +4358,11 @@ static void visit_var_decl(Context *c, const clang::VarDecl *var_decl) { |
| 4362 | 4358 | if (var_decl->hasInit()) { |
| 4363 | 4359 | clang::APValue *ap_value = var_decl->evaluateValue(); |
| 4364 | 4360 | if (ap_value == nullptr) { |
| 4365 | | emit_warning(c, var_decl->getLocation(), |
| 4361 | emit_warning(c, bitcast(var_decl->getLocation()), |
| 4366 | 4362 | "ignoring variable '%s' - unable to evaluate initializer", buf_ptr(name)); |
| 4367 | 4363 | return; |
| 4368 | 4364 | } |
| 4369 | | init_node = trans_ap_value(c, ap_value, qt, var_decl->getLocation()); |
| 4365 | init_node = trans_ap_value(c, ap_value, qt, bitcast(var_decl->getLocation())); |
| 4370 | 4366 | if (init_node == nullptr) |
| 4371 | 4367 | return; |
| 4372 | 4368 | } else { |
| ... | ... | @@ -4385,7 +4381,7 @@ static void visit_var_decl(Context *c, const clang::VarDecl *var_decl) { |
| 4385 | 4381 | return; |
| 4386 | 4382 | } |
| 4387 | 4383 | |
| 4388 | | emit_warning(c, var_decl->getLocation(), |
| 4384 | emit_warning(c, bitcast(var_decl->getLocation()), |
| 4389 | 4385 | "ignoring variable '%s' - non-extern, non-static variable", buf_ptr(name)); |
| 4390 | 4386 | return; |
| 4391 | 4387 | } |
| ... | ... | @@ -4405,13 +4401,13 @@ static bool decl_visitor(void *context, const ZigClangDecl *zdecl) { |
| 4405 | 4401 | resolve_enum_decl(c, static_cast<const clang::EnumDecl *>(decl)); |
| 4406 | 4402 | break; |
| 4407 | 4403 | case clang::Decl::Record: |
| 4408 | | resolve_record_decl(c, static_cast<const clang::RecordDecl *>(decl)); |
| 4404 | resolve_record_decl(c, (const ZigClangRecordDecl *)(decl)); |
| 4409 | 4405 | break; |
| 4410 | 4406 | case clang::Decl::Var: |
| 4411 | 4407 | visit_var_decl(c, static_cast<const clang::VarDecl *>(decl)); |
| 4412 | 4408 | break; |
| 4413 | 4409 | default: |
| 4414 | | emit_warning(c, decl->getLocation(), "ignoring %s decl", decl->getDeclKindName()); |
| 4410 | emit_warning(c, bitcast(decl->getLocation()), "ignoring %s decl", decl->getDeclKindName()); |
| 4415 | 4411 | } |
| 4416 | 4412 | |
| 4417 | 4413 | return true; |
| ... | ... | @@ -4846,10 +4842,10 @@ static void process_preprocessor_entities(Context *c, ZigClangASTUnit *zunit) { |
| 4846 | 4842 | clang::MacroDefinitionRecord *macro = static_cast<clang::MacroDefinitionRecord *>(entity); |
| 4847 | 4843 | const char *raw_name = macro->getName()->getNameStart(); |
| 4848 | 4844 | clang::SourceRange range = macro->getSourceRange(); |
| 4849 | | clang::SourceLocation begin_loc = range.getBegin(); |
| 4850 | | clang::SourceLocation end_loc = range.getEnd(); |
| 4845 | ZigClangSourceLocation begin_loc = bitcast(range.getBegin()); |
| 4846 | ZigClangSourceLocation end_loc = bitcast(range.getEnd()); |
| 4851 | 4847 | |
| 4852 | | if (begin_loc == end_loc) { |
| 4848 | if (ZigClangSourceLocation_eq(begin_loc, end_loc)) { |
| 4853 | 4849 | // this means it is a macro without a value |
| 4854 | 4850 | // we don't care about such things |
| 4855 | 4851 | continue; |
| ... | ... | @@ -4859,7 +4855,7 @@ static void process_preprocessor_entities(Context *c, ZigClangASTUnit *zunit) { |
| 4859 | 4855 | continue; |
| 4860 | 4856 | } |
| 4861 | 4857 | |
| 4862 | | const char *begin_c = ZigClangSourceManager_getCharacterData(c->source_manager, bitcast(begin_loc)); |
| 4858 | const char *begin_c = ZigClangSourceManager_getCharacterData(c->source_manager, begin_loc); |
| 4863 | 4859 | process_macro(c, &ctok, name, begin_c); |
| 4864 | 4860 | } |
| 4865 | 4861 | } |