| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | |
| 31 | 31 | #include <string.h> |
| 32 | 32 | |
| 33 | | using namespace clang; |
| 34 | | |
| 35 | 33 | struct Alias { |
| 36 | 34 | Buf *new_name; |
| 37 | 35 | Buf *canon_name; |
| ... | ... | @@ -87,13 +85,13 @@ struct Context { |
| 87 | 85 | HashMap<const void *, AstNode *, ptr_hash, ptr_eq> decl_table; |
| 88 | 86 | HashMap<Buf *, AstNode *, buf_hash, buf_eql_buf> macro_table; |
| 89 | 87 | HashMap<Buf *, AstNode *, buf_hash, buf_eql_buf> global_table; |
| 90 | | SourceManager *source_manager; |
| 88 | clang::SourceManager *source_manager; |
| 91 | 89 | ZigList<Alias> aliases; |
| 92 | 90 | AstNode *source_node; |
| 93 | 91 | bool warnings_on; |
| 94 | 92 | |
| 95 | 93 | CodeGen *codegen; |
| 96 | | ASTContext *ctx; |
| 94 | clang::ASTContext *ctx; |
| 97 | 95 | |
| 98 | 96 | TransScopeRoot *global_scope; |
| 99 | 97 | HashMap<Buf *, bool, buf_hash, buf_eql_buf> ptr_params; |
| ... | ... | @@ -117,21 +115,21 @@ static TransScopeSwitch *trans_scope_switch_create(Context *c, TransScope *paren |
| 117 | 115 | |
| 118 | 116 | static TransScopeBlock *trans_scope_block_find(TransScope *scope); |
| 119 | 117 | |
| 120 | | static AstNode *resolve_record_decl(Context *c, const RecordDecl *record_decl); |
| 121 | | static AstNode *resolve_enum_decl(Context *c, const EnumDecl *enum_decl); |
| 122 | | static AstNode *resolve_typedef_decl(Context *c, const TypedefNameDecl *typedef_decl); |
| 118 | static AstNode *resolve_record_decl(Context *c, const clang::RecordDecl *record_decl); |
| 119 | static AstNode *resolve_enum_decl(Context *c, const clang::EnumDecl *enum_decl); |
| 120 | static AstNode *resolve_typedef_decl(Context *c, const clang::TypedefNameDecl *typedef_decl); |
| 123 | 121 | |
| 124 | | static int trans_stmt_extra(Context *c, TransScope *scope, const Stmt *stmt, |
| 122 | static int trans_stmt_extra(Context *c, TransScope *scope, const clang::Stmt *stmt, |
| 125 | 123 | ResultUsed result_used, TransLRValue lrval, |
| 126 | 124 | AstNode **out_node, TransScope **out_child_scope, |
| 127 | 125 | TransScope **out_node_scope); |
| 128 | | static TransScope *trans_stmt(Context *c, TransScope *scope, const Stmt *stmt, AstNode **out_node); |
| 129 | | static AstNode *trans_expr(Context *c, ResultUsed result_used, TransScope *scope, const Expr *expr, TransLRValue lrval); |
| 130 | | static AstNode *trans_qual_type(Context *c, QualType qt, const SourceLocation &source_loc); |
| 131 | | static AstNode *trans_bool_expr(Context *c, ResultUsed result_used, TransScope *scope, const Expr *expr, TransLRValue lrval); |
| 126 | static TransScope *trans_stmt(Context *c, TransScope *scope, const clang::Stmt *stmt, AstNode **out_node); |
| 127 | static AstNode *trans_expr(Context *c, ResultUsed result_used, TransScope *scope, const clang::Expr *expr, TransLRValue lrval); |
| 128 | static AstNode *trans_qual_type(Context *c, clang::QualType qt, const clang::SourceLocation &source_loc); |
| 129 | static AstNode *trans_bool_expr(Context *c, ResultUsed result_used, TransScope *scope, const clang::Expr *expr, TransLRValue lrval); |
| 132 | 130 | |
| 133 | 131 | ATTRIBUTE_PRINTF(3, 4) |
| 134 | | static void emit_warning(Context *c, const SourceLocation &sl, const char *format, ...) { |
| 132 | static void emit_warning(Context *c, const clang::SourceLocation &sl, const char *format, ...) { |
| 135 | 133 | if (!c->warnings_on) { |
| 136 | 134 | return; |
| 137 | 135 | } |
| ... | ... | @@ -471,8 +469,8 @@ static Buf *string_ref_to_buf(StringRef string_ref) { |
| 471 | 469 | return buf_create_from_mem((const char *)string_ref.bytes_begin(), string_ref.size()); |
| 472 | 470 | } |
| 473 | 471 | |
| 474 | | static const char *decl_name(const Decl *decl) { |
| 475 | | const NamedDecl *named_decl = static_cast<const NamedDecl *>(decl); |
| 472 | static const char *decl_name(const clang::Decl *decl) { |
| 473 | const clang::NamedDecl *named_decl = static_cast<const clang::NamedDecl *>(decl); |
| 476 | 474 | return (const char *)named_decl->getName().bytes_begin(); |
| 477 | 475 | } |
| 478 | 476 | |
| ... | ... | @@ -490,20 +488,20 @@ static AstNode *trans_create_node_apint(Context *c, const llvm::APSInt &aps_int) |
| 490 | 488 | |
| 491 | 489 | } |
| 492 | 490 | |
| 493 | | static const Type *qual_type_canon(QualType qt) { |
| 491 | static const clang::Type *qual_type_canon(clang::QualType qt) { |
| 494 | 492 | return qt.getCanonicalType().getTypePtr(); |
| 495 | 493 | } |
| 496 | 494 | |
| 497 | | static QualType get_expr_qual_type(Context *c, const Expr *expr) { |
| 495 | static clang::QualType get_expr_qual_type(Context *c, const clang::Expr *expr) { |
| 498 | 496 | // String literals in C are `char *` but they should really be `const char *`. |
| 499 | | if (expr->getStmtClass() == Stmt::ImplicitCastExprClass) { |
| 500 | | const ImplicitCastExpr *cast_expr = static_cast<const ImplicitCastExpr *>(expr); |
| 501 | | if (cast_expr->getCastKind() == CK_ArrayToPointerDecay) { |
| 502 | | const Expr *sub_expr = cast_expr->getSubExpr(); |
| 503 | | if (sub_expr->getStmtClass() == Stmt::StringLiteralClass) { |
| 504 | | QualType array_qt = sub_expr->getType(); |
| 505 | | const ArrayType *array_type = static_cast<const ArrayType *>(array_qt.getTypePtr()); |
| 506 | | QualType pointee_qt = array_type->getElementType(); |
| 497 | if (expr->getStmtClass() == clang::Stmt::ImplicitCastExprClass) { |
| 498 | const clang::ImplicitCastExpr *cast_expr = static_cast<const clang::ImplicitCastExpr *>(expr); |
| 499 | if (cast_expr->getCastKind() == clang::CK_ArrayToPointerDecay) { |
| 500 | const clang::Expr *sub_expr = cast_expr->getSubExpr(); |
| 501 | if (sub_expr->getStmtClass() == clang::Stmt::StringLiteralClass) { |
| 502 | clang::QualType array_qt = sub_expr->getType(); |
| 503 | const clang::ArrayType *array_type = static_cast<const clang::ArrayType *>(array_qt.getTypePtr()); |
| 504 | clang::QualType pointee_qt = array_type->getElementType(); |
| 507 | 505 | pointee_qt.addConst(); |
| 508 | 506 | return c->ctx->getPointerType(pointee_qt); |
| 509 | 507 | } |
| ... | ... | @@ -512,19 +510,19 @@ static QualType get_expr_qual_type(Context *c, const Expr *expr) { |
| 512 | 510 | return expr->getType(); |
| 513 | 511 | } |
| 514 | 512 | |
| 515 | | static QualType get_expr_qual_type_before_implicit_cast(Context *c, const Expr *expr) { |
| 516 | | if (expr->getStmtClass() == Stmt::ImplicitCastExprClass) { |
| 517 | | const ImplicitCastExpr *cast_expr = static_cast<const ImplicitCastExpr *>(expr); |
| 513 | static clang::QualType get_expr_qual_type_before_implicit_cast(Context *c, const clang::Expr *expr) { |
| 514 | if (expr->getStmtClass() == clang::Stmt::ImplicitCastExprClass) { |
| 515 | const clang::ImplicitCastExpr *cast_expr = static_cast<const clang::ImplicitCastExpr *>(expr); |
| 518 | 516 | return get_expr_qual_type(c, cast_expr->getSubExpr()); |
| 519 | 517 | } |
| 520 | 518 | return expr->getType(); |
| 521 | 519 | } |
| 522 | 520 | |
| 523 | | static AstNode *get_expr_type(Context *c, const Expr *expr) { |
| 521 | static AstNode *get_expr_type(Context *c, const clang::Expr *expr) { |
| 524 | 522 | return trans_qual_type(c, get_expr_qual_type(c, expr), expr->getLocStart()); |
| 525 | 523 | } |
| 526 | 524 | |
| 527 | | static bool qual_types_equal(QualType t1, QualType t2) { |
| 525 | static bool qual_types_equal(clang::QualType t1, clang::QualType t2) { |
| 528 | 526 | if (t1.isConstQualified() != t2.isConstQualified()) { |
| 529 | 527 | return false; |
| 530 | 528 | } |
| ... | ... | @@ -541,37 +539,37 @@ static bool is_c_void_type(AstNode *node) { |
| 541 | 539 | return (node->type == NodeTypeSymbol && buf_eql_str(node->data.symbol_expr.symbol, "c_void")); |
| 542 | 540 | } |
| 543 | 541 | |
| 544 | | static bool expr_types_equal(Context *c, const Expr *expr1, const Expr *expr2) { |
| 545 | | QualType t1 = get_expr_qual_type(c, expr1); |
| 546 | | QualType t2 = get_expr_qual_type(c, expr2); |
| 542 | static bool expr_types_equal(Context *c, const clang::Expr *expr1, const clang::Expr *expr2) { |
| 543 | clang::QualType t1 = get_expr_qual_type(c, expr1); |
| 544 | clang::QualType t2 = get_expr_qual_type(c, expr2); |
| 547 | 545 | |
| 548 | 546 | return qual_types_equal(t1, t2); |
| 549 | 547 | } |
| 550 | 548 | |
| 551 | | static bool qual_type_is_ptr(QualType qt) { |
| 552 | | const Type *ty = qual_type_canon(qt); |
| 553 | | return ty->getTypeClass() == Type::Pointer; |
| 549 | static bool qual_type_is_ptr(clang::QualType qt) { |
| 550 | const clang::Type *ty = qual_type_canon(qt); |
| 551 | return ty->getTypeClass() == clang::Type::Pointer; |
| 554 | 552 | } |
| 555 | 553 | |
| 556 | | static const FunctionProtoType *qual_type_get_fn_proto(QualType qt, bool *is_ptr) { |
| 557 | | const Type *ty = qual_type_canon(qt); |
| 554 | static const clang::FunctionProtoType *qual_type_get_fn_proto(clang::QualType qt, bool *is_ptr) { |
| 555 | const clang::Type *ty = qual_type_canon(qt); |
| 558 | 556 | *is_ptr = false; |
| 559 | 557 | |
| 560 | | if (ty->getTypeClass() == Type::Pointer) { |
| 558 | if (ty->getTypeClass() == clang::Type::Pointer) { |
| 561 | 559 | *is_ptr = true; |
| 562 | | const PointerType *pointer_ty = static_cast<const PointerType*>(ty); |
| 563 | | QualType child_qt = pointer_ty->getPointeeType(); |
| 560 | const clang::PointerType *pointer_ty = static_cast<const clang::PointerType*>(ty); |
| 561 | clang::QualType child_qt = pointer_ty->getPointeeType(); |
| 564 | 562 | ty = child_qt.getTypePtr(); |
| 565 | 563 | } |
| 566 | 564 | |
| 567 | | if (ty->getTypeClass() == Type::FunctionProto) { |
| 568 | | return static_cast<const FunctionProtoType*>(ty); |
| 565 | if (ty->getTypeClass() == clang::Type::FunctionProto) { |
| 566 | return static_cast<const clang::FunctionProtoType*>(ty); |
| 569 | 567 | } |
| 570 | 568 | |
| 571 | 569 | return nullptr; |
| 572 | 570 | } |
| 573 | 571 | |
| 574 | | static bool qual_type_is_fn_ptr(QualType qt) { |
| 572 | static bool qual_type_is_fn_ptr(clang::QualType qt) { |
| 575 | 573 | bool is_ptr; |
| 576 | 574 | if (qual_type_get_fn_proto(qt, &is_ptr)) { |
| 577 | 575 | return is_ptr; |
| ... | ... | @@ -580,30 +578,30 @@ static bool qual_type_is_fn_ptr(QualType qt) { |
| 580 | 578 | return false; |
| 581 | 579 | } |
| 582 | 580 | |
| 583 | | static uint32_t qual_type_int_bit_width(Context *c, const QualType &qt, const SourceLocation &source_loc) { |
| 584 | | const Type *ty = qt.getTypePtr(); |
| 581 | static uint32_t qual_type_int_bit_width(Context *c, const clang::QualType &qt, const clang::SourceLocation &source_loc) { |
| 582 | const clang::Type *ty = qt.getTypePtr(); |
| 585 | 583 | switch (ty->getTypeClass()) { |
| 586 | | case Type::Builtin: |
| 584 | case clang::Type::Builtin: |
| 587 | 585 | { |
| 588 | | const BuiltinType *builtin_ty = static_cast<const BuiltinType*>(ty); |
| 586 | const clang::BuiltinType *builtin_ty = static_cast<const clang::BuiltinType*>(ty); |
| 589 | 587 | switch (builtin_ty->getKind()) { |
| 590 | | case BuiltinType::Char_U: |
| 591 | | case BuiltinType::UChar: |
| 592 | | case BuiltinType::Char_S: |
| 593 | | case BuiltinType::SChar: |
| 588 | case clang::BuiltinType::Char_U: |
| 589 | case clang::BuiltinType::UChar: |
| 590 | case clang::BuiltinType::Char_S: |
| 591 | case clang::BuiltinType::SChar: |
| 594 | 592 | return 8; |
| 595 | | case BuiltinType::UInt128: |
| 596 | | case BuiltinType::Int128: |
| 593 | case clang::BuiltinType::UInt128: |
| 594 | case clang::BuiltinType::Int128: |
| 597 | 595 | return 128; |
| 598 | 596 | default: |
| 599 | 597 | return 0; |
| 600 | 598 | } |
| 601 | 599 | zig_unreachable(); |
| 602 | 600 | } |
| 603 | | case Type::Typedef: |
| 601 | case clang::Type::Typedef: |
| 604 | 602 | { |
| 605 | | const TypedefType *typedef_ty = static_cast<const TypedefType*>(ty); |
| 606 | | const TypedefNameDecl *typedef_decl = typedef_ty->getDecl(); |
| 603 | const clang::TypedefType *typedef_ty = static_cast<const clang::TypedefType*>(ty); |
| 604 | const clang::TypedefNameDecl *typedef_decl = typedef_ty->getDecl(); |
| 607 | 605 | const char *type_name = decl_name(typedef_decl); |
| 608 | 606 | if (strcmp(type_name, "uint8_t") == 0 || strcmp(type_name, "int8_t") == 0) { |
| 609 | 607 | return 8; |
| ... | ... | @@ -624,8 +622,8 @@ static uint32_t qual_type_int_bit_width(Context *c, const QualType &qt, const So |
| 624 | 622 | } |
| 625 | 623 | |
| 626 | 624 | |
| 627 | | static AstNode *qual_type_to_log2_int_ref(Context *c, const QualType &qt, |
| 628 | | const SourceLocation &source_loc) |
| 625 | static AstNode *qual_type_to_log2_int_ref(Context *c, const clang::QualType &qt, |
| 626 | const clang::SourceLocation &source_loc) |
| 629 | 627 | { |
| 630 | 628 | uint32_t int_bit_width = qual_type_int_bit_width(c, qt, source_loc); |
| 631 | 629 | if (int_bit_width != 0) { |
| ... | ... | @@ -643,7 +641,7 @@ static AstNode *qual_type_to_log2_int_ref(Context *c, const QualType &qt, |
| 643 | 641 | // FieldAccess |
| 644 | 642 | // FnCall (.builtin = true) |
| 645 | 643 | // Symbol "import" |
| 646 | | // StringLiteral "std" |
| 644 | // clang::StringLiteral "std" |
| 647 | 645 | // Symbol "math" |
| 648 | 646 | // Symbol "Log2Int" |
| 649 | 647 | // zig_type_node |
| ... | ... | @@ -657,21 +655,21 @@ static AstNode *qual_type_to_log2_int_ref(Context *c, const QualType &qt, |
| 657 | 655 | return log2int_fn_call; |
| 658 | 656 | } |
| 659 | 657 | |
| 660 | | static bool qual_type_child_is_fn_proto(const QualType &qt) { |
| 661 | | if (qt.getTypePtr()->getTypeClass() == Type::Paren) { |
| 662 | | const ParenType *paren_type = static_cast<const ParenType *>(qt.getTypePtr()); |
| 663 | | if (paren_type->getInnerType()->getTypeClass() == Type::FunctionProto) { |
| 658 | static bool qual_type_child_is_fn_proto(const clang::QualType &qt) { |
| 659 | if (qt.getTypePtr()->getTypeClass() == clang::Type::Paren) { |
| 660 | const clang::ParenType *paren_type = static_cast<const clang::ParenType *>(qt.getTypePtr()); |
| 661 | if (paren_type->getInnerType()->getTypeClass() == clang::Type::FunctionProto) { |
| 664 | 662 | return true; |
| 665 | 663 | } |
| 666 | | } else if (qt.getTypePtr()->getTypeClass() == Type::Attributed) { |
| 667 | | const AttributedType *attr_type = static_cast<const AttributedType *>(qt.getTypePtr()); |
| 664 | } else if (qt.getTypePtr()->getTypeClass() == clang::Type::Attributed) { |
| 665 | const clang::AttributedType *attr_type = static_cast<const clang::AttributedType *>(qt.getTypePtr()); |
| 668 | 666 | return qual_type_child_is_fn_proto(attr_type->getEquivalentType()); |
| 669 | 667 | } |
| 670 | 668 | return false; |
| 671 | 669 | } |
| 672 | 670 | |
| 673 | | static AstNode* trans_c_cast(Context *c, const SourceLocation &source_location, QualType dest_type, |
| 674 | | QualType src_type, AstNode *expr) |
| 671 | static AstNode* trans_c_cast(Context *c, const clang::SourceLocation &source_location, clang::QualType dest_type, |
| 672 | clang::QualType src_type, AstNode *expr) |
| 675 | 673 | { |
| 676 | 674 | if (qual_types_equal(dest_type, src_type)) { |
| 677 | 675 | return expr; |
| ... | ... | @@ -688,72 +686,72 @@ static AstNode* trans_c_cast(Context *c, const SourceLocation &source_location, |
| 688 | 686 | return trans_create_node_fn_call_1(c, trans_qual_type(c, dest_type, source_location), expr); |
| 689 | 687 | } |
| 690 | 688 | |
| 691 | | static bool c_is_signed_integer(Context *c, QualType qt) { |
| 692 | | const Type *c_type = qual_type_canon(qt); |
| 693 | | if (c_type->getTypeClass() != Type::Builtin) |
| 689 | static bool c_is_signed_integer(Context *c, clang::QualType qt) { |
| 690 | const clang::Type *c_type = qual_type_canon(qt); |
| 691 | if (c_type->getTypeClass() != clang::Type::Builtin) |
| 694 | 692 | return false; |
| 695 | | const BuiltinType *builtin_ty = static_cast<const BuiltinType*>(c_type); |
| 693 | const clang::BuiltinType *builtin_ty = static_cast<const clang::BuiltinType*>(c_type); |
| 696 | 694 | switch (builtin_ty->getKind()) { |
| 697 | | case BuiltinType::SChar: |
| 698 | | case BuiltinType::Short: |
| 699 | | case BuiltinType::Int: |
| 700 | | case BuiltinType::Long: |
| 701 | | case BuiltinType::LongLong: |
| 702 | | case BuiltinType::Int128: |
| 703 | | case BuiltinType::WChar_S: |
| 695 | case clang::BuiltinType::SChar: |
| 696 | case clang::BuiltinType::Short: |
| 697 | case clang::BuiltinType::Int: |
| 698 | case clang::BuiltinType::Long: |
| 699 | case clang::BuiltinType::LongLong: |
| 700 | case clang::BuiltinType::Int128: |
| 701 | case clang::BuiltinType::WChar_S: |
| 704 | 702 | return true; |
| 705 | 703 | default: |
| 706 | 704 | return false; |
| 707 | 705 | } |
| 708 | 706 | } |
| 709 | 707 | |
| 710 | | static bool c_is_unsigned_integer(Context *c, QualType qt) { |
| 711 | | const Type *c_type = qual_type_canon(qt); |
| 712 | | if (c_type->getTypeClass() != Type::Builtin) |
| 708 | static bool c_is_unsigned_integer(Context *c, clang::QualType qt) { |
| 709 | const clang::Type *c_type = qual_type_canon(qt); |
| 710 | if (c_type->getTypeClass() != clang::Type::Builtin) |
| 713 | 711 | return false; |
| 714 | | const BuiltinType *builtin_ty = static_cast<const BuiltinType*>(c_type); |
| 712 | const clang::BuiltinType *builtin_ty = static_cast<const clang::BuiltinType*>(c_type); |
| 715 | 713 | switch (builtin_ty->getKind()) { |
| 716 | | case BuiltinType::Char_U: |
| 717 | | case BuiltinType::UChar: |
| 718 | | case BuiltinType::Char_S: |
| 719 | | case BuiltinType::UShort: |
| 720 | | case BuiltinType::UInt: |
| 721 | | case BuiltinType::ULong: |
| 722 | | case BuiltinType::ULongLong: |
| 723 | | case BuiltinType::UInt128: |
| 724 | | case BuiltinType::WChar_U: |
| 714 | case clang::BuiltinType::Char_U: |
| 715 | case clang::BuiltinType::UChar: |
| 716 | case clang::BuiltinType::Char_S: |
| 717 | case clang::BuiltinType::UShort: |
| 718 | case clang::BuiltinType::UInt: |
| 719 | case clang::BuiltinType::ULong: |
| 720 | case clang::BuiltinType::ULongLong: |
| 721 | case clang::BuiltinType::UInt128: |
| 722 | case clang::BuiltinType::WChar_U: |
| 725 | 723 | return true; |
| 726 | 724 | default: |
| 727 | 725 | return false; |
| 728 | 726 | } |
| 729 | 727 | } |
| 730 | 728 | |
| 731 | | static bool c_is_builtin_type(Context *c, QualType qt, BuiltinType::Kind kind) { |
| 732 | | const Type *c_type = qual_type_canon(qt); |
| 733 | | if (c_type->getTypeClass() != Type::Builtin) |
| 729 | static bool c_is_builtin_type(Context *c, clang::QualType qt, clang::BuiltinType::Kind kind) { |
| 730 | const clang::Type *c_type = qual_type_canon(qt); |
| 731 | if (c_type->getTypeClass() != clang::Type::Builtin) |
| 734 | 732 | return false; |
| 735 | | const BuiltinType *builtin_ty = static_cast<const BuiltinType*>(c_type); |
| 733 | const clang::BuiltinType *builtin_ty = static_cast<const clang::BuiltinType*>(c_type); |
| 736 | 734 | return builtin_ty->getKind() == kind; |
| 737 | 735 | } |
| 738 | 736 | |
| 739 | | static bool c_is_float(Context *c, QualType qt) { |
| 740 | | const Type *c_type = qt.getTypePtr(); |
| 741 | | if (c_type->getTypeClass() != Type::Builtin) |
| 737 | static bool c_is_float(Context *c, clang::QualType qt) { |
| 738 | const clang::Type *c_type = qt.getTypePtr(); |
| 739 | if (c_type->getTypeClass() != clang::Type::Builtin) |
| 742 | 740 | return false; |
| 743 | | const BuiltinType *builtin_ty = static_cast<const BuiltinType*>(c_type); |
| 741 | const clang::BuiltinType *builtin_ty = static_cast<const clang::BuiltinType*>(c_type); |
| 744 | 742 | switch (builtin_ty->getKind()) { |
| 745 | | case BuiltinType::Half: |
| 746 | | case BuiltinType::Float: |
| 747 | | case BuiltinType::Double: |
| 748 | | case BuiltinType::Float128: |
| 749 | | case BuiltinType::LongDouble: |
| 743 | case clang::BuiltinType::Half: |
| 744 | case clang::BuiltinType::Float: |
| 745 | case clang::BuiltinType::Double: |
| 746 | case clang::BuiltinType::Float128: |
| 747 | case clang::BuiltinType::LongDouble: |
| 750 | 748 | return true; |
| 751 | 749 | default: |
| 752 | 750 | return false; |
| 753 | 751 | } |
| 754 | 752 | } |
| 755 | 753 | |
| 756 | | static bool qual_type_has_wrapping_overflow(Context *c, QualType qt) { |
| 754 | static bool qual_type_has_wrapping_overflow(Context *c, clang::QualType qt) { |
| 757 | 755 | if (c_is_signed_integer(c, qt) || c_is_float(c, qt)) { |
| 758 | 756 | // float and signed integer overflow is undefined behavior. |
| 759 | 757 | return false; |
| ... | ... | @@ -763,23 +761,23 @@ static bool qual_type_has_wrapping_overflow(Context *c, QualType qt) { |
| 763 | 761 | } |
| 764 | 762 | } |
| 765 | 763 | |
| 766 | | static bool type_is_opaque(Context *c, const Type *ty, const SourceLocation &source_loc) { |
| 764 | static bool type_is_opaque(Context *c, const clang::Type *ty, const clang::SourceLocation &source_loc) { |
| 767 | 765 | switch (ty->getTypeClass()) { |
| 768 | | case Type::Builtin: { |
| 769 | | const BuiltinType *builtin_ty = static_cast<const BuiltinType*>(ty); |
| 770 | | return builtin_ty->getKind() == BuiltinType::Void; |
| 766 | case clang::Type::Builtin: { |
| 767 | const clang::BuiltinType *builtin_ty = static_cast<const clang::BuiltinType*>(ty); |
| 768 | return builtin_ty->getKind() == clang::BuiltinType::Void; |
| 771 | 769 | } |
| 772 | | case Type::Record: { |
| 773 | | const RecordType *record_ty = static_cast<const RecordType*>(ty); |
| 770 | case clang::Type::Record: { |
| 771 | const clang::RecordType *record_ty = static_cast<const clang::RecordType*>(ty); |
| 774 | 772 | return record_ty->getDecl()->getDefinition() == nullptr; |
| 775 | 773 | } |
| 776 | | case Type::Elaborated: { |
| 777 | | const ElaboratedType *elaborated_ty = static_cast<const ElaboratedType*>(ty); |
| 774 | case clang::Type::Elaborated: { |
| 775 | const clang::ElaboratedType *elaborated_ty = static_cast<const clang::ElaboratedType*>(ty); |
| 778 | 776 | return type_is_opaque(c, elaborated_ty->getNamedType().getTypePtr(), source_loc); |
| 779 | 777 | } |
| 780 | | case Type::Typedef: { |
| 781 | | const TypedefType *typedef_ty = static_cast<const TypedefType*>(ty); |
| 782 | | const TypedefNameDecl *typedef_decl = typedef_ty->getDecl(); |
| 778 | case clang::Type::Typedef: { |
| 779 | const clang::TypedefType *typedef_ty = static_cast<const clang::TypedefType*>(ty); |
| 780 | const clang::TypedefNameDecl *typedef_decl = typedef_ty->getDecl(); |
| 783 | 781 | return type_is_opaque(c, typedef_decl->getUnderlyingType().getTypePtr(), source_loc); |
| 784 | 782 | } |
| 785 | 783 | default: |
| ... | ... | @@ -787,145 +785,145 @@ static bool type_is_opaque(Context *c, const Type *ty, const SourceLocation &sou |
| 787 | 785 | } |
| 788 | 786 | } |
| 789 | 787 | |
| 790 | | static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &source_loc) { |
| 788 | static AstNode *trans_type(Context *c, const clang::Type *ty, const clang::SourceLocation &source_loc) { |
| 791 | 789 | switch (ty->getTypeClass()) { |
| 792 | | case Type::Builtin: |
| 790 | case clang::Type::Builtin: |
| 793 | 791 | { |
| 794 | | const BuiltinType *builtin_ty = static_cast<const BuiltinType*>(ty); |
| 792 | const clang::BuiltinType *builtin_ty = static_cast<const clang::BuiltinType*>(ty); |
| 795 | 793 | switch (builtin_ty->getKind()) { |
| 796 | | case BuiltinType::Void: |
| 794 | case clang::BuiltinType::Void: |
| 797 | 795 | return trans_create_node_symbol_str(c, "c_void"); |
| 798 | | case BuiltinType::Bool: |
| 796 | case clang::BuiltinType::Bool: |
| 799 | 797 | return trans_create_node_symbol_str(c, "bool"); |
| 800 | | case BuiltinType::Char_U: |
| 801 | | case BuiltinType::UChar: |
| 802 | | case BuiltinType::Char_S: |
| 803 | | case BuiltinType::Char8: |
| 798 | case clang::BuiltinType::Char_U: |
| 799 | case clang::BuiltinType::UChar: |
| 800 | case clang::BuiltinType::Char_S: |
| 801 | case clang::BuiltinType::Char8: |
| 804 | 802 | return trans_create_node_symbol_str(c, "u8"); |
| 805 | | case BuiltinType::SChar: |
| 803 | case clang::BuiltinType::SChar: |
| 806 | 804 | return trans_create_node_symbol_str(c, "i8"); |
| 807 | | case BuiltinType::UShort: |
| 805 | case clang::BuiltinType::UShort: |
| 808 | 806 | return trans_create_node_symbol_str(c, "c_ushort"); |
| 809 | | case BuiltinType::UInt: |
| 807 | case clang::BuiltinType::UInt: |
| 810 | 808 | return trans_create_node_symbol_str(c, "c_uint"); |
| 811 | | case BuiltinType::ULong: |
| 809 | case clang::BuiltinType::ULong: |
| 812 | 810 | return trans_create_node_symbol_str(c, "c_ulong"); |
| 813 | | case BuiltinType::ULongLong: |
| 811 | case clang::BuiltinType::ULongLong: |
| 814 | 812 | return trans_create_node_symbol_str(c, "c_ulonglong"); |
| 815 | | case BuiltinType::Short: |
| 813 | case clang::BuiltinType::Short: |
| 816 | 814 | return trans_create_node_symbol_str(c, "c_short"); |
| 817 | | case BuiltinType::Int: |
| 815 | case clang::BuiltinType::Int: |
| 818 | 816 | return trans_create_node_symbol_str(c, "c_int"); |
| 819 | | case BuiltinType::Long: |
| 817 | case clang::BuiltinType::Long: |
| 820 | 818 | return trans_create_node_symbol_str(c, "c_long"); |
| 821 | | case BuiltinType::LongLong: |
| 819 | case clang::BuiltinType::LongLong: |
| 822 | 820 | return trans_create_node_symbol_str(c, "c_longlong"); |
| 823 | | case BuiltinType::UInt128: |
| 821 | case clang::BuiltinType::UInt128: |
| 824 | 822 | return trans_create_node_symbol_str(c, "u128"); |
| 825 | | case BuiltinType::Int128: |
| 823 | case clang::BuiltinType::Int128: |
| 826 | 824 | return trans_create_node_symbol_str(c, "i128"); |
| 827 | | case BuiltinType::Float: |
| 825 | case clang::BuiltinType::Float: |
| 828 | 826 | return trans_create_node_symbol_str(c, "f32"); |
| 829 | | case BuiltinType::Double: |
| 827 | case clang::BuiltinType::Double: |
| 830 | 828 | return trans_create_node_symbol_str(c, "f64"); |
| 831 | | case BuiltinType::Float128: |
| 829 | case clang::BuiltinType::Float128: |
| 832 | 830 | return trans_create_node_symbol_str(c, "f128"); |
| 833 | | case BuiltinType::Float16: |
| 831 | case clang::BuiltinType::Float16: |
| 834 | 832 | return trans_create_node_symbol_str(c, "f16"); |
| 835 | | case BuiltinType::LongDouble: |
| 833 | case clang::BuiltinType::LongDouble: |
| 836 | 834 | return trans_create_node_symbol_str(c, "c_longdouble"); |
| 837 | | case BuiltinType::WChar_U: |
| 838 | | case BuiltinType::Char16: |
| 839 | | case BuiltinType::Char32: |
| 840 | | case BuiltinType::WChar_S: |
| 841 | | case BuiltinType::Half: |
| 842 | | case BuiltinType::NullPtr: |
| 843 | | case BuiltinType::ObjCId: |
| 844 | | case BuiltinType::ObjCClass: |
| 845 | | case BuiltinType::ObjCSel: |
| 846 | | case BuiltinType::OMPArraySection: |
| 847 | | case BuiltinType::Dependent: |
| 848 | | case BuiltinType::Overload: |
| 849 | | case BuiltinType::BoundMember: |
| 850 | | case BuiltinType::PseudoObject: |
| 851 | | case BuiltinType::UnknownAny: |
| 852 | | case BuiltinType::BuiltinFn: |
| 853 | | case BuiltinType::ARCUnbridgedCast: |
| 854 | | case BuiltinType::ShortAccum: |
| 855 | | case BuiltinType::Accum: |
| 856 | | case BuiltinType::LongAccum: |
| 857 | | case BuiltinType::UShortAccum: |
| 858 | | case BuiltinType::UAccum: |
| 859 | | case BuiltinType::ULongAccum: |
| 860 | | |
| 861 | | case BuiltinType::OCLImage1dRO: |
| 862 | | case BuiltinType::OCLImage1dArrayRO: |
| 863 | | case BuiltinType::OCLImage1dBufferRO: |
| 864 | | case BuiltinType::OCLImage2dRO: |
| 865 | | case BuiltinType::OCLImage2dArrayRO: |
| 866 | | case BuiltinType::OCLImage2dDepthRO: |
| 867 | | case BuiltinType::OCLImage2dArrayDepthRO: |
| 868 | | case BuiltinType::OCLImage2dMSAARO: |
| 869 | | case BuiltinType::OCLImage2dArrayMSAARO: |
| 870 | | case BuiltinType::OCLImage2dMSAADepthRO: |
| 871 | | case BuiltinType::OCLImage2dArrayMSAADepthRO: |
| 872 | | case BuiltinType::OCLImage3dRO: |
| 873 | | case BuiltinType::OCLImage1dWO: |
| 874 | | case BuiltinType::OCLImage1dArrayWO: |
| 875 | | case BuiltinType::OCLImage1dBufferWO: |
| 876 | | case BuiltinType::OCLImage2dWO: |
| 877 | | case BuiltinType::OCLImage2dArrayWO: |
| 878 | | case BuiltinType::OCLImage2dDepthWO: |
| 879 | | case BuiltinType::OCLImage2dArrayDepthWO: |
| 880 | | case BuiltinType::OCLImage2dMSAAWO: |
| 881 | | case BuiltinType::OCLImage2dArrayMSAAWO: |
| 882 | | case BuiltinType::OCLImage2dMSAADepthWO: |
| 883 | | case BuiltinType::OCLImage2dArrayMSAADepthWO: |
| 884 | | case BuiltinType::OCLImage3dWO: |
| 885 | | case BuiltinType::OCLImage1dRW: |
| 886 | | case BuiltinType::OCLImage1dArrayRW: |
| 887 | | case BuiltinType::OCLImage1dBufferRW: |
| 888 | | case BuiltinType::OCLImage2dRW: |
| 889 | | case BuiltinType::OCLImage2dArrayRW: |
| 890 | | case BuiltinType::OCLImage2dDepthRW: |
| 891 | | case BuiltinType::OCLImage2dArrayDepthRW: |
| 892 | | case BuiltinType::OCLImage2dMSAARW: |
| 893 | | case BuiltinType::OCLImage2dArrayMSAARW: |
| 894 | | case BuiltinType::OCLImage2dMSAADepthRW: |
| 895 | | case BuiltinType::OCLImage2dArrayMSAADepthRW: |
| 896 | | case BuiltinType::OCLImage3dRW: |
| 897 | | case BuiltinType::OCLSampler: |
| 898 | | case BuiltinType::OCLEvent: |
| 899 | | case BuiltinType::OCLClkEvent: |
| 900 | | case BuiltinType::OCLQueue: |
| 901 | | case BuiltinType::OCLReserveID: |
| 902 | | case BuiltinType::ShortFract: |
| 903 | | case BuiltinType::Fract: |
| 904 | | case BuiltinType::LongFract: |
| 905 | | case BuiltinType::UShortFract: |
| 906 | | case BuiltinType::UFract: |
| 907 | | case BuiltinType::ULongFract: |
| 908 | | case BuiltinType::SatShortAccum: |
| 909 | | case BuiltinType::SatAccum: |
| 910 | | case BuiltinType::SatLongAccum: |
| 911 | | case BuiltinType::SatUShortAccum: |
| 912 | | case BuiltinType::SatUAccum: |
| 913 | | case BuiltinType::SatULongAccum: |
| 914 | | case BuiltinType::SatShortFract: |
| 915 | | case BuiltinType::SatFract: |
| 916 | | case BuiltinType::SatLongFract: |
| 917 | | case BuiltinType::SatUShortFract: |
| 918 | | case BuiltinType::SatUFract: |
| 919 | | case BuiltinType::SatULongFract: |
| 835 | case clang::BuiltinType::WChar_U: |
| 836 | case clang::BuiltinType::Char16: |
| 837 | case clang::BuiltinType::Char32: |
| 838 | case clang::BuiltinType::WChar_S: |
| 839 | case clang::BuiltinType::Half: |
| 840 | case clang::BuiltinType::NullPtr: |
| 841 | case clang::BuiltinType::ObjCId: |
| 842 | case clang::BuiltinType::ObjCClass: |
| 843 | case clang::BuiltinType::ObjCSel: |
| 844 | case clang::BuiltinType::OMPArraySection: |
| 845 | case clang::BuiltinType::Dependent: |
| 846 | case clang::BuiltinType::Overload: |
| 847 | case clang::BuiltinType::BoundMember: |
| 848 | case clang::BuiltinType::PseudoObject: |
| 849 | case clang::BuiltinType::UnknownAny: |
| 850 | case clang::BuiltinType::BuiltinFn: |
| 851 | case clang::BuiltinType::ARCUnbridgedCast: |
| 852 | case clang::BuiltinType::ShortAccum: |
| 853 | case clang::BuiltinType::Accum: |
| 854 | case clang::BuiltinType::LongAccum: |
| 855 | case clang::BuiltinType::UShortAccum: |
| 856 | case clang::BuiltinType::UAccum: |
| 857 | case clang::BuiltinType::ULongAccum: |
| 858 | |
| 859 | case clang::BuiltinType::OCLImage1dRO: |
| 860 | case clang::BuiltinType::OCLImage1dArrayRO: |
| 861 | case clang::BuiltinType::OCLImage1dBufferRO: |
| 862 | case clang::BuiltinType::OCLImage2dRO: |
| 863 | case clang::BuiltinType::OCLImage2dArrayRO: |
| 864 | case clang::BuiltinType::OCLImage2dDepthRO: |
| 865 | case clang::BuiltinType::OCLImage2dArrayDepthRO: |
| 866 | case clang::BuiltinType::OCLImage2dMSAARO: |
| 867 | case clang::BuiltinType::OCLImage2dArrayMSAARO: |
| 868 | case clang::BuiltinType::OCLImage2dMSAADepthRO: |
| 869 | case clang::BuiltinType::OCLImage2dArrayMSAADepthRO: |
| 870 | case clang::BuiltinType::OCLImage3dRO: |
| 871 | case clang::BuiltinType::OCLImage1dWO: |
| 872 | case clang::BuiltinType::OCLImage1dArrayWO: |
| 873 | case clang::BuiltinType::OCLImage1dBufferWO: |
| 874 | case clang::BuiltinType::OCLImage2dWO: |
| 875 | case clang::BuiltinType::OCLImage2dArrayWO: |
| 876 | case clang::BuiltinType::OCLImage2dDepthWO: |
| 877 | case clang::BuiltinType::OCLImage2dArrayDepthWO: |
| 878 | case clang::BuiltinType::OCLImage2dMSAAWO: |
| 879 | case clang::BuiltinType::OCLImage2dArrayMSAAWO: |
| 880 | case clang::BuiltinType::OCLImage2dMSAADepthWO: |
| 881 | case clang::BuiltinType::OCLImage2dArrayMSAADepthWO: |
| 882 | case clang::BuiltinType::OCLImage3dWO: |
| 883 | case clang::BuiltinType::OCLImage1dRW: |
| 884 | case clang::BuiltinType::OCLImage1dArrayRW: |
| 885 | case clang::BuiltinType::OCLImage1dBufferRW: |
| 886 | case clang::BuiltinType::OCLImage2dRW: |
| 887 | case clang::BuiltinType::OCLImage2dArrayRW: |
| 888 | case clang::BuiltinType::OCLImage2dDepthRW: |
| 889 | case clang::BuiltinType::OCLImage2dArrayDepthRW: |
| 890 | case clang::BuiltinType::OCLImage2dMSAARW: |
| 891 | case clang::BuiltinType::OCLImage2dArrayMSAARW: |
| 892 | case clang::BuiltinType::OCLImage2dMSAADepthRW: |
| 893 | case clang::BuiltinType::OCLImage2dArrayMSAADepthRW: |
| 894 | case clang::BuiltinType::OCLImage3dRW: |
| 895 | case clang::BuiltinType::OCLSampler: |
| 896 | case clang::BuiltinType::OCLEvent: |
| 897 | case clang::BuiltinType::OCLClkEvent: |
| 898 | case clang::BuiltinType::OCLQueue: |
| 899 | case clang::BuiltinType::OCLReserveID: |
| 900 | case clang::BuiltinType::ShortFract: |
| 901 | case clang::BuiltinType::Fract: |
| 902 | case clang::BuiltinType::LongFract: |
| 903 | case clang::BuiltinType::UShortFract: |
| 904 | case clang::BuiltinType::UFract: |
| 905 | case clang::BuiltinType::ULongFract: |
| 906 | case clang::BuiltinType::SatShortAccum: |
| 907 | case clang::BuiltinType::SatAccum: |
| 908 | case clang::BuiltinType::SatLongAccum: |
| 909 | case clang::BuiltinType::SatUShortAccum: |
| 910 | case clang::BuiltinType::SatUAccum: |
| 911 | case clang::BuiltinType::SatULongAccum: |
| 912 | case clang::BuiltinType::SatShortFract: |
| 913 | case clang::BuiltinType::SatFract: |
| 914 | case clang::BuiltinType::SatLongFract: |
| 915 | case clang::BuiltinType::SatUShortFract: |
| 916 | case clang::BuiltinType::SatUFract: |
| 917 | case clang::BuiltinType::SatULongFract: |
| 920 | 918 | emit_warning(c, source_loc, "unsupported builtin type"); |
| 921 | 919 | return nullptr; |
| 922 | 920 | } |
| 923 | 921 | break; |
| 924 | 922 | } |
| 925 | | case Type::Pointer: |
| 923 | case clang::Type::Pointer: |
| 926 | 924 | { |
| 927 | | const PointerType *pointer_ty = static_cast<const PointerType*>(ty); |
| 928 | | QualType child_qt = pointer_ty->getPointeeType(); |
| 925 | const clang::PointerType *pointer_ty = static_cast<const clang::PointerType*>(ty); |
| 926 | clang::QualType child_qt = pointer_ty->getPointeeType(); |
| 929 | 927 | AstNode *child_node = trans_qual_type(c, child_qt, source_loc); |
| 930 | 928 | if (child_node == nullptr) { |
| 931 | 929 | emit_warning(c, source_loc, "pointer to unsupported type"); |
| ... | ... | @@ -945,84 +943,84 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou |
| 945 | 943 | child_qt.isVolatileQualified(), child_node, PtrLenC); |
| 946 | 944 | } |
| 947 | 945 | } |
| 948 | | case Type::Typedef: |
| 946 | case clang::Type::Typedef: |
| 949 | 947 | { |
| 950 | | const TypedefType *typedef_ty = static_cast<const TypedefType*>(ty); |
| 951 | | const TypedefNameDecl *typedef_decl = typedef_ty->getDecl(); |
| 948 | const clang::TypedefType *typedef_ty = static_cast<const clang::TypedefType*>(ty); |
| 949 | const clang::TypedefNameDecl *typedef_decl = typedef_ty->getDecl(); |
| 952 | 950 | return resolve_typedef_decl(c, typedef_decl); |
| 953 | 951 | } |
| 954 | | case Type::Elaborated: |
| 952 | case clang::Type::Elaborated: |
| 955 | 953 | { |
| 956 | | const ElaboratedType *elaborated_ty = static_cast<const ElaboratedType*>(ty); |
| 954 | const clang::ElaboratedType *elaborated_ty = static_cast<const clang::ElaboratedType*>(ty); |
| 957 | 955 | switch (elaborated_ty->getKeyword()) { |
| 958 | | case ETK_Struct: |
| 959 | | case ETK_Enum: |
| 960 | | case ETK_Union: |
| 956 | case clang::ETK_Struct: |
| 957 | case clang::ETK_Enum: |
| 958 | case clang::ETK_Union: |
| 961 | 959 | return trans_qual_type(c, elaborated_ty->getNamedType(), source_loc); |
| 962 | | case ETK_Interface: |
| 963 | | case ETK_Class: |
| 964 | | case ETK_Typename: |
| 965 | | case ETK_None: |
| 960 | case clang::ETK_Interface: |
| 961 | case clang::ETK_Class: |
| 962 | case clang::ETK_Typename: |
| 963 | case clang::ETK_None: |
| 966 | 964 | emit_warning(c, source_loc, "unsupported elaborated type"); |
| 967 | 965 | return nullptr; |
| 968 | 966 | } |
| 969 | 967 | } |
| 970 | | case Type::FunctionProto: |
| 968 | case clang::Type::FunctionProto: |
| 971 | 969 | { |
| 972 | | const FunctionProtoType *fn_proto_ty = static_cast<const FunctionProtoType*>(ty); |
| 970 | const clang::FunctionProtoType *fn_proto_ty = static_cast<const clang::FunctionProtoType*>(ty); |
| 973 | 971 | |
| 974 | 972 | AstNode *proto_node = trans_create_node(c, NodeTypeFnProto); |
| 975 | 973 | switch (fn_proto_ty->getCallConv()) { |
| 976 | | case CC_C: // __attribute__((cdecl)) |
| 974 | case clang::CC_C: // __attribute__((cdecl)) |
| 977 | 975 | proto_node->data.fn_proto.cc = CallingConventionC; |
| 978 | 976 | proto_node->data.fn_proto.is_extern = true; |
| 979 | 977 | break; |
| 980 | | case CC_X86StdCall: // __attribute__((stdcall)) |
| 978 | case clang::CC_X86StdCall: // __attribute__((stdcall)) |
| 981 | 979 | proto_node->data.fn_proto.cc = CallingConventionStdcall; |
| 982 | 980 | break; |
| 983 | | case CC_X86FastCall: // __attribute__((fastcall)) |
| 981 | case clang::CC_X86FastCall: // __attribute__((fastcall)) |
| 984 | 982 | emit_warning(c, source_loc, "unsupported calling convention: x86 fastcall"); |
| 985 | 983 | return nullptr; |
| 986 | | case CC_X86ThisCall: // __attribute__((thiscall)) |
| 984 | case clang::CC_X86ThisCall: // __attribute__((thiscall)) |
| 987 | 985 | emit_warning(c, source_loc, "unsupported calling convention: x86 thiscall"); |
| 988 | 986 | return nullptr; |
| 989 | | case CC_X86VectorCall: // __attribute__((vectorcall)) |
| 987 | case clang::CC_X86VectorCall: // __attribute__((vectorcall)) |
| 990 | 988 | emit_warning(c, source_loc, "unsupported calling convention: x86 vectorcall"); |
| 991 | 989 | return nullptr; |
| 992 | | case CC_X86Pascal: // __attribute__((pascal)) |
| 990 | case clang::CC_X86Pascal: // __attribute__((pascal)) |
| 993 | 991 | emit_warning(c, source_loc, "unsupported calling convention: x86 pascal"); |
| 994 | 992 | return nullptr; |
| 995 | | case CC_Win64: // __attribute__((ms_abi)) |
| 993 | case clang::CC_Win64: // __attribute__((ms_abi)) |
| 996 | 994 | emit_warning(c, source_loc, "unsupported calling convention: win64"); |
| 997 | 995 | return nullptr; |
| 998 | | case CC_X86_64SysV: // __attribute__((sysv_abi)) |
| 996 | case clang::CC_X86_64SysV: // __attribute__((sysv_abi)) |
| 999 | 997 | emit_warning(c, source_loc, "unsupported calling convention: x86 64sysv"); |
| 1000 | 998 | return nullptr; |
| 1001 | | case CC_X86RegCall: |
| 999 | case clang::CC_X86RegCall: |
| 1002 | 1000 | emit_warning(c, source_loc, "unsupported calling convention: x86 reg"); |
| 1003 | 1001 | return nullptr; |
| 1004 | | case CC_AAPCS: // __attribute__((pcs("aapcs"))) |
| 1002 | case clang::CC_AAPCS: // __attribute__((pcs("aapcs"))) |
| 1005 | 1003 | emit_warning(c, source_loc, "unsupported calling convention: aapcs"); |
| 1006 | 1004 | return nullptr; |
| 1007 | | case CC_AAPCS_VFP: // __attribute__((pcs("aapcs-vfp"))) |
| 1005 | case clang::CC_AAPCS_VFP: // __attribute__((pcs("aapcs-vfp"))) |
| 1008 | 1006 | emit_warning(c, source_loc, "unsupported calling convention: aapcs-vfp"); |
| 1009 | 1007 | return nullptr; |
| 1010 | | case CC_IntelOclBicc: // __attribute__((intel_ocl_bicc)) |
| 1008 | case clang::CC_IntelOclBicc: // __attribute__((intel_ocl_bicc)) |
| 1011 | 1009 | emit_warning(c, source_loc, "unsupported calling convention: intel_ocl_bicc"); |
| 1012 | 1010 | return nullptr; |
| 1013 | | case CC_SpirFunction: // default for OpenCL functions on SPIR target |
| 1011 | case clang::CC_SpirFunction: // default for OpenCL functions on SPIR target |
| 1014 | 1012 | emit_warning(c, source_loc, "unsupported calling convention: SPIR function"); |
| 1015 | 1013 | return nullptr; |
| 1016 | | case CC_OpenCLKernel: |
| 1014 | case clang::CC_OpenCLKernel: |
| 1017 | 1015 | emit_warning(c, source_loc, "unsupported calling convention: OpenCLKernel"); |
| 1018 | 1016 | return nullptr; |
| 1019 | | case CC_Swift: |
| 1017 | case clang::CC_Swift: |
| 1020 | 1018 | emit_warning(c, source_loc, "unsupported calling convention: Swift"); |
| 1021 | 1019 | return nullptr; |
| 1022 | | case CC_PreserveMost: |
| 1020 | case clang::CC_PreserveMost: |
| 1023 | 1021 | emit_warning(c, source_loc, "unsupported calling convention: PreserveMost"); |
| 1024 | 1022 | return nullptr; |
| 1025 | | case CC_PreserveAll: |
| 1023 | case clang::CC_PreserveAll: |
| 1026 | 1024 | emit_warning(c, source_loc, "unsupported calling convention: PreserveAll"); |
| 1027 | 1025 | return nullptr; |
| 1028 | 1026 | } |
| ... | ... | @@ -1040,7 +1038,7 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou |
| 1040 | 1038 | return nullptr; |
| 1041 | 1039 | } |
| 1042 | 1040 | // convert c_void to actual void (only for return type) |
| 1043 | | // we do want to look at the AstNode instead of QualType, because |
| 1041 | // we do want to look at the AstNode instead of clang::QualType, because |
| 1044 | 1042 | // if they do something like: |
| 1045 | 1043 | // typedef Foo void; |
| 1046 | 1044 | // void foo(void) -> Foo; |
| ... | ... | @@ -1057,7 +1055,7 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou |
| 1057 | 1055 | } |
| 1058 | 1056 | |
| 1059 | 1057 | for (size_t i = 0; i < param_count; i += 1) { |
| 1060 | | QualType qt = fn_proto_ty->getParamType(i); |
| 1058 | clang::QualType qt = fn_proto_ty->getParamType(i); |
| 1061 | 1059 | AstNode *param_type_node = trans_qual_type(c, qt, source_loc); |
| 1062 | 1060 | |
| 1063 | 1061 | if (param_type_node == nullptr) { |
| ... | ... | @@ -1080,19 +1078,19 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou |
| 1080 | 1078 | |
| 1081 | 1079 | return proto_node; |
| 1082 | 1080 | } |
| 1083 | | case Type::Record: |
| 1081 | case clang::Type::Record: |
| 1084 | 1082 | { |
| 1085 | | const RecordType *record_ty = static_cast<const RecordType*>(ty); |
| 1083 | const clang::RecordType *record_ty = static_cast<const clang::RecordType*>(ty); |
| 1086 | 1084 | return resolve_record_decl(c, record_ty->getDecl()); |
| 1087 | 1085 | } |
| 1088 | | case Type::Enum: |
| 1086 | case clang::Type::Enum: |
| 1089 | 1087 | { |
| 1090 | | const EnumType *enum_ty = static_cast<const EnumType*>(ty); |
| 1088 | const clang::EnumType *enum_ty = static_cast<const clang::EnumType*>(ty); |
| 1091 | 1089 | return resolve_enum_decl(c, enum_ty->getDecl()); |
| 1092 | 1090 | } |
| 1093 | | case Type::ConstantArray: |
| 1091 | case clang::Type::ConstantArray: |
| 1094 | 1092 | { |
| 1095 | | const ConstantArrayType *const_arr_ty = static_cast<const ConstantArrayType *>(ty); |
| 1093 | const clang::ConstantArrayType *const_arr_ty = static_cast<const clang::ConstantArrayType *>(ty); |
| 1096 | 1094 | AstNode *child_type_node = trans_qual_type(c, const_arr_ty->getElementType(), source_loc); |
| 1097 | 1095 | if (child_type_node == nullptr) { |
| 1098 | 1096 | emit_warning(c, source_loc, "unresolved array element type"); |
| ... | ... | @@ -1102,25 +1100,25 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou |
| 1102 | 1100 | AstNode *size_node = trans_create_node_unsigned(c, size); |
| 1103 | 1101 | return trans_create_node_array_type(c, size_node, child_type_node); |
| 1104 | 1102 | } |
| 1105 | | case Type::Paren: |
| 1103 | case clang::Type::Paren: |
| 1106 | 1104 | { |
| 1107 | | const ParenType *paren_ty = static_cast<const ParenType *>(ty); |
| 1105 | const clang::ParenType *paren_ty = static_cast<const clang::ParenType *>(ty); |
| 1108 | 1106 | return trans_qual_type(c, paren_ty->getInnerType(), source_loc); |
| 1109 | 1107 | } |
| 1110 | | case Type::Decayed: |
| 1108 | case clang::Type::Decayed: |
| 1111 | 1109 | { |
| 1112 | | const DecayedType *decayed_ty = static_cast<const DecayedType *>(ty); |
| 1110 | const clang::DecayedType *decayed_ty = static_cast<const clang::DecayedType *>(ty); |
| 1113 | 1111 | return trans_qual_type(c, decayed_ty->getDecayedType(), source_loc); |
| 1114 | 1112 | } |
| 1115 | | case Type::Attributed: |
| 1113 | case clang::Type::Attributed: |
| 1116 | 1114 | { |
| 1117 | | const AttributedType *attributed_ty = static_cast<const AttributedType *>(ty); |
| 1115 | const clang::AttributedType *attributed_ty = static_cast<const clang::AttributedType *>(ty); |
| 1118 | 1116 | return trans_qual_type(c, attributed_ty->getEquivalentType(), source_loc); |
| 1119 | 1117 | } |
| 1120 | | case Type::IncompleteArray: |
| 1118 | case clang::Type::IncompleteArray: |
| 1121 | 1119 | { |
| 1122 | | const IncompleteArrayType *incomplete_array_ty = static_cast<const IncompleteArrayType *>(ty); |
| 1123 | | QualType child_qt = incomplete_array_ty->getElementType(); |
| 1120 | const clang::IncompleteArrayType *incomplete_array_ty = static_cast<const clang::IncompleteArrayType *>(ty); |
| 1121 | clang::QualType child_qt = incomplete_array_ty->getElementType(); |
| 1124 | 1122 | AstNode *child_type_node = trans_qual_type(c, child_qt, source_loc); |
| 1125 | 1123 | if (child_type_node == nullptr) { |
| 1126 | 1124 | emit_warning(c, source_loc, "unresolved array element type"); |
| ... | ... | @@ -1130,56 +1128,56 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou |
| 1130 | 1128 | child_qt.isVolatileQualified(), child_type_node, PtrLenC); |
| 1131 | 1129 | return pointer_node; |
| 1132 | 1130 | } |
| 1133 | | case Type::BlockPointer: |
| 1134 | | case Type::LValueReference: |
| 1135 | | case Type::RValueReference: |
| 1136 | | case Type::MemberPointer: |
| 1137 | | case Type::VariableArray: |
| 1138 | | case Type::DependentSizedArray: |
| 1139 | | case Type::DependentSizedExtVector: |
| 1140 | | case Type::Vector: |
| 1141 | | case Type::ExtVector: |
| 1142 | | case Type::FunctionNoProto: |
| 1143 | | case Type::UnresolvedUsing: |
| 1144 | | case Type::Adjusted: |
| 1145 | | case Type::TypeOfExpr: |
| 1146 | | case Type::TypeOf: |
| 1147 | | case Type::Decltype: |
| 1148 | | case Type::UnaryTransform: |
| 1149 | | case Type::TemplateTypeParm: |
| 1150 | | case Type::SubstTemplateTypeParm: |
| 1151 | | case Type::SubstTemplateTypeParmPack: |
| 1152 | | case Type::TemplateSpecialization: |
| 1153 | | case Type::Auto: |
| 1154 | | case Type::InjectedClassName: |
| 1155 | | case Type::DependentName: |
| 1156 | | case Type::DependentTemplateSpecialization: |
| 1157 | | case Type::PackExpansion: |
| 1158 | | case Type::ObjCObject: |
| 1159 | | case Type::ObjCInterface: |
| 1160 | | case Type::Complex: |
| 1161 | | case Type::ObjCObjectPointer: |
| 1162 | | case Type::Atomic: |
| 1163 | | case Type::Pipe: |
| 1164 | | case Type::ObjCTypeParam: |
| 1165 | | case Type::DeducedTemplateSpecialization: |
| 1166 | | case Type::DependentAddressSpace: |
| 1167 | | case Type::DependentVector: |
| 1131 | case clang::Type::BlockPointer: |
| 1132 | case clang::Type::LValueReference: |
| 1133 | case clang::Type::RValueReference: |
| 1134 | case clang::Type::MemberPointer: |
| 1135 | case clang::Type::VariableArray: |
| 1136 | case clang::Type::DependentSizedArray: |
| 1137 | case clang::Type::DependentSizedExtVector: |
| 1138 | case clang::Type::Vector: |
| 1139 | case clang::Type::ExtVector: |
| 1140 | case clang::Type::FunctionNoProto: |
| 1141 | case clang::Type::UnresolvedUsing: |
| 1142 | case clang::Type::Adjusted: |
| 1143 | case clang::Type::TypeOfExpr: |
| 1144 | case clang::Type::TypeOf: |
| 1145 | case clang::Type::Decltype: |
| 1146 | case clang::Type::UnaryTransform: |
| 1147 | case clang::Type::TemplateTypeParm: |
| 1148 | case clang::Type::SubstTemplateTypeParm: |
| 1149 | case clang::Type::SubstTemplateTypeParmPack: |
| 1150 | case clang::Type::TemplateSpecialization: |
| 1151 | case clang::Type::Auto: |
| 1152 | case clang::Type::InjectedClassName: |
| 1153 | case clang::Type::DependentName: |
| 1154 | case clang::Type::DependentTemplateSpecialization: |
| 1155 | case clang::Type::PackExpansion: |
| 1156 | case clang::Type::ObjCObject: |
| 1157 | case clang::Type::ObjCInterface: |
| 1158 | case clang::Type::Complex: |
| 1159 | case clang::Type::ObjCObjectPointer: |
| 1160 | case clang::Type::Atomic: |
| 1161 | case clang::Type::Pipe: |
| 1162 | case clang::Type::ObjCTypeParam: |
| 1163 | case clang::Type::DeducedTemplateSpecialization: |
| 1164 | case clang::Type::DependentAddressSpace: |
| 1165 | case clang::Type::DependentVector: |
| 1168 | 1166 | emit_warning(c, source_loc, "unsupported type: '%s'", ty->getTypeClassName()); |
| 1169 | 1167 | return nullptr; |
| 1170 | 1168 | } |
| 1171 | 1169 | zig_unreachable(); |
| 1172 | 1170 | } |
| 1173 | 1171 | |
| 1174 | | static AstNode *trans_qual_type(Context *c, QualType qt, const SourceLocation &source_loc) { |
| 1172 | static AstNode *trans_qual_type(Context *c, clang::QualType qt, const clang::SourceLocation &source_loc) { |
| 1175 | 1173 | return trans_type(c, qt.getTypePtr(), source_loc); |
| 1176 | 1174 | } |
| 1177 | 1175 | |
| 1178 | | static int trans_compound_stmt_inline(Context *c, TransScope *scope, const CompoundStmt *stmt, |
| 1176 | static int trans_compound_stmt_inline(Context *c, TransScope *scope, const clang::CompoundStmt *stmt, |
| 1179 | 1177 | AstNode *block_node, TransScope **out_node_scope) |
| 1180 | 1178 | { |
| 1181 | 1179 | assert(block_node->type == NodeTypeBlock); |
| 1182 | | for (CompoundStmt::const_body_iterator it = stmt->body_begin(), end_it = stmt->body_end(); it != end_it; ++it) { |
| 1180 | for (clang::CompoundStmt::const_body_iterator it = stmt->body_begin(), end_it = stmt->body_end(); it != end_it; ++it) { |
| 1183 | 1181 | AstNode *child_node; |
| 1184 | 1182 | scope = trans_stmt(c, scope, *it, &child_node); |
| 1185 | 1183 | if (scope == nullptr) |
| ... | ... | @@ -1193,7 +1191,7 @@ static int trans_compound_stmt_inline(Context *c, TransScope *scope, const Compo |
| 1193 | 1191 | return ErrorNone; |
| 1194 | 1192 | } |
| 1195 | 1193 | |
| 1196 | | static AstNode *trans_compound_stmt(Context *c, TransScope *scope, const CompoundStmt *stmt, |
| 1194 | static AstNode *trans_compound_stmt(Context *c, TransScope *scope, const clang::CompoundStmt *stmt, |
| 1197 | 1195 | TransScope **out_node_scope) |
| 1198 | 1196 | { |
| 1199 | 1197 | TransScopeBlock *child_scope_block = trans_scope_block_create(c, scope); |
| ... | ... | @@ -1202,8 +1200,8 @@ static AstNode *trans_compound_stmt(Context *c, TransScope *scope, const Compoun |
| 1202 | 1200 | return child_scope_block->node; |
| 1203 | 1201 | } |
| 1204 | 1202 | |
| 1205 | | static AstNode *trans_return_stmt(Context *c, TransScope *scope, const ReturnStmt *stmt) { |
| 1206 | | const Expr *value_expr = stmt->getRetValue(); |
| 1203 | static AstNode *trans_return_stmt(Context *c, TransScope *scope, const clang::ReturnStmt *stmt) { |
| 1204 | const clang::Expr *value_expr = stmt->getRetValue(); |
| 1207 | 1205 | if (value_expr == nullptr) { |
| 1208 | 1206 | return trans_create_node(c, NodeTypeReturnExpr); |
| 1209 | 1207 | } else { |
| ... | ... | @@ -1215,7 +1213,7 @@ static AstNode *trans_return_stmt(Context *c, TransScope *scope, const ReturnStm |
| 1215 | 1213 | } |
| 1216 | 1214 | } |
| 1217 | 1215 | |
| 1218 | | static AstNode *trans_integer_literal(Context *c, const IntegerLiteral *stmt) { |
| 1216 | static AstNode *trans_integer_literal(Context *c, const clang::IntegerLiteral *stmt) { |
| 1219 | 1217 | llvm::APSInt result; |
| 1220 | 1218 | if (!stmt->EvaluateAsInt(result, *c->ctx)) { |
| 1221 | 1219 | emit_warning(c, stmt->getLocStart(), "invalid integer literal"); |
| ... | ... | @@ -1225,13 +1223,13 @@ static AstNode *trans_integer_literal(Context *c, const IntegerLiteral *stmt) { |
| 1225 | 1223 | } |
| 1226 | 1224 | |
| 1227 | 1225 | static AstNode *trans_conditional_operator(Context *c, ResultUsed result_used, TransScope *scope, |
| 1228 | | const ConditionalOperator *stmt) |
| 1226 | const clang::ConditionalOperator *stmt) |
| 1229 | 1227 | { |
| 1230 | 1228 | AstNode *node = trans_create_node(c, NodeTypeIfBoolExpr); |
| 1231 | 1229 | |
| 1232 | | Expr *cond_expr = stmt->getCond(); |
| 1233 | | Expr *true_expr = stmt->getTrueExpr(); |
| 1234 | | Expr *false_expr = stmt->getFalseExpr(); |
| 1230 | clang::Expr *cond_expr = stmt->getCond(); |
| 1231 | clang::Expr *true_expr = stmt->getTrueExpr(); |
| 1232 | clang::Expr *false_expr = stmt->getFalseExpr(); |
| 1235 | 1233 | |
| 1236 | 1234 | node->data.if_bool_expr.condition = trans_expr(c, ResultUsedYes, scope, cond_expr, TransRValue); |
| 1237 | 1235 | if (node->data.if_bool_expr.condition == nullptr) |
| ... | ... | @@ -1248,7 +1246,7 @@ static AstNode *trans_conditional_operator(Context *c, ResultUsed result_used, T |
| 1248 | 1246 | return maybe_suppress_result(c, result_used, node); |
| 1249 | 1247 | } |
| 1250 | 1248 | |
| 1251 | | static AstNode *trans_create_bin_op(Context *c, TransScope *scope, Expr *lhs, BinOpType bin_op, Expr *rhs) { |
| 1249 | static AstNode *trans_create_bin_op(Context *c, TransScope *scope, clang::Expr *lhs, BinOpType bin_op, clang::Expr *rhs) { |
| 1252 | 1250 | AstNode *node = trans_create_node(c, NodeTypeBinOpExpr); |
| 1253 | 1251 | node->data.bin_op_expr.bin_op = bin_op; |
| 1254 | 1252 | |
| ... | ... | @@ -1263,7 +1261,7 @@ static AstNode *trans_create_bin_op(Context *c, TransScope *scope, Expr *lhs, Bi |
| 1263 | 1261 | return node; |
| 1264 | 1262 | } |
| 1265 | 1263 | |
| 1266 | | static AstNode *trans_create_bool_bin_op(Context *c, TransScope *scope, Expr *lhs, BinOpType bin_op, Expr *rhs) { |
| 1264 | static AstNode *trans_create_bool_bin_op(Context *c, TransScope *scope, clang::Expr *lhs, BinOpType bin_op, clang::Expr *rhs) { |
| 1267 | 1265 | assert(bin_op == BinOpTypeBoolAnd || bin_op == BinOpTypeBoolOr); |
| 1268 | 1266 | AstNode *node = trans_create_node(c, NodeTypeBinOpExpr); |
| 1269 | 1267 | node->data.bin_op_expr.bin_op = bin_op; |
| ... | ... | @@ -1279,7 +1277,7 @@ static AstNode *trans_create_bool_bin_op(Context *c, TransScope *scope, Expr *lh |
| 1279 | 1277 | return node; |
| 1280 | 1278 | } |
| 1281 | 1279 | |
| 1282 | | static AstNode *trans_create_assign(Context *c, ResultUsed result_used, TransScope *scope, Expr *lhs, Expr *rhs) { |
| 1280 | static AstNode *trans_create_assign(Context *c, ResultUsed result_used, TransScope *scope, clang::Expr *lhs, clang::Expr *rhs) { |
| 1283 | 1281 | if (result_used == ResultUsedNo) { |
| 1284 | 1282 | // common case |
| 1285 | 1283 | AstNode *node = trans_create_node(c, NodeTypeBinOpExpr); |
| ... | ... | @@ -1330,10 +1328,10 @@ static AstNode *trans_create_assign(Context *c, ResultUsed result_used, TransSco |
| 1330 | 1328 | } |
| 1331 | 1329 | } |
| 1332 | 1330 | |
| 1333 | | static AstNode *trans_create_shift_op(Context *c, TransScope *scope, QualType result_type, |
| 1334 | | Expr *lhs_expr, BinOpType bin_op, Expr *rhs_expr) |
| 1331 | static AstNode *trans_create_shift_op(Context *c, TransScope *scope, clang::QualType result_type, |
| 1332 | clang::Expr *lhs_expr, BinOpType bin_op, clang::Expr *rhs_expr) |
| 1335 | 1333 | { |
| 1336 | | const SourceLocation &rhs_location = rhs_expr->getLocStart(); |
| 1334 | const clang::SourceLocation &rhs_location = rhs_expr->getLocStart(); |
| 1337 | 1335 | AstNode *rhs_type = qual_type_to_log2_int_ref(c, result_type, rhs_location); |
| 1338 | 1336 | // lhs >> u5(rh) |
| 1339 | 1337 | |
| ... | ... | @@ -1347,22 +1345,22 @@ static AstNode *trans_create_shift_op(Context *c, TransScope *scope, QualType re |
| 1347 | 1345 | return trans_create_node_bin_op(c, lhs, bin_op, coerced_rhs); |
| 1348 | 1346 | } |
| 1349 | 1347 | |
| 1350 | | static AstNode *trans_binary_operator(Context *c, ResultUsed result_used, TransScope *scope, const BinaryOperator *stmt) { |
| 1348 | static AstNode *trans_binary_operator(Context *c, ResultUsed result_used, TransScope *scope, const clang::BinaryOperator *stmt) { |
| 1351 | 1349 | switch (stmt->getOpcode()) { |
| 1352 | | case BO_PtrMemD: |
| 1353 | | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: BO_PtrMemD"); |
| 1350 | case clang::BO_PtrMemD: |
| 1351 | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: clang::BO_PtrMemD"); |
| 1354 | 1352 | return nullptr; |
| 1355 | | case BO_PtrMemI: |
| 1356 | | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: BO_PtrMemI"); |
| 1353 | case clang::BO_PtrMemI: |
| 1354 | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: clang::BO_PtrMemI"); |
| 1357 | 1355 | return nullptr; |
| 1358 | | case BO_Cmp: |
| 1359 | | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: BO_Cmp"); |
| 1356 | case clang::BO_Cmp: |
| 1357 | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: clang::BO_Cmp"); |
| 1360 | 1358 | return nullptr; |
| 1361 | | case BO_Mul: |
| 1359 | case clang::BO_Mul: |
| 1362 | 1360 | return trans_create_bin_op(c, scope, stmt->getLHS(), |
| 1363 | 1361 | qual_type_has_wrapping_overflow(c, stmt->getType()) ? BinOpTypeMultWrap : BinOpTypeMult, |
| 1364 | 1362 | stmt->getRHS()); |
| 1365 | | case BO_Div: |
| 1363 | case clang::BO_Div: |
| 1366 | 1364 | if (qual_type_has_wrapping_overflow(c, stmt->getType())) { |
| 1367 | 1365 | // unsigned/float division uses the operator |
| 1368 | 1366 | return trans_create_bin_op(c, scope, stmt->getLHS(), BinOpTypeDiv, stmt->getRHS()); |
| ... | ... | @@ -1377,7 +1375,7 @@ static AstNode *trans_binary_operator(Context *c, ResultUsed result_used, TransS |
| 1377 | 1375 | fn_call->data.fn_call_expr.params.append(rhs); |
| 1378 | 1376 | return fn_call; |
| 1379 | 1377 | } |
| 1380 | | case BO_Rem: |
| 1378 | case clang::BO_Rem: |
| 1381 | 1379 | if (qual_type_has_wrapping_overflow(c, stmt->getType())) { |
| 1382 | 1380 | // unsigned/float division uses the operator |
| 1383 | 1381 | return trans_create_bin_op(c, scope, stmt->getLHS(), BinOpTypeMod, stmt->getRHS()); |
| ... | ... | @@ -1392,43 +1390,43 @@ static AstNode *trans_binary_operator(Context *c, ResultUsed result_used, TransS |
| 1392 | 1390 | fn_call->data.fn_call_expr.params.append(rhs); |
| 1393 | 1391 | return fn_call; |
| 1394 | 1392 | } |
| 1395 | | case BO_Add: |
| 1393 | case clang::BO_Add: |
| 1396 | 1394 | return trans_create_bin_op(c, scope, stmt->getLHS(), |
| 1397 | 1395 | qual_type_has_wrapping_overflow(c, stmt->getType()) ? BinOpTypeAddWrap : BinOpTypeAdd, |
| 1398 | 1396 | stmt->getRHS()); |
| 1399 | | case BO_Sub: |
| 1397 | case clang::BO_Sub: |
| 1400 | 1398 | return trans_create_bin_op(c, scope, stmt->getLHS(), |
| 1401 | 1399 | qual_type_has_wrapping_overflow(c, stmt->getType()) ? BinOpTypeSubWrap : BinOpTypeSub, |
| 1402 | 1400 | stmt->getRHS()); |
| 1403 | | case BO_Shl: |
| 1401 | case clang::BO_Shl: |
| 1404 | 1402 | return trans_create_shift_op(c, scope, stmt->getType(), stmt->getLHS(), BinOpTypeBitShiftLeft, stmt->getRHS()); |
| 1405 | | case BO_Shr: |
| 1403 | case clang::BO_Shr: |
| 1406 | 1404 | return trans_create_shift_op(c, scope, stmt->getType(), stmt->getLHS(), BinOpTypeBitShiftRight, stmt->getRHS()); |
| 1407 | | case BO_LT: |
| 1405 | case clang::BO_LT: |
| 1408 | 1406 | return trans_create_bin_op(c, scope, stmt->getLHS(), BinOpTypeCmpLessThan, stmt->getRHS()); |
| 1409 | | case BO_GT: |
| 1407 | case clang::BO_GT: |
| 1410 | 1408 | return trans_create_bin_op(c, scope, stmt->getLHS(), BinOpTypeCmpGreaterThan, stmt->getRHS()); |
| 1411 | | case BO_LE: |
| 1409 | case clang::BO_LE: |
| 1412 | 1410 | return trans_create_bin_op(c, scope, stmt->getLHS(), BinOpTypeCmpLessOrEq, stmt->getRHS()); |
| 1413 | | case BO_GE: |
| 1411 | case clang::BO_GE: |
| 1414 | 1412 | return trans_create_bin_op(c, scope, stmt->getLHS(), BinOpTypeCmpGreaterOrEq, stmt->getRHS()); |
| 1415 | | case BO_EQ: |
| 1413 | case clang::BO_EQ: |
| 1416 | 1414 | return trans_create_bin_op(c, scope, stmt->getLHS(), BinOpTypeCmpEq, stmt->getRHS()); |
| 1417 | | case BO_NE: |
| 1415 | case clang::BO_NE: |
| 1418 | 1416 | return trans_create_bin_op(c, scope, stmt->getLHS(), BinOpTypeCmpNotEq, stmt->getRHS()); |
| 1419 | | case BO_And: |
| 1417 | case clang::BO_And: |
| 1420 | 1418 | return trans_create_bin_op(c, scope, stmt->getLHS(), BinOpTypeBinAnd, stmt->getRHS()); |
| 1421 | | case BO_Xor: |
| 1419 | case clang::BO_Xor: |
| 1422 | 1420 | return trans_create_bin_op(c, scope, stmt->getLHS(), BinOpTypeBinXor, stmt->getRHS()); |
| 1423 | | case BO_Or: |
| 1421 | case clang::BO_Or: |
| 1424 | 1422 | return trans_create_bin_op(c, scope, stmt->getLHS(), BinOpTypeBinOr, stmt->getRHS()); |
| 1425 | | case BO_LAnd: |
| 1423 | case clang::BO_LAnd: |
| 1426 | 1424 | return trans_create_bool_bin_op(c, scope, stmt->getLHS(), BinOpTypeBoolAnd, stmt->getRHS()); |
| 1427 | | case BO_LOr: |
| 1425 | case clang::BO_LOr: |
| 1428 | 1426 | return trans_create_bool_bin_op(c, scope, stmt->getLHS(), BinOpTypeBoolOr, stmt->getRHS()); |
| 1429 | | case BO_Assign: |
| 1427 | case clang::BO_Assign: |
| 1430 | 1428 | return trans_create_assign(c, result_used, scope, stmt->getLHS(), stmt->getRHS()); |
| 1431 | | case BO_Comma: |
| 1429 | case clang::BO_Comma: |
| 1432 | 1430 | { |
| 1433 | 1431 | TransScopeBlock *scope_block = trans_scope_block_create(c, scope); |
| 1434 | 1432 | Buf *label_name = buf_create_from_str("x"); |
| ... | ... | @@ -1445,16 +1443,16 @@ static AstNode *trans_binary_operator(Context *c, ResultUsed result_used, TransS |
| 1445 | 1443 | scope_block->node->data.block.statements.append(trans_create_node_break(c, label_name, maybe_suppress_result(c, result_used, rhs))); |
| 1446 | 1444 | return scope_block->node; |
| 1447 | 1445 | } |
| 1448 | | case BO_MulAssign: |
| 1449 | | case BO_DivAssign: |
| 1450 | | case BO_RemAssign: |
| 1451 | | case BO_AddAssign: |
| 1452 | | case BO_SubAssign: |
| 1453 | | case BO_ShlAssign: |
| 1454 | | case BO_ShrAssign: |
| 1455 | | case BO_AndAssign: |
| 1456 | | case BO_XorAssign: |
| 1457 | | case BO_OrAssign: |
| 1446 | case clang::BO_MulAssign: |
| 1447 | case clang::BO_DivAssign: |
| 1448 | case clang::BO_RemAssign: |
| 1449 | case clang::BO_AddAssign: |
| 1450 | case clang::BO_SubAssign: |
| 1451 | case clang::BO_ShlAssign: |
| 1452 | case clang::BO_ShrAssign: |
| 1453 | case clang::BO_AndAssign: |
| 1454 | case clang::BO_XorAssign: |
| 1455 | case clang::BO_OrAssign: |
| 1458 | 1456 | zig_unreachable(); |
| 1459 | 1457 | } |
| 1460 | 1458 | |
| ... | ... | @@ -1462,9 +1460,9 @@ static AstNode *trans_binary_operator(Context *c, ResultUsed result_used, TransS |
| 1462 | 1460 | } |
| 1463 | 1461 | |
| 1464 | 1462 | static AstNode *trans_create_compound_assign_shift(Context *c, ResultUsed result_used, TransScope *scope, |
| 1465 | | const CompoundAssignOperator *stmt, BinOpType assign_op, BinOpType bin_op) |
| 1463 | const clang::CompoundAssignOperator *stmt, BinOpType assign_op, BinOpType bin_op) |
| 1466 | 1464 | { |
| 1467 | | const SourceLocation &rhs_location = stmt->getRHS()->getLocStart(); |
| 1465 | const clang::SourceLocation &rhs_location = stmt->getRHS()->getLocStart(); |
| 1468 | 1466 | AstNode *rhs_type = qual_type_to_log2_int_ref(c, stmt->getComputationLHSType(), rhs_location); |
| 1469 | 1467 | |
| 1470 | 1468 | bool use_intermediate_casts = stmt->getComputationLHSType().getTypePtr() != stmt->getComputationResultType().getTypePtr(); |
| ... | ... | @@ -1544,7 +1542,7 @@ static AstNode *trans_create_compound_assign_shift(Context *c, ResultUsed result |
| 1544 | 1542 | } |
| 1545 | 1543 | |
| 1546 | 1544 | static AstNode *trans_create_compound_assign(Context *c, ResultUsed result_used, TransScope *scope, |
| 1547 | | const CompoundAssignOperator *stmt, BinOpType assign_op, BinOpType bin_op) |
| 1545 | const clang::CompoundAssignOperator *stmt, BinOpType assign_op, BinOpType bin_op) |
| 1548 | 1546 | { |
| 1549 | 1547 | if (result_used == ResultUsedNo) { |
| 1550 | 1548 | // simple common case, where the C and Zig are identical: |
| ... | ... | @@ -1604,76 +1602,76 @@ static AstNode *trans_create_compound_assign(Context *c, ResultUsed result_used, |
| 1604 | 1602 | |
| 1605 | 1603 | |
| 1606 | 1604 | static AstNode *trans_compound_assign_operator(Context *c, ResultUsed result_used, TransScope *scope, |
| 1607 | | const CompoundAssignOperator *stmt) |
| 1605 | const clang::CompoundAssignOperator *stmt) |
| 1608 | 1606 | { |
| 1609 | 1607 | switch (stmt->getOpcode()) { |
| 1610 | | case BO_MulAssign: |
| 1608 | case clang::BO_MulAssign: |
| 1611 | 1609 | if (qual_type_has_wrapping_overflow(c, stmt->getType())) |
| 1612 | 1610 | return trans_create_compound_assign(c, result_used, scope, stmt, BinOpTypeAssignTimesWrap, BinOpTypeMultWrap); |
| 1613 | 1611 | else |
| 1614 | 1612 | return trans_create_compound_assign(c, result_used, scope, stmt, BinOpTypeAssignTimes, BinOpTypeMult); |
| 1615 | | case BO_DivAssign: |
| 1616 | | emit_warning(c, stmt->getLocStart(), "TODO handle more C compound assign operators: BO_DivAssign"); |
| 1613 | case clang::BO_DivAssign: |
| 1614 | emit_warning(c, stmt->getLocStart(), "TODO handle more C compound assign operators: clang::BO_DivAssign"); |
| 1617 | 1615 | return nullptr; |
| 1618 | | case BO_RemAssign: |
| 1619 | | emit_warning(c, stmt->getLocStart(), "TODO handle more C compound assign operators: BO_RemAssign"); |
| 1616 | case clang::BO_RemAssign: |
| 1617 | emit_warning(c, stmt->getLocStart(), "TODO handle more C compound assign operators: clang::BO_RemAssign"); |
| 1620 | 1618 | return nullptr; |
| 1621 | | case BO_Cmp: |
| 1622 | | emit_warning(c, stmt->getLocStart(), "TODO handle more C compound assign operators: BO_Cmp"); |
| 1619 | case clang::BO_Cmp: |
| 1620 | emit_warning(c, stmt->getLocStart(), "TODO handle more C compound assign operators: clang::BO_Cmp"); |
| 1623 | 1621 | return nullptr; |
| 1624 | | case BO_AddAssign: |
| 1622 | case clang::BO_AddAssign: |
| 1625 | 1623 | if (qual_type_has_wrapping_overflow(c, stmt->getType())) |
| 1626 | 1624 | return trans_create_compound_assign(c, result_used, scope, stmt, BinOpTypeAssignPlusWrap, BinOpTypeAddWrap); |
| 1627 | 1625 | else |
| 1628 | 1626 | return trans_create_compound_assign(c, result_used, scope, stmt, BinOpTypeAssignPlus, BinOpTypeAdd); |
| 1629 | | case BO_SubAssign: |
| 1627 | case clang::BO_SubAssign: |
| 1630 | 1628 | if (qual_type_has_wrapping_overflow(c, stmt->getType())) |
| 1631 | 1629 | return trans_create_compound_assign(c, result_used, scope, stmt, BinOpTypeAssignMinusWrap, BinOpTypeSubWrap); |
| 1632 | 1630 | else |
| 1633 | 1631 | return trans_create_compound_assign(c, result_used, scope, stmt, BinOpTypeAssignMinus, BinOpTypeSub); |
| 1634 | | case BO_ShlAssign: |
| 1632 | case clang::BO_ShlAssign: |
| 1635 | 1633 | return trans_create_compound_assign_shift(c, result_used, scope, stmt, BinOpTypeAssignBitShiftLeft, BinOpTypeBitShiftLeft); |
| 1636 | | case BO_ShrAssign: |
| 1634 | case clang::BO_ShrAssign: |
| 1637 | 1635 | return trans_create_compound_assign_shift(c, result_used, scope, stmt, BinOpTypeAssignBitShiftRight, BinOpTypeBitShiftRight); |
| 1638 | | case BO_AndAssign: |
| 1636 | case clang::BO_AndAssign: |
| 1639 | 1637 | return trans_create_compound_assign(c, result_used, scope, stmt, BinOpTypeAssignBitAnd, BinOpTypeBinAnd); |
| 1640 | | case BO_XorAssign: |
| 1638 | case clang::BO_XorAssign: |
| 1641 | 1639 | return trans_create_compound_assign(c, result_used, scope, stmt, BinOpTypeAssignBitXor, BinOpTypeBinXor); |
| 1642 | | case BO_OrAssign: |
| 1640 | case clang::BO_OrAssign: |
| 1643 | 1641 | return trans_create_compound_assign(c, result_used, scope, stmt, BinOpTypeAssignBitOr, BinOpTypeBinOr); |
| 1644 | | case BO_PtrMemD: |
| 1645 | | case BO_PtrMemI: |
| 1646 | | case BO_Assign: |
| 1647 | | case BO_Mul: |
| 1648 | | case BO_Div: |
| 1649 | | case BO_Rem: |
| 1650 | | case BO_Add: |
| 1651 | | case BO_Sub: |
| 1652 | | case BO_Shl: |
| 1653 | | case BO_Shr: |
| 1654 | | case BO_LT: |
| 1655 | | case BO_GT: |
| 1656 | | case BO_LE: |
| 1657 | | case BO_GE: |
| 1658 | | case BO_EQ: |
| 1659 | | case BO_NE: |
| 1660 | | case BO_And: |
| 1661 | | case BO_Xor: |
| 1662 | | case BO_Or: |
| 1663 | | case BO_LAnd: |
| 1664 | | case BO_LOr: |
| 1665 | | case BO_Comma: |
| 1642 | case clang::BO_PtrMemD: |
| 1643 | case clang::BO_PtrMemI: |
| 1644 | case clang::BO_Assign: |
| 1645 | case clang::BO_Mul: |
| 1646 | case clang::BO_Div: |
| 1647 | case clang::BO_Rem: |
| 1648 | case clang::BO_Add: |
| 1649 | case clang::BO_Sub: |
| 1650 | case clang::BO_Shl: |
| 1651 | case clang::BO_Shr: |
| 1652 | case clang::BO_LT: |
| 1653 | case clang::BO_GT: |
| 1654 | case clang::BO_LE: |
| 1655 | case clang::BO_GE: |
| 1656 | case clang::BO_EQ: |
| 1657 | case clang::BO_NE: |
| 1658 | case clang::BO_And: |
| 1659 | case clang::BO_Xor: |
| 1660 | case clang::BO_Or: |
| 1661 | case clang::BO_LAnd: |
| 1662 | case clang::BO_LOr: |
| 1663 | case clang::BO_Comma: |
| 1666 | 1664 | zig_unreachable(); |
| 1667 | 1665 | } |
| 1668 | 1666 | |
| 1669 | 1667 | zig_unreachable(); |
| 1670 | 1668 | } |
| 1671 | 1669 | |
| 1672 | | static AstNode *trans_implicit_cast_expr(Context *c, TransScope *scope, const ImplicitCastExpr *stmt) { |
| 1670 | static AstNode *trans_implicit_cast_expr(Context *c, TransScope *scope, const clang::ImplicitCastExpr *stmt) { |
| 1673 | 1671 | switch (stmt->getCastKind()) { |
| 1674 | | case CK_LValueToRValue: |
| 1672 | case clang::CK_LValueToRValue: |
| 1675 | 1673 | return trans_expr(c, ResultUsedYes, scope, stmt->getSubExpr(), TransRValue); |
| 1676 | | case CK_IntegralCast: |
| 1674 | case clang::CK_IntegralCast: |
| 1677 | 1675 | { |
| 1678 | 1676 | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, stmt->getSubExpr(), TransRValue); |
| 1679 | 1677 | if (target_node == nullptr) |
| ... | ... | @@ -1681,15 +1679,15 @@ static AstNode *trans_implicit_cast_expr(Context *c, TransScope *scope, const Im |
| 1681 | 1679 | return trans_c_cast(c, stmt->getExprLoc(), stmt->getType(), |
| 1682 | 1680 | stmt->getSubExpr()->getType(), target_node); |
| 1683 | 1681 | } |
| 1684 | | case CK_FunctionToPointerDecay: |
| 1685 | | case CK_ArrayToPointerDecay: |
| 1682 | case clang::CK_FunctionToPointerDecay: |
| 1683 | case clang::CK_ArrayToPointerDecay: |
| 1686 | 1684 | { |
| 1687 | 1685 | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, stmt->getSubExpr(), TransRValue); |
| 1688 | 1686 | if (target_node == nullptr) |
| 1689 | 1687 | return nullptr; |
| 1690 | 1688 | return target_node; |
| 1691 | 1689 | } |
| 1692 | | case CK_BitCast: |
| 1690 | case clang::CK_BitCast: |
| 1693 | 1691 | { |
| 1694 | 1692 | AstNode *target_node = trans_expr(c, ResultUsedYes, scope, stmt->getSubExpr(), TransRValue); |
| 1695 | 1693 | if (target_node == nullptr) |
| ... | ... | @@ -1706,170 +1704,170 @@ static AstNode *trans_implicit_cast_expr(Context *c, TransScope *scope, const Im |
| 1706 | 1704 | node->data.fn_call_expr.params.append(target_node); |
| 1707 | 1705 | return node; |
| 1708 | 1706 | } |
| 1709 | | case CK_NullToPointer: |
| 1707 | case clang::CK_NullToPointer: |
| 1710 | 1708 | return trans_create_node_unsigned(c, 0); |
| 1711 | | case CK_Dependent: |
| 1712 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_Dependent"); |
| 1709 | case clang::CK_Dependent: |
| 1710 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_Dependent"); |
| 1713 | 1711 | return nullptr; |
| 1714 | | case CK_LValueBitCast: |
| 1715 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_LValueBitCast"); |
| 1712 | case clang::CK_LValueBitCast: |
| 1713 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_LValueBitCast"); |
| 1716 | 1714 | return nullptr; |
| 1717 | | case CK_NoOp: |
| 1718 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_NoOp"); |
| 1715 | case clang::CK_NoOp: |
| 1716 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_NoOp"); |
| 1719 | 1717 | return nullptr; |
| 1720 | | case CK_BaseToDerived: |
| 1721 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_BaseToDerived"); |
| 1718 | case clang::CK_BaseToDerived: |
| 1719 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_BaseToDerived"); |
| 1722 | 1720 | return nullptr; |
| 1723 | | case CK_DerivedToBase: |
| 1724 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_DerivedToBase"); |
| 1721 | case clang::CK_DerivedToBase: |
| 1722 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_DerivedToBase"); |
| 1725 | 1723 | return nullptr; |
| 1726 | | case CK_UncheckedDerivedToBase: |
| 1727 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_UncheckedDerivedToBase"); |
| 1724 | case clang::CK_UncheckedDerivedToBase: |
| 1725 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_UncheckedDerivedToBase"); |
| 1728 | 1726 | return nullptr; |
| 1729 | | case CK_Dynamic: |
| 1730 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_Dynamic"); |
| 1727 | case clang::CK_Dynamic: |
| 1728 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_Dynamic"); |
| 1731 | 1729 | return nullptr; |
| 1732 | | case CK_ToUnion: |
| 1733 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_ToUnion"); |
| 1730 | case clang::CK_ToUnion: |
| 1731 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_ToUnion"); |
| 1734 | 1732 | return nullptr; |
| 1735 | | case CK_NullToMemberPointer: |
| 1736 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_NullToMemberPointer"); |
| 1733 | case clang::CK_NullToMemberPointer: |
| 1734 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_NullToMemberPointer"); |
| 1737 | 1735 | return nullptr; |
| 1738 | | case CK_BaseToDerivedMemberPointer: |
| 1739 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_BaseToDerivedMemberPointer"); |
| 1736 | case clang::CK_BaseToDerivedMemberPointer: |
| 1737 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_BaseToDerivedMemberPointer"); |
| 1740 | 1738 | return nullptr; |
| 1741 | | case CK_DerivedToBaseMemberPointer: |
| 1742 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_DerivedToBaseMemberPointer"); |
| 1739 | case clang::CK_DerivedToBaseMemberPointer: |
| 1740 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_DerivedToBaseMemberPointer"); |
| 1743 | 1741 | return nullptr; |
| 1744 | | case CK_MemberPointerToBoolean: |
| 1745 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_MemberPointerToBoolean"); |
| 1742 | case clang::CK_MemberPointerToBoolean: |
| 1743 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_MemberPointerToBoolean"); |
| 1746 | 1744 | return nullptr; |
| 1747 | | case CK_ReinterpretMemberPointer: |
| 1748 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_ReinterpretMemberPointer"); |
| 1745 | case clang::CK_ReinterpretMemberPointer: |
| 1746 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_ReinterpretMemberPointer"); |
| 1749 | 1747 | return nullptr; |
| 1750 | | case CK_UserDefinedConversion: |
| 1751 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_UserDefinedConversion"); |
| 1748 | case clang::CK_UserDefinedConversion: |
| 1749 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_UserDefinedConversion"); |
| 1752 | 1750 | return nullptr; |
| 1753 | | case CK_ConstructorConversion: |
| 1754 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_ConstructorConversion"); |
| 1751 | case clang::CK_ConstructorConversion: |
| 1752 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_ConstructorConversion"); |
| 1755 | 1753 | return nullptr; |
| 1756 | | case CK_IntegralToPointer: |
| 1757 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_IntegralToPointer"); |
| 1754 | case clang::CK_IntegralToPointer: |
| 1755 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_IntegralToPointer"); |
| 1758 | 1756 | return nullptr; |
| 1759 | | case CK_PointerToIntegral: |
| 1760 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_PointerToIntegral"); |
| 1757 | case clang::CK_PointerToIntegral: |
| 1758 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_PointerToIntegral"); |
| 1761 | 1759 | return nullptr; |
| 1762 | | case CK_PointerToBoolean: |
| 1763 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_PointerToBoolean"); |
| 1760 | case clang::CK_PointerToBoolean: |
| 1761 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_PointerToBoolean"); |
| 1764 | 1762 | return nullptr; |
| 1765 | | case CK_ToVoid: |
| 1766 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_ToVoid"); |
| 1763 | case clang::CK_ToVoid: |
| 1764 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_ToVoid"); |
| 1767 | 1765 | return nullptr; |
| 1768 | | case CK_VectorSplat: |
| 1769 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_VectorSplat"); |
| 1766 | case clang::CK_VectorSplat: |
| 1767 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_VectorSplat"); |
| 1770 | 1768 | return nullptr; |
| 1771 | | case CK_IntegralToBoolean: |
| 1772 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_IntegralToBoolean"); |
| 1769 | case clang::CK_IntegralToBoolean: |
| 1770 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_IntegralToBoolean"); |
| 1773 | 1771 | return nullptr; |
| 1774 | | case CK_IntegralToFloating: |
| 1775 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_IntegralToFloating"); |
| 1772 | case clang::CK_IntegralToFloating: |
| 1773 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_IntegralToFloating"); |
| 1776 | 1774 | return nullptr; |
| 1777 | | case CK_FloatingToIntegral: |
| 1778 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_FloatingToIntegral"); |
| 1775 | case clang::CK_FloatingToIntegral: |
| 1776 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_FloatingToIntegral"); |
| 1779 | 1777 | return nullptr; |
| 1780 | | case CK_FloatingToBoolean: |
| 1781 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_FloatingToBoolean"); |
| 1778 | case clang::CK_FloatingToBoolean: |
| 1779 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_FloatingToBoolean"); |
| 1782 | 1780 | return nullptr; |
| 1783 | | case CK_BooleanToSignedIntegral: |
| 1784 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_BooleanToSignedIntegral"); |
| 1781 | case clang::CK_BooleanToSignedIntegral: |
| 1782 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_BooleanToSignedIntegral"); |
| 1785 | 1783 | return nullptr; |
| 1786 | | case CK_FloatingCast: |
| 1787 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_FloatingCast"); |
| 1784 | case clang::CK_FloatingCast: |
| 1785 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_FloatingCast"); |
| 1788 | 1786 | return nullptr; |
| 1789 | | case CK_CPointerToObjCPointerCast: |
| 1790 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_CPointerToObjCPointerCast"); |
| 1787 | case clang::CK_CPointerToObjCPointerCast: |
| 1788 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_CPointerToObjCPointerCast"); |
| 1791 | 1789 | return nullptr; |
| 1792 | | case CK_BlockPointerToObjCPointerCast: |
| 1793 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_BlockPointerToObjCPointerCast"); |
| 1790 | case clang::CK_BlockPointerToObjCPointerCast: |
| 1791 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_BlockPointerToObjCPointerCast"); |
| 1794 | 1792 | return nullptr; |
| 1795 | | case CK_AnyPointerToBlockPointerCast: |
| 1796 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_AnyPointerToBlockPointerCast"); |
| 1793 | case clang::CK_AnyPointerToBlockPointerCast: |
| 1794 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_AnyPointerToBlockPointerCast"); |
| 1797 | 1795 | return nullptr; |
| 1798 | | case CK_ObjCObjectLValueCast: |
| 1799 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_ObjCObjectLValueCast"); |
| 1796 | case clang::CK_ObjCObjectLValueCast: |
| 1797 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_ObjCObjectLValueCast"); |
| 1800 | 1798 | return nullptr; |
| 1801 | | case CK_FloatingRealToComplex: |
| 1802 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_FloatingRealToComplex"); |
| 1799 | case clang::CK_FloatingRealToComplex: |
| 1800 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_FloatingRealToComplex"); |
| 1803 | 1801 | return nullptr; |
| 1804 | | case CK_FloatingComplexToReal: |
| 1805 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_FloatingComplexToReal"); |
| 1802 | case clang::CK_FloatingComplexToReal: |
| 1803 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_FloatingComplexToReal"); |
| 1806 | 1804 | return nullptr; |
| 1807 | | case CK_FloatingComplexToBoolean: |
| 1808 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_FloatingComplexToBoolean"); |
| 1805 | case clang::CK_FloatingComplexToBoolean: |
| 1806 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_FloatingComplexToBoolean"); |
| 1809 | 1807 | return nullptr; |
| 1810 | | case CK_FloatingComplexCast: |
| 1811 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_FloatingComplexCast"); |
| 1808 | case clang::CK_FloatingComplexCast: |
| 1809 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_FloatingComplexCast"); |
| 1812 | 1810 | return nullptr; |
| 1813 | | case CK_FloatingComplexToIntegralComplex: |
| 1814 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_FloatingComplexToIntegralComplex"); |
| 1811 | case clang::CK_FloatingComplexToIntegralComplex: |
| 1812 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_FloatingComplexToIntegralComplex"); |
| 1815 | 1813 | return nullptr; |
| 1816 | | case CK_IntegralRealToComplex: |
| 1817 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_IntegralRealToComplex"); |
| 1814 | case clang::CK_IntegralRealToComplex: |
| 1815 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_IntegralRealToComplex"); |
| 1818 | 1816 | return nullptr; |
| 1819 | | case CK_IntegralComplexToReal: |
| 1820 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_IntegralComplexToReal"); |
| 1817 | case clang::CK_IntegralComplexToReal: |
| 1818 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_IntegralComplexToReal"); |
| 1821 | 1819 | return nullptr; |
| 1822 | | case CK_IntegralComplexToBoolean: |
| 1823 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_IntegralComplexToBoolean"); |
| 1820 | case clang::CK_IntegralComplexToBoolean: |
| 1821 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_IntegralComplexToBoolean"); |
| 1824 | 1822 | return nullptr; |
| 1825 | | case CK_IntegralComplexCast: |
| 1826 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_IntegralComplexCast"); |
| 1823 | case clang::CK_IntegralComplexCast: |
| 1824 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_IntegralComplexCast"); |
| 1827 | 1825 | return nullptr; |
| 1828 | | case CK_IntegralComplexToFloatingComplex: |
| 1829 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_IntegralComplexToFloatingComplex"); |
| 1826 | case clang::CK_IntegralComplexToFloatingComplex: |
| 1827 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_IntegralComplexToFloatingComplex"); |
| 1830 | 1828 | return nullptr; |
| 1831 | | case CK_ARCProduceObject: |
| 1832 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_ARCProduceObject"); |
| 1829 | case clang::CK_ARCProduceObject: |
| 1830 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_ARCProduceObject"); |
| 1833 | 1831 | return nullptr; |
| 1834 | | case CK_ARCConsumeObject: |
| 1835 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_ARCConsumeObject"); |
| 1832 | case clang::CK_ARCConsumeObject: |
| 1833 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_ARCConsumeObject"); |
| 1836 | 1834 | return nullptr; |
| 1837 | | case CK_ARCReclaimReturnedObject: |
| 1838 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_ARCReclaimReturnedObject"); |
| 1835 | case clang::CK_ARCReclaimReturnedObject: |
| 1836 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_ARCReclaimReturnedObject"); |
| 1839 | 1837 | return nullptr; |
| 1840 | | case CK_ARCExtendBlockObject: |
| 1841 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_ARCExtendBlockObject"); |
| 1838 | case clang::CK_ARCExtendBlockObject: |
| 1839 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_ARCExtendBlockObject"); |
| 1842 | 1840 | return nullptr; |
| 1843 | | case CK_AtomicToNonAtomic: |
| 1844 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_AtomicToNonAtomic"); |
| 1841 | case clang::CK_AtomicToNonAtomic: |
| 1842 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_AtomicToNonAtomic"); |
| 1845 | 1843 | return nullptr; |
| 1846 | | case CK_NonAtomicToAtomic: |
| 1847 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_NonAtomicToAtomic"); |
| 1844 | case clang::CK_NonAtomicToAtomic: |
| 1845 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_NonAtomicToAtomic"); |
| 1848 | 1846 | return nullptr; |
| 1849 | | case CK_CopyAndAutoreleaseBlockObject: |
| 1850 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_CopyAndAutoreleaseBlockObject"); |
| 1847 | case clang::CK_CopyAndAutoreleaseBlockObject: |
| 1848 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_CopyAndAutoreleaseBlockObject"); |
| 1851 | 1849 | return nullptr; |
| 1852 | | case CK_BuiltinFnToFnPtr: |
| 1853 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_BuiltinFnToFnPtr"); |
| 1850 | case clang::CK_BuiltinFnToFnPtr: |
| 1851 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_BuiltinFnToFnPtr"); |
| 1854 | 1852 | return nullptr; |
| 1855 | | case CK_ZeroToOCLEvent: |
| 1856 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_ZeroToOCLEvent"); |
| 1853 | case clang::CK_ZeroToOCLEvent: |
| 1854 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_ZeroToOCLEvent"); |
| 1857 | 1855 | return nullptr; |
| 1858 | | case CK_ZeroToOCLQueue: |
| 1859 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_ZeroToOCLQueue"); |
| 1856 | case clang::CK_ZeroToOCLQueue: |
| 1857 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_ZeroToOCLQueue"); |
| 1860 | 1858 | return nullptr; |
| 1861 | | case CK_AddressSpaceConversion: |
| 1862 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_AddressSpaceConversion"); |
| 1859 | case clang::CK_AddressSpaceConversion: |
| 1860 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_AddressSpaceConversion"); |
| 1863 | 1861 | return nullptr; |
| 1864 | | case CK_IntToOCLSampler: |
| 1865 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast CK_IntToOCLSampler"); |
| 1862 | case clang::CK_IntToOCLSampler: |
| 1863 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation cast clang::CK_IntToOCLSampler"); |
| 1866 | 1864 | return nullptr; |
| 1867 | 1865 | } |
| 1868 | 1866 | zig_unreachable(); |
| 1869 | 1867 | } |
| 1870 | 1868 | |
| 1871 | | static AstNode *trans_decl_ref_expr(Context *c, TransScope *scope, const DeclRefExpr *stmt, TransLRValue lrval) { |
| 1872 | | const ValueDecl *value_decl = stmt->getDecl(); |
| 1869 | static AstNode *trans_decl_ref_expr(Context *c, TransScope *scope, const clang::DeclRefExpr *stmt, TransLRValue lrval) { |
| 1870 | const clang::ValueDecl *value_decl = stmt->getDecl(); |
| 1873 | 1871 | Buf *c_symbol_name = buf_create_from_str(decl_name(value_decl)); |
| 1874 | 1872 | Buf *zig_symbol_name = trans_lookup_zig_symbol(c, scope, c_symbol_name); |
| 1875 | 1873 | if (lrval == TransLValue) { |
| ... | ... | @@ -1879,9 +1877,9 @@ static AstNode *trans_decl_ref_expr(Context *c, TransScope *scope, const DeclRef |
| 1879 | 1877 | } |
| 1880 | 1878 | |
| 1881 | 1879 | static AstNode *trans_create_post_crement(Context *c, ResultUsed result_used, TransScope *scope, |
| 1882 | | const UnaryOperator *stmt, BinOpType assign_op) |
| 1880 | const clang::UnaryOperator *stmt, BinOpType assign_op) |
| 1883 | 1881 | { |
| 1884 | | Expr *op_expr = stmt->getSubExpr(); |
| 1882 | clang::Expr *op_expr = stmt->getSubExpr(); |
| 1885 | 1883 | |
| 1886 | 1884 | if (result_used == ResultUsedNo) { |
| 1887 | 1885 | // common case |
| ... | ... | @@ -1935,9 +1933,9 @@ static AstNode *trans_create_post_crement(Context *c, ResultUsed result_used, Tr |
| 1935 | 1933 | } |
| 1936 | 1934 | |
| 1937 | 1935 | static AstNode *trans_create_pre_crement(Context *c, ResultUsed result_used, TransScope *scope, |
| 1938 | | const UnaryOperator *stmt, BinOpType assign_op) |
| 1936 | const clang::UnaryOperator *stmt, BinOpType assign_op) |
| 1939 | 1937 | { |
| 1940 | | Expr *op_expr = stmt->getSubExpr(); |
| 1938 | clang::Expr *op_expr = stmt->getSubExpr(); |
| 1941 | 1939 | |
| 1942 | 1940 | if (result_used == ResultUsedNo) { |
| 1943 | 1941 | // common case |
| ... | ... | @@ -1984,36 +1982,36 @@ static AstNode *trans_create_pre_crement(Context *c, ResultUsed result_used, Tra |
| 1984 | 1982 | return child_scope->node; |
| 1985 | 1983 | } |
| 1986 | 1984 | |
| 1987 | | static AstNode *trans_unary_operator(Context *c, ResultUsed result_used, TransScope *scope, const UnaryOperator *stmt) { |
| 1985 | static AstNode *trans_unary_operator(Context *c, ResultUsed result_used, TransScope *scope, const clang::UnaryOperator *stmt) { |
| 1988 | 1986 | switch (stmt->getOpcode()) { |
| 1989 | | case UO_PostInc: |
| 1987 | case clang::UO_PostInc: |
| 1990 | 1988 | if (qual_type_has_wrapping_overflow(c, stmt->getType())) |
| 1991 | 1989 | return trans_create_post_crement(c, result_used, scope, stmt, BinOpTypeAssignPlusWrap); |
| 1992 | 1990 | else |
| 1993 | 1991 | return trans_create_post_crement(c, result_used, scope, stmt, BinOpTypeAssignPlus); |
| 1994 | | case UO_PostDec: |
| 1992 | case clang::UO_PostDec: |
| 1995 | 1993 | if (qual_type_has_wrapping_overflow(c, stmt->getType())) |
| 1996 | 1994 | return trans_create_post_crement(c, result_used, scope, stmt, BinOpTypeAssignMinusWrap); |
| 1997 | 1995 | else |
| 1998 | 1996 | return trans_create_post_crement(c, result_used, scope, stmt, BinOpTypeAssignMinus); |
| 1999 | | case UO_PreInc: |
| 1997 | case clang::UO_PreInc: |
| 2000 | 1998 | if (qual_type_has_wrapping_overflow(c, stmt->getType())) |
| 2001 | 1999 | return trans_create_pre_crement(c, result_used, scope, stmt, BinOpTypeAssignPlusWrap); |
| 2002 | 2000 | else |
| 2003 | 2001 | return trans_create_pre_crement(c, result_used, scope, stmt, BinOpTypeAssignPlus); |
| 2004 | | case UO_PreDec: |
| 2002 | case clang::UO_PreDec: |
| 2005 | 2003 | if (qual_type_has_wrapping_overflow(c, stmt->getType())) |
| 2006 | 2004 | return trans_create_pre_crement(c, result_used, scope, stmt, BinOpTypeAssignMinusWrap); |
| 2007 | 2005 | else |
| 2008 | 2006 | return trans_create_pre_crement(c, result_used, scope, stmt, BinOpTypeAssignMinus); |
| 2009 | | case UO_AddrOf: |
| 2007 | case clang::UO_AddrOf: |
| 2010 | 2008 | { |
| 2011 | 2009 | AstNode *value_node = trans_expr(c, result_used, scope, stmt->getSubExpr(), TransLValue); |
| 2012 | 2010 | if (value_node == nullptr) |
| 2013 | 2011 | return value_node; |
| 2014 | 2012 | return trans_create_node_addr_of(c, value_node); |
| 2015 | 2013 | } |
| 2016 | | case UO_Deref: |
| 2014 | case clang::UO_Deref: |
| 2017 | 2015 | { |
| 2018 | 2016 | AstNode *value_node = trans_expr(c, result_used, scope, stmt->getSubExpr(), TransRValue); |
| 2019 | 2017 | if (value_node == nullptr) |
| ... | ... | @@ -2024,12 +2022,12 @@ static AstNode *trans_unary_operator(Context *c, ResultUsed result_used, TransSc |
| 2024 | 2022 | AstNode *unwrapped = trans_create_node_unwrap_null(c, value_node); |
| 2025 | 2023 | return trans_create_node_ptr_deref(c, unwrapped); |
| 2026 | 2024 | } |
| 2027 | | case UO_Plus: |
| 2028 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation UO_Plus"); |
| 2025 | case clang::UO_Plus: |
| 2026 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation clang::UO_Plus"); |
| 2029 | 2027 | return nullptr; |
| 2030 | | case UO_Minus: |
| 2028 | case clang::UO_Minus: |
| 2031 | 2029 | { |
| 2032 | | Expr *op_expr = stmt->getSubExpr(); |
| 2030 | clang::Expr *op_expr = stmt->getSubExpr(); |
| 2033 | 2031 | if (!qual_type_has_wrapping_overflow(c, op_expr->getType())) { |
| 2034 | 2032 | AstNode *node = trans_create_node(c, NodeTypePrefixOpExpr); |
| 2035 | 2033 | node->data.prefix_op_expr.prefix_op = PrefixOpNegation; |
| ... | ... | @@ -2055,41 +2053,41 @@ static AstNode *trans_unary_operator(Context *c, ResultUsed result_used, TransSc |
| 2055 | 2053 | return nullptr; |
| 2056 | 2054 | } |
| 2057 | 2055 | } |
| 2058 | | case UO_Not: |
| 2056 | case clang::UO_Not: |
| 2059 | 2057 | { |
| 2060 | | Expr *op_expr = stmt->getSubExpr(); |
| 2058 | clang::Expr *op_expr = stmt->getSubExpr(); |
| 2061 | 2059 | AstNode *sub_node = trans_expr(c, ResultUsedYes, scope, op_expr, TransRValue); |
| 2062 | 2060 | if (sub_node == nullptr) |
| 2063 | 2061 | return nullptr; |
| 2064 | 2062 | |
| 2065 | 2063 | return trans_create_node_prefix_op(c, PrefixOpBinNot, sub_node); |
| 2066 | 2064 | } |
| 2067 | | case UO_LNot: |
| 2065 | case clang::UO_LNot: |
| 2068 | 2066 | { |
| 2069 | | Expr *op_expr = stmt->getSubExpr(); |
| 2067 | clang::Expr *op_expr = stmt->getSubExpr(); |
| 2070 | 2068 | AstNode *sub_node = trans_bool_expr(c, ResultUsedYes, scope, op_expr, TransRValue); |
| 2071 | 2069 | if (sub_node == nullptr) |
| 2072 | 2070 | return nullptr; |
| 2073 | 2071 | |
| 2074 | 2072 | return trans_create_node_prefix_op(c, PrefixOpBoolNot, sub_node); |
| 2075 | 2073 | } |
| 2076 | | case UO_Real: |
| 2077 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation UO_Real"); |
| 2074 | case clang::UO_Real: |
| 2075 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation clang::UO_Real"); |
| 2078 | 2076 | return nullptr; |
| 2079 | | case UO_Imag: |
| 2080 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation UO_Imag"); |
| 2077 | case clang::UO_Imag: |
| 2078 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation clang::UO_Imag"); |
| 2081 | 2079 | return nullptr; |
| 2082 | | case UO_Extension: |
| 2083 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation UO_Extension"); |
| 2080 | case clang::UO_Extension: |
| 2081 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation clang::UO_Extension"); |
| 2084 | 2082 | return nullptr; |
| 2085 | | case UO_Coawait: |
| 2086 | | emit_warning(c, stmt->getLocStart(), "TODO handle C translation UO_Coawait"); |
| 2083 | case clang::UO_Coawait: |
| 2084 | emit_warning(c, stmt->getLocStart(), "TODO handle C translation clang::UO_Coawait"); |
| 2087 | 2085 | return nullptr; |
| 2088 | 2086 | } |
| 2089 | 2087 | zig_unreachable(); |
| 2090 | 2088 | } |
| 2091 | 2089 | |
| 2092 | | static int trans_local_declaration(Context *c, TransScope *scope, const DeclStmt *stmt, |
| 2090 | static int trans_local_declaration(Context *c, TransScope *scope, const clang::DeclStmt *stmt, |
| 2093 | 2091 | AstNode **out_node, TransScope **out_scope) |
| 2094 | 2092 | { |
| 2095 | 2093 | // declarations are added via the scope |
| ... | ... | @@ -2099,11 +2097,11 @@ static int trans_local_declaration(Context *c, TransScope *scope, const DeclStmt |
| 2099 | 2097 | assert(scope_block != nullptr); |
| 2100 | 2098 | |
| 2101 | 2099 | for (auto iter = stmt->decl_begin(); iter != stmt->decl_end(); iter++) { |
| 2102 | | Decl *decl = *iter; |
| 2100 | clang::Decl *decl = *iter; |
| 2103 | 2101 | switch (decl->getKind()) { |
| 2104 | | case Decl::Var: { |
| 2105 | | VarDecl *var_decl = (VarDecl *)decl; |
| 2106 | | QualType qual_type = var_decl->getTypeSourceInfo()->getType(); |
| 2102 | case clang::Decl::Var: { |
| 2103 | clang::VarDecl *var_decl = (clang::VarDecl *)decl; |
| 2104 | clang::QualType qual_type = var_decl->getTypeSourceInfo()->getType(); |
| 2107 | 2105 | AstNode *init_node = nullptr; |
| 2108 | 2106 | if (var_decl->hasInit()) { |
| 2109 | 2107 | init_node = trans_expr(c, ResultUsedYes, scope, var_decl->getInit(), TransRValue); |
| ... | ... | @@ -2128,220 +2126,220 @@ static int trans_local_declaration(Context *c, TransScope *scope, const DeclStmt |
| 2128 | 2126 | scope_block->node->data.block.statements.append(node); |
| 2129 | 2127 | continue; |
| 2130 | 2128 | } |
| 2131 | | case Decl::AccessSpec: |
| 2129 | case clang::Decl::AccessSpec: |
| 2132 | 2130 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind AccessSpec"); |
| 2133 | 2131 | return ErrorUnexpected; |
| 2134 | | case Decl::Block: |
| 2132 | case clang::Decl::Block: |
| 2135 | 2133 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Block"); |
| 2136 | 2134 | return ErrorUnexpected; |
| 2137 | | case Decl::Captured: |
| 2135 | case clang::Decl::Captured: |
| 2138 | 2136 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Captured"); |
| 2139 | 2137 | return ErrorUnexpected; |
| 2140 | | case Decl::ClassScopeFunctionSpecialization: |
| 2138 | case clang::Decl::ClassScopeFunctionSpecialization: |
| 2141 | 2139 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ClassScopeFunctionSpecialization"); |
| 2142 | 2140 | return ErrorUnexpected; |
| 2143 | | case Decl::Empty: |
| 2141 | case clang::Decl::Empty: |
| 2144 | 2142 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Empty"); |
| 2145 | 2143 | return ErrorUnexpected; |
| 2146 | | case Decl::Export: |
| 2144 | case clang::Decl::Export: |
| 2147 | 2145 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Export"); |
| 2148 | 2146 | return ErrorUnexpected; |
| 2149 | | case Decl::ExternCContext: |
| 2147 | case clang::Decl::ExternCContext: |
| 2150 | 2148 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ExternCContext"); |
| 2151 | 2149 | return ErrorUnexpected; |
| 2152 | | case Decl::FileScopeAsm: |
| 2150 | case clang::Decl::FileScopeAsm: |
| 2153 | 2151 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind FileScopeAsm"); |
| 2154 | 2152 | return ErrorUnexpected; |
| 2155 | | case Decl::Friend: |
| 2153 | case clang::Decl::Friend: |
| 2156 | 2154 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Friend"); |
| 2157 | 2155 | return ErrorUnexpected; |
| 2158 | | case Decl::FriendTemplate: |
| 2156 | case clang::Decl::FriendTemplate: |
| 2159 | 2157 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind FriendTemplate"); |
| 2160 | 2158 | return ErrorUnexpected; |
| 2161 | | case Decl::Import: |
| 2159 | case clang::Decl::Import: |
| 2162 | 2160 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Import"); |
| 2163 | 2161 | return ErrorUnexpected; |
| 2164 | | case Decl::LinkageSpec: |
| 2162 | case clang::Decl::LinkageSpec: |
| 2165 | 2163 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind LinkageSpec"); |
| 2166 | 2164 | return ErrorUnexpected; |
| 2167 | | case Decl::Label: |
| 2165 | case clang::Decl::Label: |
| 2168 | 2166 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Label"); |
| 2169 | 2167 | return ErrorUnexpected; |
| 2170 | | case Decl::Namespace: |
| 2168 | case clang::Decl::Namespace: |
| 2171 | 2169 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Namespace"); |
| 2172 | 2170 | return ErrorUnexpected; |
| 2173 | | case Decl::NamespaceAlias: |
| 2171 | case clang::Decl::NamespaceAlias: |
| 2174 | 2172 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind NamespaceAlias"); |
| 2175 | 2173 | return ErrorUnexpected; |
| 2176 | | case Decl::ObjCCompatibleAlias: |
| 2174 | case clang::Decl::ObjCCompatibleAlias: |
| 2177 | 2175 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCCompatibleAlias"); |
| 2178 | 2176 | return ErrorUnexpected; |
| 2179 | | case Decl::ObjCCategory: |
| 2177 | case clang::Decl::ObjCCategory: |
| 2180 | 2178 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCCategory"); |
| 2181 | 2179 | return ErrorUnexpected; |
| 2182 | | case Decl::ObjCCategoryImpl: |
| 2180 | case clang::Decl::ObjCCategoryImpl: |
| 2183 | 2181 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCCategoryImpl"); |
| 2184 | 2182 | return ErrorUnexpected; |
| 2185 | | case Decl::ObjCImplementation: |
| 2183 | case clang::Decl::ObjCImplementation: |
| 2186 | 2184 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCImplementation"); |
| 2187 | 2185 | return ErrorUnexpected; |
| 2188 | | case Decl::ObjCInterface: |
| 2186 | case clang::Decl::ObjCInterface: |
| 2189 | 2187 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCInterface"); |
| 2190 | 2188 | return ErrorUnexpected; |
| 2191 | | case Decl::ObjCProtocol: |
| 2189 | case clang::Decl::ObjCProtocol: |
| 2192 | 2190 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCProtocol"); |
| 2193 | 2191 | return ErrorUnexpected; |
| 2194 | | case Decl::ObjCMethod: |
| 2192 | case clang::Decl::ObjCMethod: |
| 2195 | 2193 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCMethod"); |
| 2196 | 2194 | return ErrorUnexpected; |
| 2197 | | case Decl::ObjCProperty: |
| 2195 | case clang::Decl::ObjCProperty: |
| 2198 | 2196 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCProperty"); |
| 2199 | 2197 | return ErrorUnexpected; |
| 2200 | | case Decl::BuiltinTemplate: |
| 2198 | case clang::Decl::BuiltinTemplate: |
| 2201 | 2199 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind BuiltinTemplate"); |
| 2202 | 2200 | return ErrorUnexpected; |
| 2203 | | case Decl::ClassTemplate: |
| 2201 | case clang::Decl::ClassTemplate: |
| 2204 | 2202 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ClassTemplate"); |
| 2205 | 2203 | return ErrorUnexpected; |
| 2206 | | case Decl::FunctionTemplate: |
| 2204 | case clang::Decl::FunctionTemplate: |
| 2207 | 2205 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind FunctionTemplate"); |
| 2208 | 2206 | return ErrorUnexpected; |
| 2209 | | case Decl::TypeAliasTemplate: |
| 2207 | case clang::Decl::TypeAliasTemplate: |
| 2210 | 2208 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind TypeAliasTemplate"); |
| 2211 | 2209 | return ErrorUnexpected; |
| 2212 | | case Decl::VarTemplate: |
| 2210 | case clang::Decl::VarTemplate: |
| 2213 | 2211 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind VarTemplate"); |
| 2214 | 2212 | return ErrorUnexpected; |
| 2215 | | case Decl::TemplateTemplateParm: |
| 2213 | case clang::Decl::TemplateTemplateParm: |
| 2216 | 2214 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind TemplateTemplateParm"); |
| 2217 | 2215 | return ErrorUnexpected; |
| 2218 | | case Decl::Enum: |
| 2216 | case clang::Decl::Enum: |
| 2219 | 2217 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Enum"); |
| 2220 | 2218 | return ErrorUnexpected; |
| 2221 | | case Decl::Record: |
| 2219 | case clang::Decl::Record: |
| 2222 | 2220 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Record"); |
| 2223 | 2221 | return ErrorUnexpected; |
| 2224 | | case Decl::CXXRecord: |
| 2222 | case clang::Decl::CXXRecord: |
| 2225 | 2223 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind CXXRecord"); |
| 2226 | 2224 | return ErrorUnexpected; |
| 2227 | | case Decl::ClassTemplateSpecialization: |
| 2225 | case clang::Decl::ClassTemplateSpecialization: |
| 2228 | 2226 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ClassTemplateSpecialization"); |
| 2229 | 2227 | return ErrorUnexpected; |
| 2230 | | case Decl::ClassTemplatePartialSpecialization: |
| 2228 | case clang::Decl::ClassTemplatePartialSpecialization: |
| 2231 | 2229 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ClassTemplatePartialSpecialization"); |
| 2232 | 2230 | return ErrorUnexpected; |
| 2233 | | case Decl::TemplateTypeParm: |
| 2231 | case clang::Decl::TemplateTypeParm: |
| 2234 | 2232 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind TemplateTypeParm"); |
| 2235 | 2233 | return ErrorUnexpected; |
| 2236 | | case Decl::ObjCTypeParam: |
| 2234 | case clang::Decl::ObjCTypeParam: |
| 2237 | 2235 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCTypeParam"); |
| 2238 | 2236 | return ErrorUnexpected; |
| 2239 | | case Decl::TypeAlias: |
| 2237 | case clang::Decl::TypeAlias: |
| 2240 | 2238 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind TypeAlias"); |
| 2241 | 2239 | return ErrorUnexpected; |
| 2242 | | case Decl::Typedef: |
| 2240 | case clang::Decl::Typedef: |
| 2243 | 2241 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Typedef"); |
| 2244 | 2242 | return ErrorUnexpected; |
| 2245 | | case Decl::UnresolvedUsingTypename: |
| 2243 | case clang::Decl::UnresolvedUsingTypename: |
| 2246 | 2244 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind UnresolvedUsingTypename"); |
| 2247 | 2245 | return ErrorUnexpected; |
| 2248 | | case Decl::Using: |
| 2246 | case clang::Decl::Using: |
| 2249 | 2247 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Using"); |
| 2250 | 2248 | return ErrorUnexpected; |
| 2251 | | case Decl::UsingDirective: |
| 2249 | case clang::Decl::UsingDirective: |
| 2252 | 2250 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind UsingDirective"); |
| 2253 | 2251 | return ErrorUnexpected; |
| 2254 | | case Decl::UsingPack: |
| 2252 | case clang::Decl::UsingPack: |
| 2255 | 2253 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind UsingPack"); |
| 2256 | 2254 | return ErrorUnexpected; |
| 2257 | | case Decl::UsingShadow: |
| 2255 | case clang::Decl::UsingShadow: |
| 2258 | 2256 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind UsingShadow"); |
| 2259 | 2257 | return ErrorUnexpected; |
| 2260 | | case Decl::ConstructorUsingShadow: |
| 2258 | case clang::Decl::ConstructorUsingShadow: |
| 2261 | 2259 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ConstructorUsingShadow"); |
| 2262 | 2260 | return ErrorUnexpected; |
| 2263 | | case Decl::Binding: |
| 2261 | case clang::Decl::Binding: |
| 2264 | 2262 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Binding"); |
| 2265 | 2263 | return ErrorUnexpected; |
| 2266 | | case Decl::Field: |
| 2264 | case clang::Decl::Field: |
| 2267 | 2265 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Field"); |
| 2268 | 2266 | return ErrorUnexpected; |
| 2269 | | case Decl::ObjCAtDefsField: |
| 2267 | case clang::Decl::ObjCAtDefsField: |
| 2270 | 2268 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCAtDefsField"); |
| 2271 | 2269 | return ErrorUnexpected; |
| 2272 | | case Decl::ObjCIvar: |
| 2270 | case clang::Decl::ObjCIvar: |
| 2273 | 2271 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCIvar"); |
| 2274 | 2272 | return ErrorUnexpected; |
| 2275 | | case Decl::Function: |
| 2273 | case clang::Decl::Function: |
| 2276 | 2274 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Function"); |
| 2277 | 2275 | return ErrorUnexpected; |
| 2278 | | case Decl::CXXDeductionGuide: |
| 2276 | case clang::Decl::CXXDeductionGuide: |
| 2279 | 2277 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind CXXDeductionGuide"); |
| 2280 | 2278 | return ErrorUnexpected; |
| 2281 | | case Decl::CXXMethod: |
| 2279 | case clang::Decl::CXXMethod: |
| 2282 | 2280 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind CXXMethod"); |
| 2283 | 2281 | return ErrorUnexpected; |
| 2284 | | case Decl::CXXConstructor: |
| 2282 | case clang::Decl::CXXConstructor: |
| 2285 | 2283 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind CXXConstructor"); |
| 2286 | 2284 | return ErrorUnexpected; |
| 2287 | | case Decl::CXXConversion: |
| 2285 | case clang::Decl::CXXConversion: |
| 2288 | 2286 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind CXXConversion"); |
| 2289 | 2287 | return ErrorUnexpected; |
| 2290 | | case Decl::CXXDestructor: |
| 2288 | case clang::Decl::CXXDestructor: |
| 2291 | 2289 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind CXXDestructor"); |
| 2292 | 2290 | return ErrorUnexpected; |
| 2293 | | case Decl::MSProperty: |
| 2291 | case clang::Decl::MSProperty: |
| 2294 | 2292 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind MSProperty"); |
| 2295 | 2293 | return ErrorUnexpected; |
| 2296 | | case Decl::NonTypeTemplateParm: |
| 2294 | case clang::Decl::NonTypeTemplateParm: |
| 2297 | 2295 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind NonTypeTemplateParm"); |
| 2298 | 2296 | return ErrorUnexpected; |
| 2299 | | case Decl::Decomposition: |
| 2297 | case clang::Decl::Decomposition: |
| 2300 | 2298 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind Decomposition"); |
| 2301 | 2299 | return ErrorUnexpected; |
| 2302 | | case Decl::ImplicitParam: |
| 2300 | case clang::Decl::ImplicitParam: |
| 2303 | 2301 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ImplicitParam"); |
| 2304 | 2302 | return ErrorUnexpected; |
| 2305 | | case Decl::OMPCapturedExpr: |
| 2303 | case clang::Decl::OMPCapturedExpr: |
| 2306 | 2304 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind OMPCapturedExpr"); |
| 2307 | 2305 | return ErrorUnexpected; |
| 2308 | | case Decl::ParmVar: |
| 2306 | case clang::Decl::ParmVar: |
| 2309 | 2307 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ParmVar"); |
| 2310 | 2308 | return ErrorUnexpected; |
| 2311 | | case Decl::VarTemplateSpecialization: |
| 2309 | case clang::Decl::VarTemplateSpecialization: |
| 2312 | 2310 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind VarTemplateSpecialization"); |
| 2313 | 2311 | return ErrorUnexpected; |
| 2314 | | case Decl::VarTemplatePartialSpecialization: |
| 2312 | case clang::Decl::VarTemplatePartialSpecialization: |
| 2315 | 2313 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind VarTemplatePartialSpecialization"); |
| 2316 | 2314 | return ErrorUnexpected; |
| 2317 | | case Decl::EnumConstant: |
| 2315 | case clang::Decl::EnumConstant: |
| 2318 | 2316 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind EnumConstant"); |
| 2319 | 2317 | return ErrorUnexpected; |
| 2320 | | case Decl::IndirectField: |
| 2318 | case clang::Decl::IndirectField: |
| 2321 | 2319 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind IndirectField"); |
| 2322 | 2320 | return ErrorUnexpected; |
| 2323 | | case Decl::OMPDeclareReduction: |
| 2321 | case clang::Decl::OMPDeclareReduction: |
| 2324 | 2322 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind OMPDeclareReduction"); |
| 2325 | 2323 | return ErrorUnexpected; |
| 2326 | | case Decl::UnresolvedUsingValue: |
| 2324 | case clang::Decl::UnresolvedUsingValue: |
| 2327 | 2325 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind UnresolvedUsingValue"); |
| 2328 | 2326 | return ErrorUnexpected; |
| 2329 | | case Decl::OMPThreadPrivate: |
| 2327 | case clang::Decl::OMPThreadPrivate: |
| 2330 | 2328 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind OMPThreadPrivate"); |
| 2331 | 2329 | return ErrorUnexpected; |
| 2332 | | case Decl::ObjCPropertyImpl: |
| 2330 | case clang::Decl::ObjCPropertyImpl: |
| 2333 | 2331 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind ObjCPropertyImpl"); |
| 2334 | 2332 | return ErrorUnexpected; |
| 2335 | | case Decl::PragmaComment: |
| 2333 | case clang::Decl::PragmaComment: |
| 2336 | 2334 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind PragmaComment"); |
| 2337 | 2335 | return ErrorUnexpected; |
| 2338 | | case Decl::PragmaDetectMismatch: |
| 2336 | case clang::Decl::PragmaDetectMismatch: |
| 2339 | 2337 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind PragmaDetectMismatch"); |
| 2340 | 2338 | return ErrorUnexpected; |
| 2341 | | case Decl::StaticAssert: |
| 2339 | case clang::Decl::StaticAssert: |
| 2342 | 2340 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind StaticAssert"); |
| 2343 | 2341 | return ErrorUnexpected; |
| 2344 | | case Decl::TranslationUnit: |
| 2342 | case clang::Decl::TranslationUnit: |
| 2345 | 2343 | emit_warning(c, stmt->getLocStart(), "TODO handle decl kind TranslationUnit"); |
| 2346 | 2344 | return ErrorUnexpected; |
| 2347 | 2345 | } |
| ... | ... | @@ -2368,7 +2366,7 @@ static AstNode *to_enum_zero_cmp(Context *c, AstNode *expr, AstNode *enum_type) |
| 2368 | 2366 | return trans_create_node_bin_op(c, expr, BinOpTypeCmpNotEq, bitcast); |
| 2369 | 2367 | } |
| 2370 | 2368 | |
| 2371 | | static AstNode *trans_bool_expr(Context *c, ResultUsed result_used, TransScope *scope, const Expr *expr, TransLRValue lrval) { |
| 2369 | static AstNode *trans_bool_expr(Context *c, ResultUsed result_used, TransScope *scope, const clang::Expr *expr, TransLRValue lrval) { |
| 2372 | 2370 | AstNode *res = trans_expr(c, result_used, scope, expr, lrval); |
| 2373 | 2371 | if (res == nullptr) |
| 2374 | 2372 | return nullptr; |
| ... | ... | @@ -2405,133 +2403,133 @@ static AstNode *trans_bool_expr(Context *c, ResultUsed result_used, TransScope * |
| 2405 | 2403 | } |
| 2406 | 2404 | |
| 2407 | 2405 | |
| 2408 | | const Type *ty = get_expr_qual_type_before_implicit_cast(c, expr).getTypePtr(); |
| 2406 | const clang::Type *ty = get_expr_qual_type_before_implicit_cast(c, expr).getTypePtr(); |
| 2409 | 2407 | auto classs = ty->getTypeClass(); |
| 2410 | 2408 | switch (classs) { |
| 2411 | | case Type::Builtin: |
| 2409 | case clang::Type::Builtin: |
| 2412 | 2410 | { |
| 2413 | | const BuiltinType *builtin_ty = static_cast<const BuiltinType*>(ty); |
| 2411 | const clang::BuiltinType *builtin_ty = static_cast<const clang::BuiltinType*>(ty); |
| 2414 | 2412 | switch (builtin_ty->getKind()) { |
| 2415 | | case BuiltinType::Bool: |
| 2416 | | case BuiltinType::Char_U: |
| 2417 | | case BuiltinType::UChar: |
| 2418 | | case BuiltinType::Char_S: |
| 2419 | | case BuiltinType::SChar: |
| 2420 | | case BuiltinType::UShort: |
| 2421 | | case BuiltinType::UInt: |
| 2422 | | case BuiltinType::ULong: |
| 2423 | | case BuiltinType::ULongLong: |
| 2424 | | case BuiltinType::Short: |
| 2425 | | case BuiltinType::Int: |
| 2426 | | case BuiltinType::Long: |
| 2427 | | case BuiltinType::LongLong: |
| 2428 | | case BuiltinType::UInt128: |
| 2429 | | case BuiltinType::Int128: |
| 2430 | | case BuiltinType::Float: |
| 2431 | | case BuiltinType::Double: |
| 2432 | | case BuiltinType::Float128: |
| 2433 | | case BuiltinType::LongDouble: |
| 2434 | | case BuiltinType::WChar_U: |
| 2435 | | case BuiltinType::Char8: |
| 2436 | | case BuiltinType::Char16: |
| 2437 | | case BuiltinType::Char32: |
| 2438 | | case BuiltinType::WChar_S: |
| 2439 | | case BuiltinType::Float16: |
| 2413 | case clang::BuiltinType::Bool: |
| 2414 | case clang::BuiltinType::Char_U: |
| 2415 | case clang::BuiltinType::UChar: |
| 2416 | case clang::BuiltinType::Char_S: |
| 2417 | case clang::BuiltinType::SChar: |
| 2418 | case clang::BuiltinType::UShort: |
| 2419 | case clang::BuiltinType::UInt: |
| 2420 | case clang::BuiltinType::ULong: |
| 2421 | case clang::BuiltinType::ULongLong: |
| 2422 | case clang::BuiltinType::Short: |
| 2423 | case clang::BuiltinType::Int: |
| 2424 | case clang::BuiltinType::Long: |
| 2425 | case clang::BuiltinType::LongLong: |
| 2426 | case clang::BuiltinType::UInt128: |
| 2427 | case clang::BuiltinType::Int128: |
| 2428 | case clang::BuiltinType::Float: |
| 2429 | case clang::BuiltinType::Double: |
| 2430 | case clang::BuiltinType::Float128: |
| 2431 | case clang::BuiltinType::LongDouble: |
| 2432 | case clang::BuiltinType::WChar_U: |
| 2433 | case clang::BuiltinType::Char8: |
| 2434 | case clang::BuiltinType::Char16: |
| 2435 | case clang::BuiltinType::Char32: |
| 2436 | case clang::BuiltinType::WChar_S: |
| 2437 | case clang::BuiltinType::Float16: |
| 2440 | 2438 | return trans_create_node_bin_op(c, res, BinOpTypeCmpNotEq, trans_create_node_unsigned_negative(c, 0, false)); |
| 2441 | | case BuiltinType::NullPtr: |
| 2439 | case clang::BuiltinType::NullPtr: |
| 2442 | 2440 | return trans_create_node_bin_op(c, res, BinOpTypeCmpNotEq, |
| 2443 | 2441 | trans_create_node_unsigned(c, 0)); |
| 2444 | 2442 | |
| 2445 | | case BuiltinType::Void: |
| 2446 | | case BuiltinType::Half: |
| 2447 | | case BuiltinType::ObjCId: |
| 2448 | | case BuiltinType::ObjCClass: |
| 2449 | | case BuiltinType::ObjCSel: |
| 2450 | | case BuiltinType::OMPArraySection: |
| 2451 | | case BuiltinType::Dependent: |
| 2452 | | case BuiltinType::Overload: |
| 2453 | | case BuiltinType::BoundMember: |
| 2454 | | case BuiltinType::PseudoObject: |
| 2455 | | case BuiltinType::UnknownAny: |
| 2456 | | case BuiltinType::BuiltinFn: |
| 2457 | | case BuiltinType::ARCUnbridgedCast: |
| 2458 | | case BuiltinType::OCLImage1dRO: |
| 2459 | | case BuiltinType::OCLImage1dArrayRO: |
| 2460 | | case BuiltinType::OCLImage1dBufferRO: |
| 2461 | | case BuiltinType::OCLImage2dRO: |
| 2462 | | case BuiltinType::OCLImage2dArrayRO: |
| 2463 | | case BuiltinType::OCLImage2dDepthRO: |
| 2464 | | case BuiltinType::OCLImage2dArrayDepthRO: |
| 2465 | | case BuiltinType::OCLImage2dMSAARO: |
| 2466 | | case BuiltinType::OCLImage2dArrayMSAARO: |
| 2467 | | case BuiltinType::OCLImage2dMSAADepthRO: |
| 2468 | | case BuiltinType::OCLImage2dArrayMSAADepthRO: |
| 2469 | | case BuiltinType::OCLImage3dRO: |
| 2470 | | case BuiltinType::OCLImage1dWO: |
| 2471 | | case BuiltinType::OCLImage1dArrayWO: |
| 2472 | | case BuiltinType::OCLImage1dBufferWO: |
| 2473 | | case BuiltinType::OCLImage2dWO: |
| 2474 | | case BuiltinType::OCLImage2dArrayWO: |
| 2475 | | case BuiltinType::OCLImage2dDepthWO: |
| 2476 | | case BuiltinType::OCLImage2dArrayDepthWO: |
| 2477 | | case BuiltinType::OCLImage2dMSAAWO: |
| 2478 | | case BuiltinType::OCLImage2dArrayMSAAWO: |
| 2479 | | case BuiltinType::OCLImage2dMSAADepthWO: |
| 2480 | | case BuiltinType::OCLImage2dArrayMSAADepthWO: |
| 2481 | | case BuiltinType::OCLImage3dWO: |
| 2482 | | case BuiltinType::OCLImage1dRW: |
| 2483 | | case BuiltinType::OCLImage1dArrayRW: |
| 2484 | | case BuiltinType::OCLImage1dBufferRW: |
| 2485 | | case BuiltinType::OCLImage2dRW: |
| 2486 | | case BuiltinType::OCLImage2dArrayRW: |
| 2487 | | case BuiltinType::OCLImage2dDepthRW: |
| 2488 | | case BuiltinType::OCLImage2dArrayDepthRW: |
| 2489 | | case BuiltinType::OCLImage2dMSAARW: |
| 2490 | | case BuiltinType::OCLImage2dArrayMSAARW: |
| 2491 | | case BuiltinType::OCLImage2dMSAADepthRW: |
| 2492 | | case BuiltinType::OCLImage2dArrayMSAADepthRW: |
| 2493 | | case BuiltinType::OCLImage3dRW: |
| 2494 | | case BuiltinType::OCLSampler: |
| 2495 | | case BuiltinType::OCLEvent: |
| 2496 | | case BuiltinType::OCLClkEvent: |
| 2497 | | case BuiltinType::OCLQueue: |
| 2498 | | case BuiltinType::OCLReserveID: |
| 2499 | | case BuiltinType::ShortAccum: |
| 2500 | | case BuiltinType::Accum: |
| 2501 | | case BuiltinType::LongAccum: |
| 2502 | | case BuiltinType::UShortAccum: |
| 2503 | | case BuiltinType::UAccum: |
| 2504 | | case BuiltinType::ULongAccum: |
| 2505 | | case BuiltinType::ShortFract: |
| 2506 | | case BuiltinType::Fract: |
| 2507 | | case BuiltinType::LongFract: |
| 2508 | | case BuiltinType::UShortFract: |
| 2509 | | case BuiltinType::UFract: |
| 2510 | | case BuiltinType::ULongFract: |
| 2511 | | case BuiltinType::SatShortAccum: |
| 2512 | | case BuiltinType::SatAccum: |
| 2513 | | case BuiltinType::SatLongAccum: |
| 2514 | | case BuiltinType::SatUShortAccum: |
| 2515 | | case BuiltinType::SatUAccum: |
| 2516 | | case BuiltinType::SatULongAccum: |
| 2517 | | case BuiltinType::SatShortFract: |
| 2518 | | case BuiltinType::SatFract: |
| 2519 | | case BuiltinType::SatLongFract: |
| 2520 | | case BuiltinType::SatUShortFract: |
| 2521 | | case BuiltinType::SatUFract: |
| 2522 | | case BuiltinType::SatULongFract: |
| 2443 | case clang::BuiltinType::Void: |
| 2444 | case clang::BuiltinType::Half: |
| 2445 | case clang::BuiltinType::ObjCId: |
| 2446 | case clang::BuiltinType::ObjCClass: |
| 2447 | case clang::BuiltinType::ObjCSel: |
| 2448 | case clang::BuiltinType::OMPArraySection: |
| 2449 | case clang::BuiltinType::Dependent: |
| 2450 | case clang::BuiltinType::Overload: |
| 2451 | case clang::BuiltinType::BoundMember: |
| 2452 | case clang::BuiltinType::PseudoObject: |
| 2453 | case clang::BuiltinType::UnknownAny: |
| 2454 | case clang::BuiltinType::BuiltinFn: |
| 2455 | case clang::BuiltinType::ARCUnbridgedCast: |
| 2456 | case clang::BuiltinType::OCLImage1dRO: |
| 2457 | case clang::BuiltinType::OCLImage1dArrayRO: |
| 2458 | case clang::BuiltinType::OCLImage1dBufferRO: |
| 2459 | case clang::BuiltinType::OCLImage2dRO: |
| 2460 | case clang::BuiltinType::OCLImage2dArrayRO: |
| 2461 | case clang::BuiltinType::OCLImage2dDepthRO: |
| 2462 | case clang::BuiltinType::OCLImage2dArrayDepthRO: |
| 2463 | case clang::BuiltinType::OCLImage2dMSAARO: |
| 2464 | case clang::BuiltinType::OCLImage2dArrayMSAARO: |
| 2465 | case clang::BuiltinType::OCLImage2dMSAADepthRO: |
| 2466 | case clang::BuiltinType::OCLImage2dArrayMSAADepthRO: |
| 2467 | case clang::BuiltinType::OCLImage3dRO: |
| 2468 | case clang::BuiltinType::OCLImage1dWO: |
| 2469 | case clang::BuiltinType::OCLImage1dArrayWO: |
| 2470 | case clang::BuiltinType::OCLImage1dBufferWO: |
| 2471 | case clang::BuiltinType::OCLImage2dWO: |
| 2472 | case clang::BuiltinType::OCLImage2dArrayWO: |
| 2473 | case clang::BuiltinType::OCLImage2dDepthWO: |
| 2474 | case clang::BuiltinType::OCLImage2dArrayDepthWO: |
| 2475 | case clang::BuiltinType::OCLImage2dMSAAWO: |
| 2476 | case clang::BuiltinType::OCLImage2dArrayMSAAWO: |
| 2477 | case clang::BuiltinType::OCLImage2dMSAADepthWO: |
| 2478 | case clang::BuiltinType::OCLImage2dArrayMSAADepthWO: |
| 2479 | case clang::BuiltinType::OCLImage3dWO: |
| 2480 | case clang::BuiltinType::OCLImage1dRW: |
| 2481 | case clang::BuiltinType::OCLImage1dArrayRW: |
| 2482 | case clang::BuiltinType::OCLImage1dBufferRW: |
| 2483 | case clang::BuiltinType::OCLImage2dRW: |
| 2484 | case clang::BuiltinType::OCLImage2dArrayRW: |
| 2485 | case clang::BuiltinType::OCLImage2dDepthRW: |
| 2486 | case clang::BuiltinType::OCLImage2dArrayDepthRW: |
| 2487 | case clang::BuiltinType::OCLImage2dMSAARW: |
| 2488 | case clang::BuiltinType::OCLImage2dArrayMSAARW: |
| 2489 | case clang::BuiltinType::OCLImage2dMSAADepthRW: |
| 2490 | case clang::BuiltinType::OCLImage2dArrayMSAADepthRW: |
| 2491 | case clang::BuiltinType::OCLImage3dRW: |
| 2492 | case clang::BuiltinType::OCLSampler: |
| 2493 | case clang::BuiltinType::OCLEvent: |
| 2494 | case clang::BuiltinType::OCLClkEvent: |
| 2495 | case clang::BuiltinType::OCLQueue: |
| 2496 | case clang::BuiltinType::OCLReserveID: |
| 2497 | case clang::BuiltinType::ShortAccum: |
| 2498 | case clang::BuiltinType::Accum: |
| 2499 | case clang::BuiltinType::LongAccum: |
| 2500 | case clang::BuiltinType::UShortAccum: |
| 2501 | case clang::BuiltinType::UAccum: |
| 2502 | case clang::BuiltinType::ULongAccum: |
| 2503 | case clang::BuiltinType::ShortFract: |
| 2504 | case clang::BuiltinType::Fract: |
| 2505 | case clang::BuiltinType::LongFract: |
| 2506 | case clang::BuiltinType::UShortFract: |
| 2507 | case clang::BuiltinType::UFract: |
| 2508 | case clang::BuiltinType::ULongFract: |
| 2509 | case clang::BuiltinType::SatShortAccum: |
| 2510 | case clang::BuiltinType::SatAccum: |
| 2511 | case clang::BuiltinType::SatLongAccum: |
| 2512 | case clang::BuiltinType::SatUShortAccum: |
| 2513 | case clang::BuiltinType::SatUAccum: |
| 2514 | case clang::BuiltinType::SatULongAccum: |
| 2515 | case clang::BuiltinType::SatShortFract: |
| 2516 | case clang::BuiltinType::SatFract: |
| 2517 | case clang::BuiltinType::SatLongFract: |
| 2518 | case clang::BuiltinType::SatUShortFract: |
| 2519 | case clang::BuiltinType::SatUFract: |
| 2520 | case clang::BuiltinType::SatULongFract: |
| 2523 | 2521 | return res; |
| 2524 | 2522 | } |
| 2525 | 2523 | break; |
| 2526 | 2524 | } |
| 2527 | | case Type::Pointer: |
| 2525 | case clang::Type::Pointer: |
| 2528 | 2526 | return trans_create_node_bin_op(c, res, BinOpTypeCmpNotEq, |
| 2529 | 2527 | trans_create_node_unsigned(c, 0)); |
| 2530 | 2528 | |
| 2531 | | case Type::Typedef: |
| 2529 | case clang::Type::Typedef: |
| 2532 | 2530 | { |
| 2533 | | const TypedefType *typedef_ty = static_cast<const TypedefType*>(ty); |
| 2534 | | const TypedefNameDecl *typedef_decl = typedef_ty->getDecl(); |
| 2531 | const clang::TypedefType *typedef_ty = static_cast<const clang::TypedefType*>(ty); |
| 2532 | const clang::TypedefNameDecl *typedef_decl = typedef_ty->getDecl(); |
| 2535 | 2533 | auto existing_entry = c->decl_table.maybe_get((void*)typedef_decl->getCanonicalDecl()); |
| 2536 | 2534 | if (existing_entry) { |
| 2537 | 2535 | return existing_entry->value; |
| ... | ... | @@ -2540,79 +2538,79 @@ static AstNode *trans_bool_expr(Context *c, ResultUsed result_used, TransScope * |
| 2540 | 2538 | return res; |
| 2541 | 2539 | } |
| 2542 | 2540 | |
| 2543 | | case Type::Enum: |
| 2541 | case clang::Type::Enum: |
| 2544 | 2542 | { |
| 2545 | | const EnumType *enum_ty = static_cast<const EnumType*>(ty); |
| 2543 | const clang::EnumType *enum_ty = static_cast<const clang::EnumType*>(ty); |
| 2546 | 2544 | AstNode *enum_type = resolve_enum_decl(c, enum_ty->getDecl()); |
| 2547 | 2545 | return to_enum_zero_cmp(c, res, enum_type); |
| 2548 | 2546 | } |
| 2549 | 2547 | |
| 2550 | | case Type::Elaborated: |
| 2548 | case clang::Type::Elaborated: |
| 2551 | 2549 | { |
| 2552 | | const ElaboratedType *elaborated_ty = static_cast<const ElaboratedType*>(ty); |
| 2550 | const clang::ElaboratedType *elaborated_ty = static_cast<const clang::ElaboratedType*>(ty); |
| 2553 | 2551 | switch (elaborated_ty->getKeyword()) { |
| 2554 | | case ETK_Enum: { |
| 2552 | case clang::ETK_Enum: { |
| 2555 | 2553 | AstNode *enum_type = trans_qual_type(c, elaborated_ty->getNamedType(), expr->getLocStart()); |
| 2556 | 2554 | return to_enum_zero_cmp(c, res, enum_type); |
| 2557 | 2555 | } |
| 2558 | | case ETK_Struct: |
| 2559 | | case ETK_Union: |
| 2560 | | case ETK_Interface: |
| 2561 | | case ETK_Class: |
| 2562 | | case ETK_Typename: |
| 2563 | | case ETK_None: |
| 2556 | case clang::ETK_Struct: |
| 2557 | case clang::ETK_Union: |
| 2558 | case clang::ETK_Interface: |
| 2559 | case clang::ETK_Class: |
| 2560 | case clang::ETK_Typename: |
| 2561 | case clang::ETK_None: |
| 2564 | 2562 | return res; |
| 2565 | 2563 | } |
| 2566 | 2564 | } |
| 2567 | 2565 | |
| 2568 | | case Type::FunctionProto: |
| 2569 | | case Type::Record: |
| 2570 | | case Type::ConstantArray: |
| 2571 | | case Type::Paren: |
| 2572 | | case Type::Decayed: |
| 2573 | | case Type::Attributed: |
| 2574 | | case Type::IncompleteArray: |
| 2575 | | case Type::BlockPointer: |
| 2576 | | case Type::LValueReference: |
| 2577 | | case Type::RValueReference: |
| 2578 | | case Type::MemberPointer: |
| 2579 | | case Type::VariableArray: |
| 2580 | | case Type::DependentSizedArray: |
| 2581 | | case Type::DependentSizedExtVector: |
| 2582 | | case Type::Vector: |
| 2583 | | case Type::ExtVector: |
| 2584 | | case Type::FunctionNoProto: |
| 2585 | | case Type::UnresolvedUsing: |
| 2586 | | case Type::Adjusted: |
| 2587 | | case Type::TypeOfExpr: |
| 2588 | | case Type::TypeOf: |
| 2589 | | case Type::Decltype: |
| 2590 | | case Type::UnaryTransform: |
| 2591 | | case Type::TemplateTypeParm: |
| 2592 | | case Type::SubstTemplateTypeParm: |
| 2593 | | case Type::SubstTemplateTypeParmPack: |
| 2594 | | case Type::TemplateSpecialization: |
| 2595 | | case Type::Auto: |
| 2596 | | case Type::InjectedClassName: |
| 2597 | | case Type::DependentName: |
| 2598 | | case Type::DependentTemplateSpecialization: |
| 2599 | | case Type::PackExpansion: |
| 2600 | | case Type::ObjCObject: |
| 2601 | | case Type::ObjCInterface: |
| 2602 | | case Type::Complex: |
| 2603 | | case Type::ObjCObjectPointer: |
| 2604 | | case Type::Atomic: |
| 2605 | | case Type::Pipe: |
| 2606 | | case Type::ObjCTypeParam: |
| 2607 | | case Type::DeducedTemplateSpecialization: |
| 2608 | | case Type::DependentAddressSpace: |
| 2609 | | case Type::DependentVector: |
| 2566 | case clang::Type::FunctionProto: |
| 2567 | case clang::Type::Record: |
| 2568 | case clang::Type::ConstantArray: |
| 2569 | case clang::Type::Paren: |
| 2570 | case clang::Type::Decayed: |
| 2571 | case clang::Type::Attributed: |
| 2572 | case clang::Type::IncompleteArray: |
| 2573 | case clang::Type::BlockPointer: |
| 2574 | case clang::Type::LValueReference: |
| 2575 | case clang::Type::RValueReference: |
| 2576 | case clang::Type::MemberPointer: |
| 2577 | case clang::Type::VariableArray: |
| 2578 | case clang::Type::DependentSizedArray: |
| 2579 | case clang::Type::DependentSizedExtVector: |
| 2580 | case clang::Type::Vector: |
| 2581 | case clang::Type::ExtVector: |
| 2582 | case clang::Type::FunctionNoProto: |
| 2583 | case clang::Type::UnresolvedUsing: |
| 2584 | case clang::Type::Adjusted: |
| 2585 | case clang::Type::TypeOfExpr: |
| 2586 | case clang::Type::TypeOf: |
| 2587 | case clang::Type::Decltype: |
| 2588 | case clang::Type::UnaryTransform: |
| 2589 | case clang::Type::TemplateTypeParm: |
| 2590 | case clang::Type::SubstTemplateTypeParm: |
| 2591 | case clang::Type::SubstTemplateTypeParmPack: |
| 2592 | case clang::Type::TemplateSpecialization: |
| 2593 | case clang::Type::Auto: |
| 2594 | case clang::Type::InjectedClassName: |
| 2595 | case clang::Type::DependentName: |
| 2596 | case clang::Type::DependentTemplateSpecialization: |
| 2597 | case clang::Type::PackExpansion: |
| 2598 | case clang::Type::ObjCObject: |
| 2599 | case clang::Type::ObjCInterface: |
| 2600 | case clang::Type::Complex: |
| 2601 | case clang::Type::ObjCObjectPointer: |
| 2602 | case clang::Type::Atomic: |
| 2603 | case clang::Type::Pipe: |
| 2604 | case clang::Type::ObjCTypeParam: |
| 2605 | case clang::Type::DeducedTemplateSpecialization: |
| 2606 | case clang::Type::DependentAddressSpace: |
| 2607 | case clang::Type::DependentVector: |
| 2610 | 2608 | return res; |
| 2611 | 2609 | } |
| 2612 | 2610 | zig_unreachable(); |
| 2613 | 2611 | } |
| 2614 | 2612 | |
| 2615 | | static AstNode *trans_while_loop(Context *c, TransScope *scope, const WhileStmt *stmt) { |
| 2613 | static AstNode *trans_while_loop(Context *c, TransScope *scope, const clang::WhileStmt *stmt) { |
| 2616 | 2614 | TransScopeWhile *while_scope = trans_scope_while_create(c, scope); |
| 2617 | 2615 | |
| 2618 | 2616 | while_scope->node->data.while_expr.condition = trans_bool_expr(c, ResultUsedYes, scope, stmt->getCond(), TransRValue); |
| ... | ... | @@ -2627,7 +2625,7 @@ static AstNode *trans_while_loop(Context *c, TransScope *scope, const WhileStmt |
| 2627 | 2625 | return while_scope->node; |
| 2628 | 2626 | } |
| 2629 | 2627 | |
| 2630 | | static AstNode *trans_if_statement(Context *c, TransScope *scope, const IfStmt *stmt) { |
| 2628 | static AstNode *trans_if_statement(Context *c, TransScope *scope, const clang::IfStmt *stmt) { |
| 2631 | 2629 | // if (c) t |
| 2632 | 2630 | // if (c) t else e |
| 2633 | 2631 | AstNode *if_node = trans_create_node(c, NodeTypeIfBoolExpr); |
| ... | ... | @@ -2649,7 +2647,7 @@ static AstNode *trans_if_statement(Context *c, TransScope *scope, const IfStmt * |
| 2649 | 2647 | return if_node; |
| 2650 | 2648 | } |
| 2651 | 2649 | |
| 2652 | | static AstNode *trans_call_expr(Context *c, ResultUsed result_used, TransScope *scope, const CallExpr *stmt) { |
| 2650 | static AstNode *trans_call_expr(Context *c, ResultUsed result_used, TransScope *scope, const clang::CallExpr *stmt) { |
| 2653 | 2651 | AstNode *node = trans_create_node(c, NodeTypeFnCallExpr); |
| 2654 | 2652 | |
| 2655 | 2653 | AstNode *callee_raw_node = trans_expr(c, ResultUsedYes, scope, stmt->getCallee(), TransRValue); |
| ... | ... | @@ -2657,16 +2655,16 @@ static AstNode *trans_call_expr(Context *c, ResultUsed result_used, TransScope * |
| 2657 | 2655 | return nullptr; |
| 2658 | 2656 | |
| 2659 | 2657 | bool is_ptr = false; |
| 2660 | | const FunctionProtoType *fn_ty = qual_type_get_fn_proto(stmt->getCallee()->getType(), &is_ptr); |
| 2658 | const clang::FunctionProtoType *fn_ty = qual_type_get_fn_proto(stmt->getCallee()->getType(), &is_ptr); |
| 2661 | 2659 | AstNode *callee_node = nullptr; |
| 2662 | 2660 | if (is_ptr && fn_ty) { |
| 2663 | | if (stmt->getCallee()->getStmtClass() == Stmt::ImplicitCastExprClass) { |
| 2664 | | const ImplicitCastExpr *implicit_cast = static_cast<const ImplicitCastExpr *>(stmt->getCallee()); |
| 2665 | | if (implicit_cast->getCastKind() == CK_FunctionToPointerDecay) { |
| 2666 | | if (implicit_cast->getSubExpr()->getStmtClass() == Stmt::DeclRefExprClass) { |
| 2667 | | const DeclRefExpr *decl_ref = static_cast<const DeclRefExpr *>(implicit_cast->getSubExpr()); |
| 2668 | | const Decl *decl = decl_ref->getFoundDecl(); |
| 2669 | | if (decl->getKind() == Decl::Function) { |
| 2661 | if (stmt->getCallee()->getStmtClass() == clang::Stmt::ImplicitCastExprClass) { |
| 2662 | const clang::ImplicitCastExpr *implicit_cast = static_cast<const clang::ImplicitCastExpr *>(stmt->getCallee()); |
| 2663 | if (implicit_cast->getCastKind() == clang::CK_FunctionToPointerDecay) { |
| 2664 | if (implicit_cast->getSubExpr()->getStmtClass() == clang::Stmt::DeclRefExprClass) { |
| 2665 | const clang::DeclRefExpr *decl_ref = static_cast<const clang::DeclRefExpr *>(implicit_cast->getSubExpr()); |
| 2666 | const clang::Decl *decl = decl_ref->getFoundDecl(); |
| 2667 | if (decl->getKind() == clang::Decl::Function) { |
| 2670 | 2668 | callee_node = callee_raw_node; |
| 2671 | 2669 | } |
| 2672 | 2670 | } |
| ... | ... | @@ -2682,7 +2680,7 @@ static AstNode *trans_call_expr(Context *c, ResultUsed result_used, TransScope * |
| 2682 | 2680 | node->data.fn_call_expr.fn_ref_expr = callee_node; |
| 2683 | 2681 | |
| 2684 | 2682 | unsigned num_args = stmt->getNumArgs(); |
| 2685 | | const Expr * const* args = stmt->getArgs(); |
| 2683 | const clang::Expr * const* args = stmt->getArgs(); |
| 2686 | 2684 | for (unsigned i = 0; i < num_args; i += 1) { |
| 2687 | 2685 | AstNode *arg_node = trans_expr(c, ResultUsedYes, scope, args[i], TransRValue); |
| 2688 | 2686 | if (arg_node == nullptr) |
| ... | ... | @@ -2698,7 +2696,7 @@ static AstNode *trans_call_expr(Context *c, ResultUsed result_used, TransScope * |
| 2698 | 2696 | return node; |
| 2699 | 2697 | } |
| 2700 | 2698 | |
| 2701 | | static AstNode *trans_member_expr(Context *c, TransScope *scope, const MemberExpr *stmt) { |
| 2699 | static AstNode *trans_member_expr(Context *c, TransScope *scope, const clang::MemberExpr *stmt) { |
| 2702 | 2700 | AstNode *container_node = trans_expr(c, ResultUsedYes, scope, stmt->getBase(), TransRValue); |
| 2703 | 2701 | if (container_node == nullptr) |
| 2704 | 2702 | return nullptr; |
| ... | ... | @@ -2713,7 +2711,7 @@ static AstNode *trans_member_expr(Context *c, TransScope *scope, const MemberExp |
| 2713 | 2711 | return node; |
| 2714 | 2712 | } |
| 2715 | 2713 | |
| 2716 | | static AstNode *trans_array_subscript_expr(Context *c, TransScope *scope, const ArraySubscriptExpr *stmt) { |
| 2714 | static AstNode *trans_array_subscript_expr(Context *c, TransScope *scope, const clang::ArraySubscriptExpr *stmt) { |
| 2717 | 2715 | AstNode *container_node = trans_expr(c, ResultUsedYes, scope, stmt->getBase(), TransRValue); |
| 2718 | 2716 | if (container_node == nullptr) |
| 2719 | 2717 | return nullptr; |
| ... | ... | @@ -2730,7 +2728,7 @@ static AstNode *trans_array_subscript_expr(Context *c, TransScope *scope, const |
| 2730 | 2728 | } |
| 2731 | 2729 | |
| 2732 | 2730 | static AstNode *trans_c_style_cast_expr(Context *c, ResultUsed result_used, TransScope *scope, |
| 2733 | | const CStyleCastExpr *stmt, TransLRValue lrvalue) |
| 2731 | const clang::CStyleCastExpr *stmt, TransLRValue lrvalue) |
| 2734 | 2732 | { |
| 2735 | 2733 | AstNode *sub_expr_node = trans_expr(c, result_used, scope, stmt->getSubExpr(), lrvalue); |
| 2736 | 2734 | if (sub_expr_node == nullptr) |
| ... | ... | @@ -2740,7 +2738,7 @@ static AstNode *trans_c_style_cast_expr(Context *c, ResultUsed result_used, Tran |
| 2740 | 2738 | } |
| 2741 | 2739 | |
| 2742 | 2740 | static AstNode *trans_unary_expr_or_type_trait_expr(Context *c, TransScope *scope, |
| 2743 | | const UnaryExprOrTypeTraitExpr *stmt) |
| 2741 | const clang::UnaryExprOrTypeTraitExpr *stmt) |
| 2744 | 2742 | { |
| 2745 | 2743 | AstNode *type_node = trans_qual_type(c, stmt->getTypeOfArgument(), stmt->getLocStart()); |
| 2746 | 2744 | if (type_node == nullptr) |
| ... | ... | @@ -2751,14 +2749,14 @@ static AstNode *trans_unary_expr_or_type_trait_expr(Context *c, TransScope *scop |
| 2751 | 2749 | return node; |
| 2752 | 2750 | } |
| 2753 | 2751 | |
| 2754 | | static AstNode *trans_do_loop(Context *c, TransScope *parent_scope, const DoStmt *stmt) { |
| 2752 | static AstNode *trans_do_loop(Context *c, TransScope *parent_scope, const clang::DoStmt *stmt) { |
| 2755 | 2753 | TransScopeWhile *while_scope = trans_scope_while_create(c, parent_scope); |
| 2756 | 2754 | |
| 2757 | 2755 | while_scope->node->data.while_expr.condition = trans_create_node_bool(c, true); |
| 2758 | 2756 | |
| 2759 | 2757 | AstNode *body_node; |
| 2760 | 2758 | TransScope *child_scope; |
| 2761 | | if (stmt->getBody()->getStmtClass() == Stmt::CompoundStmtClass) { |
| 2759 | if (stmt->getBody()->getStmtClass() == clang::Stmt::CompoundStmtClass) { |
| 2762 | 2760 | // there's already a block in C, so we'll append our condition to it. |
| 2763 | 2761 | // c: do { |
| 2764 | 2762 | // c: a; |
| ... | ... | @@ -2811,11 +2809,11 @@ static AstNode *trans_do_loop(Context *c, TransScope *parent_scope, const DoStmt |
| 2811 | 2809 | return while_scope->node; |
| 2812 | 2810 | } |
| 2813 | 2811 | |
| 2814 | | static AstNode *trans_for_loop(Context *c, TransScope *parent_scope, const ForStmt *stmt) { |
| 2812 | static AstNode *trans_for_loop(Context *c, TransScope *parent_scope, const clang::ForStmt *stmt) { |
| 2815 | 2813 | AstNode *loop_block_node; |
| 2816 | 2814 | TransScopeWhile *while_scope; |
| 2817 | 2815 | TransScope *cond_scope; |
| 2818 | | const Stmt *init_stmt = stmt->getInit(); |
| 2816 | const clang::Stmt *init_stmt = stmt->getInit(); |
| 2819 | 2817 | if (init_stmt == nullptr) { |
| 2820 | 2818 | while_scope = trans_scope_while_create(c, parent_scope); |
| 2821 | 2819 | loop_block_node = while_scope->node; |
| ... | ... | @@ -2836,12 +2834,12 @@ static AstNode *trans_for_loop(Context *c, TransScope *parent_scope, const ForSt |
| 2836 | 2834 | child_scope->node->data.block.statements.append(while_scope->node); |
| 2837 | 2835 | } |
| 2838 | 2836 | |
| 2839 | | const Stmt *cond_stmt = stmt->getCond(); |
| 2837 | const clang::Stmt *cond_stmt = stmt->getCond(); |
| 2840 | 2838 | if (cond_stmt == nullptr) { |
| 2841 | 2839 | while_scope->node->data.while_expr.condition = trans_create_node_bool(c, true); |
| 2842 | 2840 | } else { |
| 2843 | | if (Expr::classof(cond_stmt)) { |
| 2844 | | const Expr *cond_expr = static_cast<const Expr*>(cond_stmt); |
| 2841 | if (clang::Expr::classof(cond_stmt)) { |
| 2842 | const clang::Expr *cond_expr = static_cast<const clang::Expr*>(cond_stmt); |
| 2845 | 2843 | while_scope->node->data.while_expr.condition = trans_bool_expr(c, ResultUsedYes, cond_scope, cond_expr, TransRValue); |
| 2846 | 2844 | |
| 2847 | 2845 | if (while_scope->node->data.while_expr.condition == nullptr) |
| ... | ... | @@ -2854,7 +2852,7 @@ static AstNode *trans_for_loop(Context *c, TransScope *parent_scope, const ForSt |
| 2854 | 2852 | } |
| 2855 | 2853 | } |
| 2856 | 2854 | |
| 2857 | | const Stmt *inc_stmt = stmt->getInc(); |
| 2855 | const clang::Stmt *inc_stmt = stmt->getInc(); |
| 2858 | 2856 | if (inc_stmt != nullptr) { |
| 2859 | 2857 | AstNode *inc_node; |
| 2860 | 2858 | TransScope *inc_scope = trans_stmt(c, cond_scope, inc_stmt, &inc_node); |
| ... | ... | @@ -2877,12 +2875,12 @@ static AstNode *trans_for_loop(Context *c, TransScope *parent_scope, const ForSt |
| 2877 | 2875 | return loop_block_node; |
| 2878 | 2876 | } |
| 2879 | 2877 | |
| 2880 | | static AstNode *trans_switch_stmt(Context *c, TransScope *parent_scope, const SwitchStmt *stmt) { |
| 2878 | static AstNode *trans_switch_stmt(Context *c, TransScope *parent_scope, const clang::SwitchStmt *stmt) { |
| 2881 | 2879 | TransScopeBlock *block_scope = trans_scope_block_create(c, parent_scope); |
| 2882 | 2880 | |
| 2883 | 2881 | TransScopeSwitch *switch_scope; |
| 2884 | 2882 | |
| 2885 | | const DeclStmt *var_decl_stmt = stmt->getConditionVariableDeclStmt(); |
| 2883 | const clang::DeclStmt *var_decl_stmt = stmt->getConditionVariableDeclStmt(); |
| 2886 | 2884 | if (var_decl_stmt == nullptr) { |
| 2887 | 2885 | switch_scope = trans_scope_switch_create(c, &block_scope->base); |
| 2888 | 2886 | } else { |
| ... | ... | @@ -2901,7 +2899,7 @@ static AstNode *trans_switch_stmt(Context *c, TransScope *parent_scope, const Sw |
| 2901 | 2899 | switch_scope->end_label_name = end_label_name; |
| 2902 | 2900 | block_scope->node->data.block.name = end_label_name; |
| 2903 | 2901 | |
| 2904 | | const Expr *cond_expr = stmt->getCond(); |
| 2902 | const clang::Expr *cond_expr = stmt->getCond(); |
| 2905 | 2903 | assert(cond_expr != nullptr); |
| 2906 | 2904 | |
| 2907 | 2905 | AstNode *expr_node = trans_expr(c, ResultUsedYes, &block_scope->base, cond_expr, TransRValue); |
| ... | ... | @@ -2910,9 +2908,9 @@ static AstNode *trans_switch_stmt(Context *c, TransScope *parent_scope, const Sw |
| 2910 | 2908 | switch_scope->switch_node->data.switch_expr.expr = expr_node; |
| 2911 | 2909 | |
| 2912 | 2910 | AstNode *body_node; |
| 2913 | | const Stmt *body_stmt = stmt->getBody(); |
| 2914 | | if (body_stmt->getStmtClass() == Stmt::CompoundStmtClass) { |
| 2915 | | if (trans_compound_stmt_inline(c, &switch_scope->base, (const CompoundStmt *)body_stmt, |
| 2911 | const clang::Stmt *body_stmt = stmt->getBody(); |
| 2912 | if (body_stmt->getStmtClass() == clang::Stmt::CompoundStmtClass) { |
| 2913 | if (trans_compound_stmt_inline(c, &switch_scope->base, (const clang::CompoundStmt *)body_stmt, |
| 2916 | 2914 | block_scope->node, nullptr)) |
| 2917 | 2915 | { |
| 2918 | 2916 | return nullptr; |
| ... | ... | @@ -2944,7 +2942,7 @@ static TransScopeSwitch *trans_scope_switch_find(TransScope *scope) { |
| 2944 | 2942 | return nullptr; |
| 2945 | 2943 | } |
| 2946 | 2944 | |
| 2947 | | static int trans_switch_case(Context *c, TransScope *parent_scope, const CaseStmt *stmt, AstNode **out_node, |
| 2945 | static int trans_switch_case(Context *c, TransScope *parent_scope, const clang::CaseStmt *stmt, AstNode **out_node, |
| 2948 | 2946 | TransScope **out_scope) { |
| 2949 | 2947 | *out_node = nullptr; |
| 2950 | 2948 | |
| ... | ... | @@ -2989,7 +2987,7 @@ static int trans_switch_case(Context *c, TransScope *parent_scope, const CaseStm |
| 2989 | 2987 | return ErrorNone; |
| 2990 | 2988 | } |
| 2991 | 2989 | |
| 2992 | | static int trans_switch_default(Context *c, TransScope *parent_scope, const DefaultStmt *stmt, AstNode **out_node, |
| 2990 | static int trans_switch_default(Context *c, TransScope *parent_scope, const clang::DefaultStmt *stmt, AstNode **out_node, |
| 2993 | 2991 | TransScope **out_scope) |
| 2994 | 2992 | { |
| 2995 | 2993 | *out_node = nullptr; |
| ... | ... | @@ -3026,25 +3024,25 @@ static int trans_switch_default(Context *c, TransScope *parent_scope, const Defa |
| 3026 | 3024 | return ErrorNone; |
| 3027 | 3025 | } |
| 3028 | 3026 | |
| 3029 | | static AstNode *trans_string_literal(Context *c, TransScope *scope, const StringLiteral *stmt) { |
| 3027 | static AstNode *trans_string_literal(Context *c, TransScope *scope, const clang::StringLiteral *stmt) { |
| 3030 | 3028 | switch (stmt->getKind()) { |
| 3031 | | case StringLiteral::Ascii: |
| 3032 | | case StringLiteral::UTF8: |
| 3029 | case clang::StringLiteral::Ascii: |
| 3030 | case clang::StringLiteral::UTF8: |
| 3033 | 3031 | return trans_create_node_str_lit_c(c, string_ref_to_buf(stmt->getString())); |
| 3034 | | case StringLiteral::UTF16: |
| 3032 | case clang::StringLiteral::UTF16: |
| 3035 | 3033 | emit_warning(c, stmt->getLocStart(), "TODO support UTF16 string literals"); |
| 3036 | 3034 | return nullptr; |
| 3037 | | case StringLiteral::UTF32: |
| 3035 | case clang::StringLiteral::UTF32: |
| 3038 | 3036 | emit_warning(c, stmt->getLocStart(), "TODO support UTF32 string literals"); |
| 3039 | 3037 | return nullptr; |
| 3040 | | case StringLiteral::Wide: |
| 3038 | case clang::StringLiteral::Wide: |
| 3041 | 3039 | emit_warning(c, stmt->getLocStart(), "TODO support wide string literals"); |
| 3042 | 3040 | return nullptr; |
| 3043 | 3041 | } |
| 3044 | 3042 | zig_unreachable(); |
| 3045 | 3043 | } |
| 3046 | 3044 | |
| 3047 | | static AstNode *trans_break_stmt(Context *c, TransScope *scope, const BreakStmt *stmt) { |
| 3045 | static AstNode *trans_break_stmt(Context *c, TransScope *scope, const clang::BreakStmt *stmt) { |
| 3048 | 3046 | TransScope *cur_scope = scope; |
| 3049 | 3047 | while (cur_scope != nullptr) { |
| 3050 | 3048 | if (cur_scope->id == TransScopeIdWhile) { |
| ... | ... | @@ -3058,7 +3056,7 @@ static AstNode *trans_break_stmt(Context *c, TransScope *scope, const BreakStmt |
| 3058 | 3056 | zig_unreachable(); |
| 3059 | 3057 | } |
| 3060 | 3058 | |
| 3061 | | static AstNode *trans_continue_stmt(Context *c, TransScope *scope, const ContinueStmt *stmt) { |
| 3059 | static AstNode *trans_continue_stmt(Context *c, TransScope *scope, const clang::ContinueStmt *stmt) { |
| 3062 | 3060 | return trans_create_node(c, NodeTypeContinue); |
| 3063 | 3061 | } |
| 3064 | 3062 | |
| ... | ... | @@ -3071,47 +3069,47 @@ static int wrap_stmt(AstNode **out_node, TransScope **out_scope, TransScope *in_ |
| 3071 | 3069 | return ErrorNone; |
| 3072 | 3070 | } |
| 3073 | 3071 | |
| 3074 | | static int trans_stmt_extra(Context *c, TransScope *scope, const Stmt *stmt, |
| 3072 | static int trans_stmt_extra(Context *c, TransScope *scope, const clang::Stmt *stmt, |
| 3075 | 3073 | ResultUsed result_used, TransLRValue lrvalue, |
| 3076 | 3074 | AstNode **out_node, TransScope **out_child_scope, |
| 3077 | 3075 | TransScope **out_node_scope) |
| 3078 | 3076 | { |
| 3079 | | Stmt::StmtClass sc = stmt->getStmtClass(); |
| 3077 | clang::Stmt::StmtClass sc = stmt->getStmtClass(); |
| 3080 | 3078 | switch (sc) { |
| 3081 | | case Stmt::ReturnStmtClass: |
| 3079 | case clang::Stmt::ReturnStmtClass: |
| 3082 | 3080 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3083 | | trans_return_stmt(c, scope, (const ReturnStmt *)stmt)); |
| 3084 | | case Stmt::CompoundStmtClass: |
| 3081 | trans_return_stmt(c, scope, (const clang::ReturnStmt *)stmt)); |
| 3082 | case clang::Stmt::CompoundStmtClass: |
| 3085 | 3083 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3086 | | trans_compound_stmt(c, scope, (const CompoundStmt *)stmt, out_node_scope)); |
| 3087 | | case Stmt::IntegerLiteralClass: |
| 3084 | trans_compound_stmt(c, scope, (const clang::CompoundStmt *)stmt, out_node_scope)); |
| 3085 | case clang::Stmt::IntegerLiteralClass: |
| 3088 | 3086 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3089 | | trans_integer_literal(c, (const IntegerLiteral *)stmt)); |
| 3090 | | case Stmt::ConditionalOperatorClass: |
| 3087 | trans_integer_literal(c, (const clang::IntegerLiteral *)stmt)); |
| 3088 | case clang::Stmt::ConditionalOperatorClass: |
| 3091 | 3089 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3092 | | trans_conditional_operator(c, result_used, scope, (const ConditionalOperator *)stmt)); |
| 3093 | | case Stmt::BinaryOperatorClass: |
| 3090 | trans_conditional_operator(c, result_used, scope, (const clang::ConditionalOperator *)stmt)); |
| 3091 | case clang::Stmt::BinaryOperatorClass: |
| 3094 | 3092 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3095 | | trans_binary_operator(c, result_used, scope, (const BinaryOperator *)stmt)); |
| 3096 | | case Stmt::CompoundAssignOperatorClass: |
| 3093 | trans_binary_operator(c, result_used, scope, (const clang::BinaryOperator *)stmt)); |
| 3094 | case clang::Stmt::CompoundAssignOperatorClass: |
| 3097 | 3095 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3098 | | trans_compound_assign_operator(c, result_used, scope, (const CompoundAssignOperator *)stmt)); |
| 3099 | | case Stmt::ImplicitCastExprClass: |
| 3096 | trans_compound_assign_operator(c, result_used, scope, (const clang::CompoundAssignOperator *)stmt)); |
| 3097 | case clang::Stmt::ImplicitCastExprClass: |
| 3100 | 3098 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3101 | | trans_implicit_cast_expr(c, scope, (const ImplicitCastExpr *)stmt)); |
| 3102 | | case Stmt::DeclRefExprClass: |
| 3099 | trans_implicit_cast_expr(c, scope, (const clang::ImplicitCastExpr *)stmt)); |
| 3100 | case clang::Stmt::DeclRefExprClass: |
| 3103 | 3101 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3104 | | trans_decl_ref_expr(c, scope, (const DeclRefExpr *)stmt, lrvalue)); |
| 3105 | | case Stmt::UnaryOperatorClass: |
| 3102 | trans_decl_ref_expr(c, scope, (const clang::DeclRefExpr *)stmt, lrvalue)); |
| 3103 | case clang::Stmt::UnaryOperatorClass: |
| 3106 | 3104 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3107 | | trans_unary_operator(c, result_used, scope, (const UnaryOperator *)stmt)); |
| 3108 | | case Stmt::DeclStmtClass: |
| 3109 | | return trans_local_declaration(c, scope, (const DeclStmt *)stmt, out_node, out_child_scope); |
| 3110 | | case Stmt::DoStmtClass: |
| 3111 | | case Stmt::WhileStmtClass: { |
| 3112 | | AstNode *while_node = sc == Stmt::DoStmtClass |
| 3113 | | ? trans_do_loop(c, scope, (const DoStmt *)stmt) |
| 3114 | | : trans_while_loop(c, scope, (const WhileStmt *)stmt); |
| 3105 | trans_unary_operator(c, result_used, scope, (const clang::UnaryOperator *)stmt)); |
| 3106 | case clang::Stmt::DeclStmtClass: |
| 3107 | return trans_local_declaration(c, scope, (const clang::DeclStmt *)stmt, out_node, out_child_scope); |
| 3108 | case clang::Stmt::DoStmtClass: |
| 3109 | case clang::Stmt::WhileStmtClass: { |
| 3110 | AstNode *while_node = sc == clang::Stmt::DoStmtClass |
| 3111 | ? trans_do_loop(c, scope, (const clang::DoStmt *)stmt) |
| 3112 | : trans_while_loop(c, scope, (const clang::WhileStmt *)stmt); |
| 3115 | 3113 | |
| 3116 | 3114 | if (while_node == nullptr) |
| 3117 | 3115 | return ErrorUnexpected; |
| ... | ... | @@ -3122,556 +3120,556 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const Stmt *stmt, |
| 3122 | 3120 | |
| 3123 | 3121 | return wrap_stmt(out_node, out_child_scope, scope, while_node); |
| 3124 | 3122 | } |
| 3125 | | case Stmt::IfStmtClass: |
| 3123 | case clang::Stmt::IfStmtClass: |
| 3126 | 3124 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3127 | | trans_if_statement(c, scope, (const IfStmt *)stmt)); |
| 3128 | | case Stmt::CallExprClass: |
| 3125 | trans_if_statement(c, scope, (const clang::IfStmt *)stmt)); |
| 3126 | case clang::Stmt::CallExprClass: |
| 3129 | 3127 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3130 | | trans_call_expr(c, result_used, scope, (const CallExpr *)stmt)); |
| 3131 | | case Stmt::NullStmtClass: |
| 3128 | trans_call_expr(c, result_used, scope, (const clang::CallExpr *)stmt)); |
| 3129 | case clang::Stmt::NullStmtClass: |
| 3132 | 3130 | *out_node = nullptr; |
| 3133 | 3131 | *out_child_scope = scope; |
| 3134 | 3132 | return ErrorNone; |
| 3135 | | case Stmt::MemberExprClass: |
| 3133 | case clang::Stmt::MemberExprClass: |
| 3136 | 3134 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3137 | | trans_member_expr(c, scope, (const MemberExpr *)stmt)); |
| 3138 | | case Stmt::ArraySubscriptExprClass: |
| 3135 | trans_member_expr(c, scope, (const clang::MemberExpr *)stmt)); |
| 3136 | case clang::Stmt::ArraySubscriptExprClass: |
| 3139 | 3137 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3140 | | trans_array_subscript_expr(c, scope, (const ArraySubscriptExpr *)stmt)); |
| 3141 | | case Stmt::CStyleCastExprClass: |
| 3138 | trans_array_subscript_expr(c, scope, (const clang::ArraySubscriptExpr *)stmt)); |
| 3139 | case clang::Stmt::CStyleCastExprClass: |
| 3142 | 3140 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3143 | | trans_c_style_cast_expr(c, result_used, scope, (const CStyleCastExpr *)stmt, lrvalue)); |
| 3144 | | case Stmt::UnaryExprOrTypeTraitExprClass: |
| 3141 | trans_c_style_cast_expr(c, result_used, scope, (const clang::CStyleCastExpr *)stmt, lrvalue)); |
| 3142 | case clang::Stmt::UnaryExprOrTypeTraitExprClass: |
| 3145 | 3143 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3146 | | trans_unary_expr_or_type_trait_expr(c, scope, (const UnaryExprOrTypeTraitExpr *)stmt)); |
| 3147 | | case Stmt::ForStmtClass: { |
| 3148 | | AstNode *node = trans_for_loop(c, scope, (const ForStmt *)stmt); |
| 3144 | trans_unary_expr_or_type_trait_expr(c, scope, (const clang::UnaryExprOrTypeTraitExpr *)stmt)); |
| 3145 | case clang::Stmt::ForStmtClass: { |
| 3146 | AstNode *node = trans_for_loop(c, scope, (const clang::ForStmt *)stmt); |
| 3149 | 3147 | return wrap_stmt(out_node, out_child_scope, scope, node); |
| 3150 | 3148 | } |
| 3151 | | case Stmt::StringLiteralClass: |
| 3149 | case clang::Stmt::StringLiteralClass: |
| 3152 | 3150 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3153 | | trans_string_literal(c, scope, (const StringLiteral *)stmt)); |
| 3154 | | case Stmt::BreakStmtClass: |
| 3151 | trans_string_literal(c, scope, (const clang::StringLiteral *)stmt)); |
| 3152 | case clang::Stmt::BreakStmtClass: |
| 3155 | 3153 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3156 | | trans_break_stmt(c, scope, (const BreakStmt *)stmt)); |
| 3157 | | case Stmt::ContinueStmtClass: |
| 3154 | trans_break_stmt(c, scope, (const clang::BreakStmt *)stmt)); |
| 3155 | case clang::Stmt::ContinueStmtClass: |
| 3158 | 3156 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3159 | | trans_continue_stmt(c, scope, (const ContinueStmt *)stmt)); |
| 3160 | | case Stmt::ParenExprClass: |
| 3157 | trans_continue_stmt(c, scope, (const clang::ContinueStmt *)stmt)); |
| 3158 | case clang::Stmt::ParenExprClass: |
| 3161 | 3159 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3162 | | trans_expr(c, result_used, scope, ((const ParenExpr*)stmt)->getSubExpr(), lrvalue)); |
| 3163 | | case Stmt::SwitchStmtClass: |
| 3160 | trans_expr(c, result_used, scope, ((const clang::ParenExpr*)stmt)->getSubExpr(), lrvalue)); |
| 3161 | case clang::Stmt::SwitchStmtClass: |
| 3164 | 3162 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3165 | | trans_switch_stmt(c, scope, (const SwitchStmt *)stmt)); |
| 3166 | | case Stmt::CaseStmtClass: |
| 3167 | | return trans_switch_case(c, scope, (const CaseStmt *)stmt, out_node, out_child_scope); |
| 3168 | | case Stmt::DefaultStmtClass: |
| 3169 | | return trans_switch_default(c, scope, (const DefaultStmt *)stmt, out_node, out_child_scope); |
| 3170 | | case Stmt::NoStmtClass: |
| 3163 | trans_switch_stmt(c, scope, (const clang::SwitchStmt *)stmt)); |
| 3164 | case clang::Stmt::CaseStmtClass: |
| 3165 | return trans_switch_case(c, scope, (const clang::CaseStmt *)stmt, out_node, out_child_scope); |
| 3166 | case clang::Stmt::DefaultStmtClass: |
| 3167 | return trans_switch_default(c, scope, (const clang::DefaultStmt *)stmt, out_node, out_child_scope); |
| 3168 | case clang::Stmt::NoStmtClass: |
| 3171 | 3169 | emit_warning(c, stmt->getLocStart(), "TODO handle C NoStmtClass"); |
| 3172 | 3170 | return ErrorUnexpected; |
| 3173 | | case Stmt::GCCAsmStmtClass: |
| 3171 | case clang::Stmt::GCCAsmStmtClass: |
| 3174 | 3172 | emit_warning(c, stmt->getLocStart(), "TODO handle C GCCAsmStmtClass"); |
| 3175 | 3173 | return ErrorUnexpected; |
| 3176 | | case Stmt::MSAsmStmtClass: |
| 3174 | case clang::Stmt::MSAsmStmtClass: |
| 3177 | 3175 | emit_warning(c, stmt->getLocStart(), "TODO handle C MSAsmStmtClass"); |
| 3178 | 3176 | return ErrorUnexpected; |
| 3179 | | case Stmt::AttributedStmtClass: |
| 3177 | case clang::Stmt::AttributedStmtClass: |
| 3180 | 3178 | emit_warning(c, stmt->getLocStart(), "TODO handle C AttributedStmtClass"); |
| 3181 | 3179 | return ErrorUnexpected; |
| 3182 | | case Stmt::CXXCatchStmtClass: |
| 3180 | case clang::Stmt::CXXCatchStmtClass: |
| 3183 | 3181 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXCatchStmtClass"); |
| 3184 | 3182 | return ErrorUnexpected; |
| 3185 | | case Stmt::CXXForRangeStmtClass: |
| 3183 | case clang::Stmt::CXXForRangeStmtClass: |
| 3186 | 3184 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXForRangeStmtClass"); |
| 3187 | 3185 | return ErrorUnexpected; |
| 3188 | | case Stmt::CXXTryStmtClass: |
| 3186 | case clang::Stmt::CXXTryStmtClass: |
| 3189 | 3187 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXTryStmtClass"); |
| 3190 | 3188 | return ErrorUnexpected; |
| 3191 | | case Stmt::CapturedStmtClass: |
| 3189 | case clang::Stmt::CapturedStmtClass: |
| 3192 | 3190 | emit_warning(c, stmt->getLocStart(), "TODO handle C CapturedStmtClass"); |
| 3193 | 3191 | return ErrorUnexpected; |
| 3194 | | case Stmt::CoreturnStmtClass: |
| 3192 | case clang::Stmt::CoreturnStmtClass: |
| 3195 | 3193 | emit_warning(c, stmt->getLocStart(), "TODO handle C CoreturnStmtClass"); |
| 3196 | 3194 | return ErrorUnexpected; |
| 3197 | | case Stmt::CoroutineBodyStmtClass: |
| 3195 | case clang::Stmt::CoroutineBodyStmtClass: |
| 3198 | 3196 | emit_warning(c, stmt->getLocStart(), "TODO handle C CoroutineBodyStmtClass"); |
| 3199 | 3197 | return ErrorUnexpected; |
| 3200 | | case Stmt::BinaryConditionalOperatorClass: |
| 3198 | case clang::Stmt::BinaryConditionalOperatorClass: |
| 3201 | 3199 | emit_warning(c, stmt->getLocStart(), "TODO handle C BinaryConditionalOperatorClass"); |
| 3202 | 3200 | return ErrorUnexpected; |
| 3203 | | case Stmt::AddrLabelExprClass: |
| 3201 | case clang::Stmt::AddrLabelExprClass: |
| 3204 | 3202 | emit_warning(c, stmt->getLocStart(), "TODO handle C AddrLabelExprClass"); |
| 3205 | 3203 | return ErrorUnexpected; |
| 3206 | | case Stmt::ArrayInitIndexExprClass: |
| 3204 | case clang::Stmt::ArrayInitIndexExprClass: |
| 3207 | 3205 | emit_warning(c, stmt->getLocStart(), "TODO handle C ArrayInitIndexExprClass"); |
| 3208 | 3206 | return ErrorUnexpected; |
| 3209 | | case Stmt::ArrayInitLoopExprClass: |
| 3207 | case clang::Stmt::ArrayInitLoopExprClass: |
| 3210 | 3208 | emit_warning(c, stmt->getLocStart(), "TODO handle C ArrayInitLoopExprClass"); |
| 3211 | 3209 | return ErrorUnexpected; |
| 3212 | | case Stmt::ArrayTypeTraitExprClass: |
| 3210 | case clang::Stmt::ArrayTypeTraitExprClass: |
| 3213 | 3211 | emit_warning(c, stmt->getLocStart(), "TODO handle C ArrayTypeTraitExprClass"); |
| 3214 | 3212 | return ErrorUnexpected; |
| 3215 | | case Stmt::AsTypeExprClass: |
| 3213 | case clang::Stmt::AsTypeExprClass: |
| 3216 | 3214 | emit_warning(c, stmt->getLocStart(), "TODO handle C AsTypeExprClass"); |
| 3217 | 3215 | return ErrorUnexpected; |
| 3218 | | case Stmt::AtomicExprClass: |
| 3216 | case clang::Stmt::AtomicExprClass: |
| 3219 | 3217 | emit_warning(c, stmt->getLocStart(), "TODO handle C AtomicExprClass"); |
| 3220 | 3218 | return ErrorUnexpected; |
| 3221 | | case Stmt::BlockExprClass: |
| 3219 | case clang::Stmt::BlockExprClass: |
| 3222 | 3220 | emit_warning(c, stmt->getLocStart(), "TODO handle C BlockExprClass"); |
| 3223 | 3221 | return ErrorUnexpected; |
| 3224 | | case Stmt::CXXBindTemporaryExprClass: |
| 3222 | case clang::Stmt::CXXBindTemporaryExprClass: |
| 3225 | 3223 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXBindTemporaryExprClass"); |
| 3226 | 3224 | return ErrorUnexpected; |
| 3227 | | case Stmt::CXXBoolLiteralExprClass: |
| 3225 | case clang::Stmt::CXXBoolLiteralExprClass: |
| 3228 | 3226 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXBoolLiteralExprClass"); |
| 3229 | 3227 | return ErrorUnexpected; |
| 3230 | | case Stmt::CXXConstructExprClass: |
| 3228 | case clang::Stmt::CXXConstructExprClass: |
| 3231 | 3229 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXConstructExprClass"); |
| 3232 | 3230 | return ErrorUnexpected; |
| 3233 | | case Stmt::CXXTemporaryObjectExprClass: |
| 3231 | case clang::Stmt::CXXTemporaryObjectExprClass: |
| 3234 | 3232 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXTemporaryObjectExprClass"); |
| 3235 | 3233 | return ErrorUnexpected; |
| 3236 | | case Stmt::CXXDefaultArgExprClass: |
| 3234 | case clang::Stmt::CXXDefaultArgExprClass: |
| 3237 | 3235 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXDefaultArgExprClass"); |
| 3238 | 3236 | return ErrorUnexpected; |
| 3239 | | case Stmt::CXXDefaultInitExprClass: |
| 3237 | case clang::Stmt::CXXDefaultInitExprClass: |
| 3240 | 3238 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXDefaultInitExprClass"); |
| 3241 | 3239 | return ErrorUnexpected; |
| 3242 | | case Stmt::CXXDeleteExprClass: |
| 3240 | case clang::Stmt::CXXDeleteExprClass: |
| 3243 | 3241 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXDeleteExprClass"); |
| 3244 | 3242 | return ErrorUnexpected; |
| 3245 | | case Stmt::CXXDependentScopeMemberExprClass: |
| 3243 | case clang::Stmt::CXXDependentScopeMemberExprClass: |
| 3246 | 3244 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXDependentScopeMemberExprClass"); |
| 3247 | 3245 | return ErrorUnexpected; |
| 3248 | | case Stmt::CXXFoldExprClass: |
| 3246 | case clang::Stmt::CXXFoldExprClass: |
| 3249 | 3247 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXFoldExprClass"); |
| 3250 | 3248 | return ErrorUnexpected; |
| 3251 | | case Stmt::CXXInheritedCtorInitExprClass: |
| 3249 | case clang::Stmt::CXXInheritedCtorInitExprClass: |
| 3252 | 3250 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXInheritedCtorInitExprClass"); |
| 3253 | 3251 | return ErrorUnexpected; |
| 3254 | | case Stmt::CXXNewExprClass: |
| 3252 | case clang::Stmt::CXXNewExprClass: |
| 3255 | 3253 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXNewExprClass"); |
| 3256 | 3254 | return ErrorUnexpected; |
| 3257 | | case Stmt::CXXNoexceptExprClass: |
| 3255 | case clang::Stmt::CXXNoexceptExprClass: |
| 3258 | 3256 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXNoexceptExprClass"); |
| 3259 | 3257 | return ErrorUnexpected; |
| 3260 | | case Stmt::CXXNullPtrLiteralExprClass: |
| 3258 | case clang::Stmt::CXXNullPtrLiteralExprClass: |
| 3261 | 3259 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXNullPtrLiteralExprClass"); |
| 3262 | 3260 | return ErrorUnexpected; |
| 3263 | | case Stmt::CXXPseudoDestructorExprClass: |
| 3261 | case clang::Stmt::CXXPseudoDestructorExprClass: |
| 3264 | 3262 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXPseudoDestructorExprClass"); |
| 3265 | 3263 | return ErrorUnexpected; |
| 3266 | | case Stmt::CXXScalarValueInitExprClass: |
| 3264 | case clang::Stmt::CXXScalarValueInitExprClass: |
| 3267 | 3265 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXScalarValueInitExprClass"); |
| 3268 | 3266 | return ErrorUnexpected; |
| 3269 | | case Stmt::CXXStdInitializerListExprClass: |
| 3267 | case clang::Stmt::CXXStdInitializerListExprClass: |
| 3270 | 3268 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXStdInitializerListExprClass"); |
| 3271 | 3269 | return ErrorUnexpected; |
| 3272 | | case Stmt::CXXThisExprClass: |
| 3270 | case clang::Stmt::CXXThisExprClass: |
| 3273 | 3271 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXThisExprClass"); |
| 3274 | 3272 | return ErrorUnexpected; |
| 3275 | | case Stmt::CXXThrowExprClass: |
| 3273 | case clang::Stmt::CXXThrowExprClass: |
| 3276 | 3274 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXThrowExprClass"); |
| 3277 | 3275 | return ErrorUnexpected; |
| 3278 | | case Stmt::CXXTypeidExprClass: |
| 3276 | case clang::Stmt::CXXTypeidExprClass: |
| 3279 | 3277 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXTypeidExprClass"); |
| 3280 | 3278 | return ErrorUnexpected; |
| 3281 | | case Stmt::CXXUnresolvedConstructExprClass: |
| 3279 | case clang::Stmt::CXXUnresolvedConstructExprClass: |
| 3282 | 3280 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXUnresolvedConstructExprClass"); |
| 3283 | 3281 | return ErrorUnexpected; |
| 3284 | | case Stmt::CXXUuidofExprClass: |
| 3282 | case clang::Stmt::CXXUuidofExprClass: |
| 3285 | 3283 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXUuidofExprClass"); |
| 3286 | 3284 | return ErrorUnexpected; |
| 3287 | | case Stmt::CUDAKernelCallExprClass: |
| 3285 | case clang::Stmt::CUDAKernelCallExprClass: |
| 3288 | 3286 | emit_warning(c, stmt->getLocStart(), "TODO handle C CUDAKernelCallExprClass"); |
| 3289 | 3287 | return ErrorUnexpected; |
| 3290 | | case Stmt::CXXMemberCallExprClass: |
| 3288 | case clang::Stmt::CXXMemberCallExprClass: |
| 3291 | 3289 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXMemberCallExprClass"); |
| 3292 | 3290 | return ErrorUnexpected; |
| 3293 | | case Stmt::CXXOperatorCallExprClass: |
| 3291 | case clang::Stmt::CXXOperatorCallExprClass: |
| 3294 | 3292 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXOperatorCallExprClass"); |
| 3295 | 3293 | return ErrorUnexpected; |
| 3296 | | case Stmt::UserDefinedLiteralClass: |
| 3294 | case clang::Stmt::UserDefinedLiteralClass: |
| 3297 | 3295 | emit_warning(c, stmt->getLocStart(), "TODO handle C UserDefinedLiteralClass"); |
| 3298 | 3296 | return ErrorUnexpected; |
| 3299 | | case Stmt::CXXFunctionalCastExprClass: |
| 3297 | case clang::Stmt::CXXFunctionalCastExprClass: |
| 3300 | 3298 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXFunctionalCastExprClass"); |
| 3301 | 3299 | return ErrorUnexpected; |
| 3302 | | case Stmt::CXXConstCastExprClass: |
| 3300 | case clang::Stmt::CXXConstCastExprClass: |
| 3303 | 3301 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXConstCastExprClass"); |
| 3304 | 3302 | return ErrorUnexpected; |
| 3305 | | case Stmt::CXXDynamicCastExprClass: |
| 3303 | case clang::Stmt::CXXDynamicCastExprClass: |
| 3306 | 3304 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXDynamicCastExprClass"); |
| 3307 | 3305 | return ErrorUnexpected; |
| 3308 | | case Stmt::CXXReinterpretCastExprClass: |
| 3306 | case clang::Stmt::CXXReinterpretCastExprClass: |
| 3309 | 3307 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXReinterpretCastExprClass"); |
| 3310 | 3308 | return ErrorUnexpected; |
| 3311 | | case Stmt::CXXStaticCastExprClass: |
| 3309 | case clang::Stmt::CXXStaticCastExprClass: |
| 3312 | 3310 | emit_warning(c, stmt->getLocStart(), "TODO handle C CXXStaticCastExprClass"); |
| 3313 | 3311 | return ErrorUnexpected; |
| 3314 | | case Stmt::ObjCBridgedCastExprClass: |
| 3312 | case clang::Stmt::ObjCBridgedCastExprClass: |
| 3315 | 3313 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCBridgedCastExprClass"); |
| 3316 | 3314 | return ErrorUnexpected; |
| 3317 | | case Stmt::CharacterLiteralClass: |
| 3315 | case clang::Stmt::CharacterLiteralClass: |
| 3318 | 3316 | emit_warning(c, stmt->getLocStart(), "TODO handle C CharacterLiteralClass"); |
| 3319 | 3317 | return ErrorUnexpected; |
| 3320 | | case Stmt::ChooseExprClass: |
| 3318 | case clang::Stmt::ChooseExprClass: |
| 3321 | 3319 | emit_warning(c, stmt->getLocStart(), "TODO handle C ChooseExprClass"); |
| 3322 | 3320 | return ErrorUnexpected; |
| 3323 | | case Stmt::CompoundLiteralExprClass: |
| 3321 | case clang::Stmt::CompoundLiteralExprClass: |
| 3324 | 3322 | emit_warning(c, stmt->getLocStart(), "TODO handle C CompoundLiteralExprClass"); |
| 3325 | 3323 | return ErrorUnexpected; |
| 3326 | | case Stmt::ConvertVectorExprClass: |
| 3324 | case clang::Stmt::ConvertVectorExprClass: |
| 3327 | 3325 | emit_warning(c, stmt->getLocStart(), "TODO handle C ConvertVectorExprClass"); |
| 3328 | 3326 | return ErrorUnexpected; |
| 3329 | | case Stmt::CoawaitExprClass: |
| 3327 | case clang::Stmt::CoawaitExprClass: |
| 3330 | 3328 | emit_warning(c, stmt->getLocStart(), "TODO handle C CoawaitExprClass"); |
| 3331 | 3329 | return ErrorUnexpected; |
| 3332 | | case Stmt::CoyieldExprClass: |
| 3330 | case clang::Stmt::CoyieldExprClass: |
| 3333 | 3331 | emit_warning(c, stmt->getLocStart(), "TODO handle C CoyieldExprClass"); |
| 3334 | 3332 | return ErrorUnexpected; |
| 3335 | | case Stmt::DependentCoawaitExprClass: |
| 3333 | case clang::Stmt::DependentCoawaitExprClass: |
| 3336 | 3334 | emit_warning(c, stmt->getLocStart(), "TODO handle C DependentCoawaitExprClass"); |
| 3337 | 3335 | return ErrorUnexpected; |
| 3338 | | case Stmt::DependentScopeDeclRefExprClass: |
| 3336 | case clang::Stmt::DependentScopeDeclRefExprClass: |
| 3339 | 3337 | emit_warning(c, stmt->getLocStart(), "TODO handle C DependentScopeDeclRefExprClass"); |
| 3340 | 3338 | return ErrorUnexpected; |
| 3341 | | case Stmt::DesignatedInitExprClass: |
| 3339 | case clang::Stmt::DesignatedInitExprClass: |
| 3342 | 3340 | emit_warning(c, stmt->getLocStart(), "TODO handle C DesignatedInitExprClass"); |
| 3343 | 3341 | return ErrorUnexpected; |
| 3344 | | case Stmt::DesignatedInitUpdateExprClass: |
| 3342 | case clang::Stmt::DesignatedInitUpdateExprClass: |
| 3345 | 3343 | emit_warning(c, stmt->getLocStart(), "TODO handle C DesignatedInitUpdateExprClass"); |
| 3346 | 3344 | return ErrorUnexpected; |
| 3347 | | case Stmt::ExprWithCleanupsClass: |
| 3345 | case clang::Stmt::ExprWithCleanupsClass: |
| 3348 | 3346 | emit_warning(c, stmt->getLocStart(), "TODO handle C ExprWithCleanupsClass"); |
| 3349 | 3347 | return ErrorUnexpected; |
| 3350 | | case Stmt::ExpressionTraitExprClass: |
| 3348 | case clang::Stmt::ExpressionTraitExprClass: |
| 3351 | 3349 | emit_warning(c, stmt->getLocStart(), "TODO handle C ExpressionTraitExprClass"); |
| 3352 | 3350 | return ErrorUnexpected; |
| 3353 | | case Stmt::ExtVectorElementExprClass: |
| 3351 | case clang::Stmt::ExtVectorElementExprClass: |
| 3354 | 3352 | emit_warning(c, stmt->getLocStart(), "TODO handle C ExtVectorElementExprClass"); |
| 3355 | 3353 | return ErrorUnexpected; |
| 3356 | | case Stmt::FloatingLiteralClass: |
| 3354 | case clang::Stmt::FloatingLiteralClass: |
| 3357 | 3355 | emit_warning(c, stmt->getLocStart(), "TODO handle C FloatingLiteralClass"); |
| 3358 | 3356 | return ErrorUnexpected; |
| 3359 | | case Stmt::FunctionParmPackExprClass: |
| 3357 | case clang::Stmt::FunctionParmPackExprClass: |
| 3360 | 3358 | emit_warning(c, stmt->getLocStart(), "TODO handle C FunctionParmPackExprClass"); |
| 3361 | 3359 | return ErrorUnexpected; |
| 3362 | | case Stmt::GNUNullExprClass: |
| 3360 | case clang::Stmt::GNUNullExprClass: |
| 3363 | 3361 | emit_warning(c, stmt->getLocStart(), "TODO handle C GNUNullExprClass"); |
| 3364 | 3362 | return ErrorUnexpected; |
| 3365 | | case Stmt::GenericSelectionExprClass: |
| 3363 | case clang::Stmt::GenericSelectionExprClass: |
| 3366 | 3364 | emit_warning(c, stmt->getLocStart(), "TODO handle C GenericSelectionExprClass"); |
| 3367 | 3365 | return ErrorUnexpected; |
| 3368 | | case Stmt::ImaginaryLiteralClass: |
| 3366 | case clang::Stmt::ImaginaryLiteralClass: |
| 3369 | 3367 | emit_warning(c, stmt->getLocStart(), "TODO handle C ImaginaryLiteralClass"); |
| 3370 | 3368 | return ErrorUnexpected; |
| 3371 | | case Stmt::ImplicitValueInitExprClass: |
| 3369 | case clang::Stmt::ImplicitValueInitExprClass: |
| 3372 | 3370 | emit_warning(c, stmt->getLocStart(), "TODO handle C ImplicitValueInitExprClass"); |
| 3373 | 3371 | return ErrorUnexpected; |
| 3374 | | case Stmt::InitListExprClass: |
| 3372 | case clang::Stmt::InitListExprClass: |
| 3375 | 3373 | emit_warning(c, stmt->getLocStart(), "TODO handle C InitListExprClass"); |
| 3376 | 3374 | return ErrorUnexpected; |
| 3377 | | case Stmt::LambdaExprClass: |
| 3375 | case clang::Stmt::LambdaExprClass: |
| 3378 | 3376 | emit_warning(c, stmt->getLocStart(), "TODO handle C LambdaExprClass"); |
| 3379 | 3377 | return ErrorUnexpected; |
| 3380 | | case Stmt::MSPropertyRefExprClass: |
| 3378 | case clang::Stmt::MSPropertyRefExprClass: |
| 3381 | 3379 | emit_warning(c, stmt->getLocStart(), "TODO handle C MSPropertyRefExprClass"); |
| 3382 | 3380 | return ErrorUnexpected; |
| 3383 | | case Stmt::MSPropertySubscriptExprClass: |
| 3381 | case clang::Stmt::MSPropertySubscriptExprClass: |
| 3384 | 3382 | emit_warning(c, stmt->getLocStart(), "TODO handle C MSPropertySubscriptExprClass"); |
| 3385 | 3383 | return ErrorUnexpected; |
| 3386 | | case Stmt::MaterializeTemporaryExprClass: |
| 3384 | case clang::Stmt::MaterializeTemporaryExprClass: |
| 3387 | 3385 | emit_warning(c, stmt->getLocStart(), "TODO handle C MaterializeTemporaryExprClass"); |
| 3388 | 3386 | return ErrorUnexpected; |
| 3389 | | case Stmt::NoInitExprClass: |
| 3387 | case clang::Stmt::NoInitExprClass: |
| 3390 | 3388 | emit_warning(c, stmt->getLocStart(), "TODO handle C NoInitExprClass"); |
| 3391 | 3389 | return ErrorUnexpected; |
| 3392 | | case Stmt::OMPArraySectionExprClass: |
| 3390 | case clang::Stmt::OMPArraySectionExprClass: |
| 3393 | 3391 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPArraySectionExprClass"); |
| 3394 | 3392 | return ErrorUnexpected; |
| 3395 | | case Stmt::ObjCArrayLiteralClass: |
| 3393 | case clang::Stmt::ObjCArrayLiteralClass: |
| 3396 | 3394 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCArrayLiteralClass"); |
| 3397 | 3395 | return ErrorUnexpected; |
| 3398 | | case Stmt::ObjCAvailabilityCheckExprClass: |
| 3396 | case clang::Stmt::ObjCAvailabilityCheckExprClass: |
| 3399 | 3397 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCAvailabilityCheckExprClass"); |
| 3400 | 3398 | return ErrorUnexpected; |
| 3401 | | case Stmt::ObjCBoolLiteralExprClass: |
| 3399 | case clang::Stmt::ObjCBoolLiteralExprClass: |
| 3402 | 3400 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCBoolLiteralExprClass"); |
| 3403 | 3401 | return ErrorUnexpected; |
| 3404 | | case Stmt::ObjCBoxedExprClass: |
| 3402 | case clang::Stmt::ObjCBoxedExprClass: |
| 3405 | 3403 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCBoxedExprClass"); |
| 3406 | 3404 | return ErrorUnexpected; |
| 3407 | | case Stmt::ObjCDictionaryLiteralClass: |
| 3405 | case clang::Stmt::ObjCDictionaryLiteralClass: |
| 3408 | 3406 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCDictionaryLiteralClass"); |
| 3409 | 3407 | return ErrorUnexpected; |
| 3410 | | case Stmt::ObjCEncodeExprClass: |
| 3408 | case clang::Stmt::ObjCEncodeExprClass: |
| 3411 | 3409 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCEncodeExprClass"); |
| 3412 | 3410 | return ErrorUnexpected; |
| 3413 | | case Stmt::ObjCIndirectCopyRestoreExprClass: |
| 3411 | case clang::Stmt::ObjCIndirectCopyRestoreExprClass: |
| 3414 | 3412 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCIndirectCopyRestoreExprClass"); |
| 3415 | 3413 | return ErrorUnexpected; |
| 3416 | | case Stmt::ObjCIsaExprClass: |
| 3414 | case clang::Stmt::ObjCIsaExprClass: |
| 3417 | 3415 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCIsaExprClass"); |
| 3418 | 3416 | return ErrorUnexpected; |
| 3419 | | case Stmt::ObjCIvarRefExprClass: |
| 3417 | case clang::Stmt::ObjCIvarRefExprClass: |
| 3420 | 3418 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCIvarRefExprClass"); |
| 3421 | 3419 | return ErrorUnexpected; |
| 3422 | | case Stmt::ObjCMessageExprClass: |
| 3420 | case clang::Stmt::ObjCMessageExprClass: |
| 3423 | 3421 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCMessageExprClass"); |
| 3424 | 3422 | return ErrorUnexpected; |
| 3425 | | case Stmt::ObjCPropertyRefExprClass: |
| 3423 | case clang::Stmt::ObjCPropertyRefExprClass: |
| 3426 | 3424 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCPropertyRefExprClass"); |
| 3427 | 3425 | return ErrorUnexpected; |
| 3428 | | case Stmt::ObjCProtocolExprClass: |
| 3426 | case clang::Stmt::ObjCProtocolExprClass: |
| 3429 | 3427 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCProtocolExprClass"); |
| 3430 | 3428 | return ErrorUnexpected; |
| 3431 | | case Stmt::ObjCSelectorExprClass: |
| 3429 | case clang::Stmt::ObjCSelectorExprClass: |
| 3432 | 3430 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCSelectorExprClass"); |
| 3433 | 3431 | return ErrorUnexpected; |
| 3434 | | case Stmt::ObjCStringLiteralClass: |
| 3432 | case clang::Stmt::ObjCStringLiteralClass: |
| 3435 | 3433 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCStringLiteralClass"); |
| 3436 | 3434 | return ErrorUnexpected; |
| 3437 | | case Stmt::ObjCSubscriptRefExprClass: |
| 3435 | case clang::Stmt::ObjCSubscriptRefExprClass: |
| 3438 | 3436 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCSubscriptRefExprClass"); |
| 3439 | 3437 | return ErrorUnexpected; |
| 3440 | | case Stmt::OffsetOfExprClass: |
| 3438 | case clang::Stmt::OffsetOfExprClass: |
| 3441 | 3439 | emit_warning(c, stmt->getLocStart(), "TODO handle C OffsetOfExprClass"); |
| 3442 | 3440 | return ErrorUnexpected; |
| 3443 | | case Stmt::OpaqueValueExprClass: |
| 3441 | case clang::Stmt::OpaqueValueExprClass: |
| 3444 | 3442 | emit_warning(c, stmt->getLocStart(), "TODO handle C OpaqueValueExprClass"); |
| 3445 | 3443 | return ErrorUnexpected; |
| 3446 | | case Stmt::UnresolvedLookupExprClass: |
| 3444 | case clang::Stmt::UnresolvedLookupExprClass: |
| 3447 | 3445 | emit_warning(c, stmt->getLocStart(), "TODO handle C UnresolvedLookupExprClass"); |
| 3448 | 3446 | return ErrorUnexpected; |
| 3449 | | case Stmt::UnresolvedMemberExprClass: |
| 3447 | case clang::Stmt::UnresolvedMemberExprClass: |
| 3450 | 3448 | emit_warning(c, stmt->getLocStart(), "TODO handle C UnresolvedMemberExprClass"); |
| 3451 | 3449 | return ErrorUnexpected; |
| 3452 | | case Stmt::PackExpansionExprClass: |
| 3450 | case clang::Stmt::PackExpansionExprClass: |
| 3453 | 3451 | emit_warning(c, stmt->getLocStart(), "TODO handle C PackExpansionExprClass"); |
| 3454 | 3452 | return ErrorUnexpected; |
| 3455 | | case Stmt::ParenListExprClass: |
| 3453 | case clang::Stmt::ParenListExprClass: |
| 3456 | 3454 | emit_warning(c, stmt->getLocStart(), "TODO handle C ParenListExprClass"); |
| 3457 | 3455 | return ErrorUnexpected; |
| 3458 | | case Stmt::PredefinedExprClass: |
| 3456 | case clang::Stmt::PredefinedExprClass: |
| 3459 | 3457 | emit_warning(c, stmt->getLocStart(), "TODO handle C PredefinedExprClass"); |
| 3460 | 3458 | return ErrorUnexpected; |
| 3461 | | case Stmt::PseudoObjectExprClass: |
| 3459 | case clang::Stmt::PseudoObjectExprClass: |
| 3462 | 3460 | emit_warning(c, stmt->getLocStart(), "TODO handle C PseudoObjectExprClass"); |
| 3463 | 3461 | return ErrorUnexpected; |
| 3464 | | case Stmt::ShuffleVectorExprClass: |
| 3462 | case clang::Stmt::ShuffleVectorExprClass: |
| 3465 | 3463 | emit_warning(c, stmt->getLocStart(), "TODO handle C ShuffleVectorExprClass"); |
| 3466 | 3464 | return ErrorUnexpected; |
| 3467 | | case Stmt::SizeOfPackExprClass: |
| 3465 | case clang::Stmt::SizeOfPackExprClass: |
| 3468 | 3466 | emit_warning(c, stmt->getLocStart(), "TODO handle C SizeOfPackExprClass"); |
| 3469 | 3467 | return ErrorUnexpected; |
| 3470 | | case Stmt::StmtExprClass: |
| 3468 | case clang::Stmt::StmtExprClass: |
| 3471 | 3469 | emit_warning(c, stmt->getLocStart(), "TODO handle C StmtExprClass"); |
| 3472 | 3470 | return ErrorUnexpected; |
| 3473 | | case Stmt::SubstNonTypeTemplateParmExprClass: |
| 3471 | case clang::Stmt::SubstNonTypeTemplateParmExprClass: |
| 3474 | 3472 | emit_warning(c, stmt->getLocStart(), "TODO handle C SubstNonTypeTemplateParmExprClass"); |
| 3475 | 3473 | return ErrorUnexpected; |
| 3476 | | case Stmt::SubstNonTypeTemplateParmPackExprClass: |
| 3474 | case clang::Stmt::SubstNonTypeTemplateParmPackExprClass: |
| 3477 | 3475 | emit_warning(c, stmt->getLocStart(), "TODO handle C SubstNonTypeTemplateParmPackExprClass"); |
| 3478 | 3476 | return ErrorUnexpected; |
| 3479 | | case Stmt::TypeTraitExprClass: |
| 3477 | case clang::Stmt::TypeTraitExprClass: |
| 3480 | 3478 | emit_warning(c, stmt->getLocStart(), "TODO handle C TypeTraitExprClass"); |
| 3481 | 3479 | return ErrorUnexpected; |
| 3482 | | case Stmt::TypoExprClass: |
| 3480 | case clang::Stmt::TypoExprClass: |
| 3483 | 3481 | emit_warning(c, stmt->getLocStart(), "TODO handle C TypoExprClass"); |
| 3484 | 3482 | return ErrorUnexpected; |
| 3485 | | case Stmt::VAArgExprClass: |
| 3483 | case clang::Stmt::VAArgExprClass: |
| 3486 | 3484 | emit_warning(c, stmt->getLocStart(), "TODO handle C VAArgExprClass"); |
| 3487 | 3485 | return ErrorUnexpected; |
| 3488 | | case Stmt::GotoStmtClass: |
| 3486 | case clang::Stmt::GotoStmtClass: |
| 3489 | 3487 | emit_warning(c, stmt->getLocStart(), "TODO handle C GotoStmtClass"); |
| 3490 | 3488 | return ErrorUnexpected; |
| 3491 | | case Stmt::IndirectGotoStmtClass: |
| 3489 | case clang::Stmt::IndirectGotoStmtClass: |
| 3492 | 3490 | emit_warning(c, stmt->getLocStart(), "TODO handle C IndirectGotoStmtClass"); |
| 3493 | 3491 | return ErrorUnexpected; |
| 3494 | | case Stmt::LabelStmtClass: |
| 3492 | case clang::Stmt::LabelStmtClass: |
| 3495 | 3493 | emit_warning(c, stmt->getLocStart(), "TODO handle C LabelStmtClass"); |
| 3496 | 3494 | return ErrorUnexpected; |
| 3497 | | case Stmt::MSDependentExistsStmtClass: |
| 3495 | case clang::Stmt::MSDependentExistsStmtClass: |
| 3498 | 3496 | emit_warning(c, stmt->getLocStart(), "TODO handle C MSDependentExistsStmtClass"); |
| 3499 | 3497 | return ErrorUnexpected; |
| 3500 | | case Stmt::OMPAtomicDirectiveClass: |
| 3498 | case clang::Stmt::OMPAtomicDirectiveClass: |
| 3501 | 3499 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPAtomicDirectiveClass"); |
| 3502 | 3500 | return ErrorUnexpected; |
| 3503 | | case Stmt::OMPBarrierDirectiveClass: |
| 3501 | case clang::Stmt::OMPBarrierDirectiveClass: |
| 3504 | 3502 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPBarrierDirectiveClass"); |
| 3505 | 3503 | return ErrorUnexpected; |
| 3506 | | case Stmt::OMPCancelDirectiveClass: |
| 3504 | case clang::Stmt::OMPCancelDirectiveClass: |
| 3507 | 3505 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPCancelDirectiveClass"); |
| 3508 | 3506 | return ErrorUnexpected; |
| 3509 | | case Stmt::OMPCancellationPointDirectiveClass: |
| 3507 | case clang::Stmt::OMPCancellationPointDirectiveClass: |
| 3510 | 3508 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPCancellationPointDirectiveClass"); |
| 3511 | 3509 | return ErrorUnexpected; |
| 3512 | | case Stmt::OMPCriticalDirectiveClass: |
| 3510 | case clang::Stmt::OMPCriticalDirectiveClass: |
| 3513 | 3511 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPCriticalDirectiveClass"); |
| 3514 | 3512 | return ErrorUnexpected; |
| 3515 | | case Stmt::OMPFlushDirectiveClass: |
| 3513 | case clang::Stmt::OMPFlushDirectiveClass: |
| 3516 | 3514 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPFlushDirectiveClass"); |
| 3517 | 3515 | return ErrorUnexpected; |
| 3518 | | case Stmt::OMPDistributeDirectiveClass: |
| 3516 | case clang::Stmt::OMPDistributeDirectiveClass: |
| 3519 | 3517 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPDistributeDirectiveClass"); |
| 3520 | 3518 | return ErrorUnexpected; |
| 3521 | | case Stmt::OMPDistributeParallelForDirectiveClass: |
| 3519 | case clang::Stmt::OMPDistributeParallelForDirectiveClass: |
| 3522 | 3520 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPDistributeParallelForDirectiveClass"); |
| 3523 | 3521 | return ErrorUnexpected; |
| 3524 | | case Stmt::OMPDistributeParallelForSimdDirectiveClass: |
| 3522 | case clang::Stmt::OMPDistributeParallelForSimdDirectiveClass: |
| 3525 | 3523 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPDistributeParallelForSimdDirectiveClass"); |
| 3526 | 3524 | return ErrorUnexpected; |
| 3527 | | case Stmt::OMPDistributeSimdDirectiveClass: |
| 3525 | case clang::Stmt::OMPDistributeSimdDirectiveClass: |
| 3528 | 3526 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPDistributeSimdDirectiveClass"); |
| 3529 | 3527 | return ErrorUnexpected; |
| 3530 | | case Stmt::OMPForDirectiveClass: |
| 3528 | case clang::Stmt::OMPForDirectiveClass: |
| 3531 | 3529 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPForDirectiveClass"); |
| 3532 | 3530 | return ErrorUnexpected; |
| 3533 | | case Stmt::OMPForSimdDirectiveClass: |
| 3531 | case clang::Stmt::OMPForSimdDirectiveClass: |
| 3534 | 3532 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPForSimdDirectiveClass"); |
| 3535 | 3533 | return ErrorUnexpected; |
| 3536 | | case Stmt::OMPParallelForDirectiveClass: |
| 3534 | case clang::Stmt::OMPParallelForDirectiveClass: |
| 3537 | 3535 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPParallelForDirectiveClass"); |
| 3538 | 3536 | return ErrorUnexpected; |
| 3539 | | case Stmt::OMPParallelForSimdDirectiveClass: |
| 3537 | case clang::Stmt::OMPParallelForSimdDirectiveClass: |
| 3540 | 3538 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPParallelForSimdDirectiveClass"); |
| 3541 | 3539 | return ErrorUnexpected; |
| 3542 | | case Stmt::OMPSimdDirectiveClass: |
| 3540 | case clang::Stmt::OMPSimdDirectiveClass: |
| 3543 | 3541 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPSimdDirectiveClass"); |
| 3544 | 3542 | return ErrorUnexpected; |
| 3545 | | case Stmt::OMPTargetParallelForSimdDirectiveClass: |
| 3543 | case clang::Stmt::OMPTargetParallelForSimdDirectiveClass: |
| 3546 | 3544 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetParallelForSimdDirectiveClass"); |
| 3547 | 3545 | return ErrorUnexpected; |
| 3548 | | case Stmt::OMPTargetSimdDirectiveClass: |
| 3546 | case clang::Stmt::OMPTargetSimdDirectiveClass: |
| 3549 | 3547 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetSimdDirectiveClass"); |
| 3550 | 3548 | return ErrorUnexpected; |
| 3551 | | case Stmt::OMPTargetTeamsDistributeDirectiveClass: |
| 3549 | case clang::Stmt::OMPTargetTeamsDistributeDirectiveClass: |
| 3552 | 3550 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetTeamsDistributeDirectiveClass"); |
| 3553 | 3551 | return ErrorUnexpected; |
| 3554 | | case Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass: |
| 3552 | case clang::Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass: |
| 3555 | 3553 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetTeamsDistributeParallelForDirectiveClass"); |
| 3556 | 3554 | return ErrorUnexpected; |
| 3557 | | case Stmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass: |
| 3555 | case clang::Stmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass: |
| 3558 | 3556 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetTeamsDistributeParallelForSimdDirectiveClass"); |
| 3559 | 3557 | return ErrorUnexpected; |
| 3560 | | case Stmt::OMPTargetTeamsDistributeSimdDirectiveClass: |
| 3558 | case clang::Stmt::OMPTargetTeamsDistributeSimdDirectiveClass: |
| 3561 | 3559 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetTeamsDistributeSimdDirectiveClass"); |
| 3562 | 3560 | return ErrorUnexpected; |
| 3563 | | case Stmt::OMPTaskLoopDirectiveClass: |
| 3561 | case clang::Stmt::OMPTaskLoopDirectiveClass: |
| 3564 | 3562 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTaskLoopDirectiveClass"); |
| 3565 | 3563 | return ErrorUnexpected; |
| 3566 | | case Stmt::OMPTaskLoopSimdDirectiveClass: |
| 3564 | case clang::Stmt::OMPTaskLoopSimdDirectiveClass: |
| 3567 | 3565 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTaskLoopSimdDirectiveClass"); |
| 3568 | 3566 | return ErrorUnexpected; |
| 3569 | | case Stmt::OMPTeamsDistributeDirectiveClass: |
| 3567 | case clang::Stmt::OMPTeamsDistributeDirectiveClass: |
| 3570 | 3568 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTeamsDistributeDirectiveClass"); |
| 3571 | 3569 | return ErrorUnexpected; |
| 3572 | | case Stmt::OMPTeamsDistributeParallelForDirectiveClass: |
| 3570 | case clang::Stmt::OMPTeamsDistributeParallelForDirectiveClass: |
| 3573 | 3571 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTeamsDistributeParallelForDirectiveClass"); |
| 3574 | 3572 | return ErrorUnexpected; |
| 3575 | | case Stmt::OMPTeamsDistributeParallelForSimdDirectiveClass: |
| 3573 | case clang::Stmt::OMPTeamsDistributeParallelForSimdDirectiveClass: |
| 3576 | 3574 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTeamsDistributeParallelForSimdDirectiveClass"); |
| 3577 | 3575 | return ErrorUnexpected; |
| 3578 | | case Stmt::OMPTeamsDistributeSimdDirectiveClass: |
| 3576 | case clang::Stmt::OMPTeamsDistributeSimdDirectiveClass: |
| 3579 | 3577 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTeamsDistributeSimdDirectiveClass"); |
| 3580 | 3578 | return ErrorUnexpected; |
| 3581 | | case Stmt::OMPMasterDirectiveClass: |
| 3579 | case clang::Stmt::OMPMasterDirectiveClass: |
| 3582 | 3580 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPMasterDirectiveClass"); |
| 3583 | 3581 | return ErrorUnexpected; |
| 3584 | | case Stmt::OMPOrderedDirectiveClass: |
| 3582 | case clang::Stmt::OMPOrderedDirectiveClass: |
| 3585 | 3583 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPOrderedDirectiveClass"); |
| 3586 | 3584 | return ErrorUnexpected; |
| 3587 | | case Stmt::OMPParallelDirectiveClass: |
| 3585 | case clang::Stmt::OMPParallelDirectiveClass: |
| 3588 | 3586 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPParallelDirectiveClass"); |
| 3589 | 3587 | return ErrorUnexpected; |
| 3590 | | case Stmt::OMPParallelSectionsDirectiveClass: |
| 3588 | case clang::Stmt::OMPParallelSectionsDirectiveClass: |
| 3591 | 3589 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPParallelSectionsDirectiveClass"); |
| 3592 | 3590 | return ErrorUnexpected; |
| 3593 | | case Stmt::OMPSectionDirectiveClass: |
| 3591 | case clang::Stmt::OMPSectionDirectiveClass: |
| 3594 | 3592 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPSectionDirectiveClass"); |
| 3595 | 3593 | return ErrorUnexpected; |
| 3596 | | case Stmt::OMPSectionsDirectiveClass: |
| 3594 | case clang::Stmt::OMPSectionsDirectiveClass: |
| 3597 | 3595 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPSectionsDirectiveClass"); |
| 3598 | 3596 | return ErrorUnexpected; |
| 3599 | | case Stmt::OMPSingleDirectiveClass: |
| 3597 | case clang::Stmt::OMPSingleDirectiveClass: |
| 3600 | 3598 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPSingleDirectiveClass"); |
| 3601 | 3599 | return ErrorUnexpected; |
| 3602 | | case Stmt::OMPTargetDataDirectiveClass: |
| 3600 | case clang::Stmt::OMPTargetDataDirectiveClass: |
| 3603 | 3601 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetDataDirectiveClass"); |
| 3604 | 3602 | return ErrorUnexpected; |
| 3605 | | case Stmt::OMPTargetDirectiveClass: |
| 3603 | case clang::Stmt::OMPTargetDirectiveClass: |
| 3606 | 3604 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetDirectiveClass"); |
| 3607 | 3605 | return ErrorUnexpected; |
| 3608 | | case Stmt::OMPTargetEnterDataDirectiveClass: |
| 3606 | case clang::Stmt::OMPTargetEnterDataDirectiveClass: |
| 3609 | 3607 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetEnterDataDirectiveClass"); |
| 3610 | 3608 | return ErrorUnexpected; |
| 3611 | | case Stmt::OMPTargetExitDataDirectiveClass: |
| 3609 | case clang::Stmt::OMPTargetExitDataDirectiveClass: |
| 3612 | 3610 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetExitDataDirectiveClass"); |
| 3613 | 3611 | return ErrorUnexpected; |
| 3614 | | case Stmt::OMPTargetParallelDirectiveClass: |
| 3612 | case clang::Stmt::OMPTargetParallelDirectiveClass: |
| 3615 | 3613 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetParallelDirectiveClass"); |
| 3616 | 3614 | return ErrorUnexpected; |
| 3617 | | case Stmt::OMPTargetParallelForDirectiveClass: |
| 3615 | case clang::Stmt::OMPTargetParallelForDirectiveClass: |
| 3618 | 3616 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetParallelForDirectiveClass"); |
| 3619 | 3617 | return ErrorUnexpected; |
| 3620 | | case Stmt::OMPTargetTeamsDirectiveClass: |
| 3618 | case clang::Stmt::OMPTargetTeamsDirectiveClass: |
| 3621 | 3619 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetTeamsDirectiveClass"); |
| 3622 | 3620 | return ErrorUnexpected; |
| 3623 | | case Stmt::OMPTargetUpdateDirectiveClass: |
| 3621 | case clang::Stmt::OMPTargetUpdateDirectiveClass: |
| 3624 | 3622 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTargetUpdateDirectiveClass"); |
| 3625 | 3623 | return ErrorUnexpected; |
| 3626 | | case Stmt::OMPTaskDirectiveClass: |
| 3624 | case clang::Stmt::OMPTaskDirectiveClass: |
| 3627 | 3625 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTaskDirectiveClass"); |
| 3628 | 3626 | return ErrorUnexpected; |
| 3629 | | case Stmt::OMPTaskgroupDirectiveClass: |
| 3627 | case clang::Stmt::OMPTaskgroupDirectiveClass: |
| 3630 | 3628 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTaskgroupDirectiveClass"); |
| 3631 | 3629 | return ErrorUnexpected; |
| 3632 | | case Stmt::OMPTaskwaitDirectiveClass: |
| 3630 | case clang::Stmt::OMPTaskwaitDirectiveClass: |
| 3633 | 3631 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTaskwaitDirectiveClass"); |
| 3634 | 3632 | return ErrorUnexpected; |
| 3635 | | case Stmt::OMPTaskyieldDirectiveClass: |
| 3633 | case clang::Stmt::OMPTaskyieldDirectiveClass: |
| 3636 | 3634 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTaskyieldDirectiveClass"); |
| 3637 | 3635 | return ErrorUnexpected; |
| 3638 | | case Stmt::OMPTeamsDirectiveClass: |
| 3636 | case clang::Stmt::OMPTeamsDirectiveClass: |
| 3639 | 3637 | emit_warning(c, stmt->getLocStart(), "TODO handle C OMPTeamsDirectiveClass"); |
| 3640 | 3638 | return ErrorUnexpected; |
| 3641 | | case Stmt::ObjCAtCatchStmtClass: |
| 3639 | case clang::Stmt::ObjCAtCatchStmtClass: |
| 3642 | 3640 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCAtCatchStmtClass"); |
| 3643 | 3641 | return ErrorUnexpected; |
| 3644 | | case Stmt::ObjCAtFinallyStmtClass: |
| 3642 | case clang::Stmt::ObjCAtFinallyStmtClass: |
| 3645 | 3643 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCAtFinallyStmtClass"); |
| 3646 | 3644 | return ErrorUnexpected; |
| 3647 | | case Stmt::ObjCAtSynchronizedStmtClass: |
| 3645 | case clang::Stmt::ObjCAtSynchronizedStmtClass: |
| 3648 | 3646 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCAtSynchronizedStmtClass"); |
| 3649 | 3647 | return ErrorUnexpected; |
| 3650 | | case Stmt::ObjCAtThrowStmtClass: |
| 3648 | case clang::Stmt::ObjCAtThrowStmtClass: |
| 3651 | 3649 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCAtThrowStmtClass"); |
| 3652 | 3650 | return ErrorUnexpected; |
| 3653 | | case Stmt::ObjCAtTryStmtClass: |
| 3651 | case clang::Stmt::ObjCAtTryStmtClass: |
| 3654 | 3652 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCAtTryStmtClass"); |
| 3655 | 3653 | return ErrorUnexpected; |
| 3656 | | case Stmt::ObjCAutoreleasePoolStmtClass: |
| 3654 | case clang::Stmt::ObjCAutoreleasePoolStmtClass: |
| 3657 | 3655 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCAutoreleasePoolStmtClass"); |
| 3658 | 3656 | return ErrorUnexpected; |
| 3659 | | case Stmt::ObjCForCollectionStmtClass: |
| 3657 | case clang::Stmt::ObjCForCollectionStmtClass: |
| 3660 | 3658 | emit_warning(c, stmt->getLocStart(), "TODO handle C ObjCForCollectionStmtClass"); |
| 3661 | 3659 | return ErrorUnexpected; |
| 3662 | | case Stmt::SEHExceptStmtClass: |
| 3660 | case clang::Stmt::SEHExceptStmtClass: |
| 3663 | 3661 | emit_warning(c, stmt->getLocStart(), "TODO handle C SEHExceptStmtClass"); |
| 3664 | 3662 | return ErrorUnexpected; |
| 3665 | | case Stmt::SEHFinallyStmtClass: |
| 3663 | case clang::Stmt::SEHFinallyStmtClass: |
| 3666 | 3664 | emit_warning(c, stmt->getLocStart(), "TODO handle C SEHFinallyStmtClass"); |
| 3667 | 3665 | return ErrorUnexpected; |
| 3668 | | case Stmt::SEHLeaveStmtClass: |
| 3666 | case clang::Stmt::SEHLeaveStmtClass: |
| 3669 | 3667 | emit_warning(c, stmt->getLocStart(), "TODO handle C SEHLeaveStmtClass"); |
| 3670 | 3668 | return ErrorUnexpected; |
| 3671 | | case Stmt::SEHTryStmtClass: |
| 3669 | case clang::Stmt::SEHTryStmtClass: |
| 3672 | 3670 | emit_warning(c, stmt->getLocStart(), "TODO handle C SEHTryStmtClass"); |
| 3673 | 3671 | return ErrorUnexpected; |
| 3674 | | case Stmt::FixedPointLiteralClass: |
| 3672 | case clang::Stmt::FixedPointLiteralClass: |
| 3675 | 3673 | emit_warning(c, stmt->getLocStart(), "TODO handle C FixedPointLiteralClass"); |
| 3676 | 3674 | return ErrorUnexpected; |
| 3677 | 3675 | } |
| ... | ... | @@ -3679,7 +3677,7 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const Stmt *stmt, |
| 3679 | 3677 | } |
| 3680 | 3678 | |
| 3681 | 3679 | // Returns null if there was an error |
| 3682 | | static AstNode *trans_expr(Context *c, ResultUsed result_used, TransScope *scope, const Expr *expr, |
| 3680 | static AstNode *trans_expr(Context *c, ResultUsed result_used, TransScope *scope, const clang::Expr *expr, |
| 3683 | 3681 | TransLRValue lrval) |
| 3684 | 3682 | { |
| 3685 | 3683 | AstNode *result_node; |
| ... | ... | @@ -3692,7 +3690,7 @@ static AstNode *trans_expr(Context *c, ResultUsed result_used, TransScope *scope |
| 3692 | 3690 | |
| 3693 | 3691 | // Statements have no result and no concept of L or R value. |
| 3694 | 3692 | // Returns child scope, or null if there was an error |
| 3695 | | static TransScope *trans_stmt(Context *c, TransScope *scope, const Stmt *stmt, AstNode **out_node) { |
| 3693 | static TransScope *trans_stmt(Context *c, TransScope *scope, const clang::Stmt *stmt, AstNode **out_node) { |
| 3696 | 3694 | TransScope *child_scope; |
| 3697 | 3695 | if (trans_stmt_extra(c, scope, stmt, ResultUsedNo, TransRValue, out_node, &child_scope, nullptr)) { |
| 3698 | 3696 | return nullptr; |
| ... | ... | @@ -3700,7 +3698,7 @@ static TransScope *trans_stmt(Context *c, TransScope *scope, const Stmt *stmt, A |
| 3700 | 3698 | return child_scope; |
| 3701 | 3699 | } |
| 3702 | 3700 | |
| 3703 | | static void visit_fn_decl(Context *c, const FunctionDecl *fn_decl) { |
| 3701 | static void visit_fn_decl(Context *c, const clang::FunctionDecl *fn_decl) { |
| 3704 | 3702 | Buf *fn_name = buf_create_from_str(decl_name(fn_decl)); |
| 3705 | 3703 | |
| 3706 | 3704 | if (get_global(c, fn_name)) { |
| ... | ... | @@ -3717,13 +3715,13 @@ static void visit_fn_decl(Context *c, const FunctionDecl *fn_decl) { |
| 3717 | 3715 | proto_node->data.fn_proto.name = fn_name; |
| 3718 | 3716 | proto_node->data.fn_proto.is_extern = !fn_decl->hasBody(); |
| 3719 | 3717 | |
| 3720 | | StorageClass sc = fn_decl->getStorageClass(); |
| 3721 | | if (sc == SC_None) { |
| 3718 | clang::StorageClass sc = fn_decl->getStorageClass(); |
| 3719 | if (sc == clang::SC_None) { |
| 3722 | 3720 | proto_node->data.fn_proto.visib_mod = c->visib_mod; |
| 3723 | 3721 | proto_node->data.fn_proto.is_export = fn_decl->hasBody() ? c->want_export : false; |
| 3724 | | } else if (sc == SC_Extern || sc == SC_Static) { |
| 3722 | } else if (sc == clang::SC_Extern || sc == clang::SC_Static) { |
| 3725 | 3723 | proto_node->data.fn_proto.visib_mod = c->visib_mod; |
| 3726 | | } else if (sc == SC_PrivateExtern) { |
| 3724 | } else if (sc == clang::SC_PrivateExtern) { |
| 3727 | 3725 | emit_warning(c, fn_decl->getLocation(), "unsupported storage class: private extern"); |
| 3728 | 3726 | return; |
| 3729 | 3727 | } else { |
| ... | ... | @@ -3735,7 +3733,7 @@ static void visit_fn_decl(Context *c, const FunctionDecl *fn_decl) { |
| 3735 | 3733 | |
| 3736 | 3734 | for (size_t i = 0; i < proto_node->data.fn_proto.params.length; i += 1) { |
| 3737 | 3735 | AstNode *param_node = proto_node->data.fn_proto.params.at(i); |
| 3738 | | const ParmVarDecl *param = fn_decl->getParamDecl(i); |
| 3736 | const clang::ParmVarDecl *param = fn_decl->getParamDecl(i); |
| 3739 | 3737 | const char *name = decl_name(param); |
| 3740 | 3738 | |
| 3741 | 3739 | Buf *proto_param_name; |
| ... | ... | @@ -3762,7 +3760,7 @@ static void visit_fn_decl(Context *c, const FunctionDecl *fn_decl) { |
| 3762 | 3760 | |
| 3763 | 3761 | // actual function definition with body |
| 3764 | 3762 | c->ptr_params.clear(); |
| 3765 | | Stmt *body = fn_decl->getBody(); |
| 3763 | clang::Stmt *body = fn_decl->getBody(); |
| 3766 | 3764 | AstNode *actual_body_node; |
| 3767 | 3765 | TransScope *result_scope = trans_stmt(c, scope, body, &actual_body_node); |
| 3768 | 3766 | if (result_scope == nullptr) { |
| ... | ... | @@ -3804,19 +3802,19 @@ static void visit_fn_decl(Context *c, const FunctionDecl *fn_decl) { |
| 3804 | 3802 | add_top_level_decl(c, fn_def_node->data.fn_def.fn_proto->data.fn_proto.name, fn_def_node); |
| 3805 | 3803 | } |
| 3806 | 3804 | |
| 3807 | | static AstNode *resolve_typdef_as_builtin(Context *c, const TypedefNameDecl *typedef_decl, const char *primitive_name) { |
| 3805 | static AstNode *resolve_typdef_as_builtin(Context *c, const clang::TypedefNameDecl *typedef_decl, const char *primitive_name) { |
| 3808 | 3806 | AstNode *node = trans_create_node_symbol_str(c, primitive_name); |
| 3809 | 3807 | c->decl_table.put(typedef_decl, node); |
| 3810 | 3808 | return node; |
| 3811 | 3809 | } |
| 3812 | 3810 | |
| 3813 | | static AstNode *resolve_typedef_decl(Context *c, const TypedefNameDecl *typedef_decl) { |
| 3811 | static AstNode *resolve_typedef_decl(Context *c, const clang::TypedefNameDecl *typedef_decl) { |
| 3814 | 3812 | auto existing_entry = c->decl_table.maybe_get((void*)typedef_decl->getCanonicalDecl()); |
| 3815 | 3813 | if (existing_entry) { |
| 3816 | 3814 | return existing_entry->value; |
| 3817 | 3815 | } |
| 3818 | 3816 | |
| 3819 | | QualType child_qt = typedef_decl->getUnderlyingType(); |
| 3817 | clang::QualType child_qt = typedef_decl->getUnderlyingType(); |
| 3820 | 3818 | Buf *type_name = buf_create_from_str(decl_name(typedef_decl)); |
| 3821 | 3819 | |
| 3822 | 3820 | if (buf_eql_str(type_name, "uint8_t")) { |
| ... | ... | @@ -3865,7 +3863,7 @@ static AstNode *resolve_typedef_decl(Context *c, const TypedefNameDecl *typedef_ |
| 3865 | 3863 | return symbol_node; |
| 3866 | 3864 | } |
| 3867 | 3865 | |
| 3868 | | struct AstNode *demote_enum_to_opaque(Context *c, const EnumDecl *enum_decl, |
| 3866 | struct AstNode *demote_enum_to_opaque(Context *c, const clang::EnumDecl *enum_decl, |
| 3869 | 3867 | Buf *full_type_name, Buf *bare_name) |
| 3870 | 3868 | { |
| 3871 | 3869 | AstNode *opaque_node = trans_create_node_opaque(c); |
| ... | ... | @@ -3880,7 +3878,7 @@ struct AstNode *demote_enum_to_opaque(Context *c, const EnumDecl *enum_decl, |
| 3880 | 3878 | return symbol_node; |
| 3881 | 3879 | } |
| 3882 | 3880 | |
| 3883 | | static AstNode *resolve_enum_decl(Context *c, const EnumDecl *enum_decl) { |
| 3881 | static AstNode *resolve_enum_decl(Context *c, const clang::EnumDecl *enum_decl) { |
| 3884 | 3882 | auto existing_entry = c->decl_table.maybe_get((void*)enum_decl->getCanonicalDecl()); |
| 3885 | 3883 | if (existing_entry) { |
| 3886 | 3884 | return existing_entry->value; |
| ... | ... | @@ -3891,7 +3889,7 @@ static AstNode *resolve_enum_decl(Context *c, const EnumDecl *enum_decl) { |
| 3891 | 3889 | Buf *bare_name = is_anonymous ? nullptr : buf_create_from_str(raw_name); |
| 3892 | 3890 | Buf *full_type_name = is_anonymous ? nullptr : buf_sprintf("enum_%s", buf_ptr(bare_name)); |
| 3893 | 3891 | |
| 3894 | | const EnumDecl *enum_def = enum_decl->getDefinition(); |
| 3892 | const clang::EnumDecl *enum_def = enum_decl->getDefinition(); |
| 3895 | 3893 | if (!enum_def) { |
| 3896 | 3894 | return demote_enum_to_opaque(c, enum_decl, full_type_name, bare_name); |
| 3897 | 3895 | } |
| ... | ... | @@ -3903,7 +3901,7 @@ static AstNode *resolve_enum_decl(Context *c, const EnumDecl *enum_decl) { |
| 3903 | 3901 | it_end = enum_def->enumerator_end(); |
| 3904 | 3902 | it != it_end; ++it, field_count += 1) |
| 3905 | 3903 | { |
| 3906 | | const EnumConstantDecl *enum_const = *it; |
| 3904 | const clang::EnumConstantDecl *enum_const = *it; |
| 3907 | 3905 | if (enum_const->getInitExpr()) { |
| 3908 | 3906 | pure_enum = false; |
| 3909 | 3907 | } |
| ... | ... | @@ -3917,8 +3915,8 @@ static AstNode *resolve_enum_decl(Context *c, const EnumDecl *enum_decl) { |
| 3917 | 3915 | // TODO only emit this tag type if the enum tag type is not the default. |
| 3918 | 3916 | // I don't know what the default is, need to figure out how clang is deciding. |
| 3919 | 3917 | // it appears to at least be different across gcc/msvc |
| 3920 | | if (!c_is_builtin_type(c, enum_decl->getIntegerType(), BuiltinType::UInt) && |
| 3921 | | !c_is_builtin_type(c, enum_decl->getIntegerType(), BuiltinType::Int)) |
| 3918 | if (!c_is_builtin_type(c, enum_decl->getIntegerType(), clang::BuiltinType::UInt) && |
| 3919 | !c_is_builtin_type(c, enum_decl->getIntegerType(), clang::BuiltinType::Int)) |
| 3922 | 3920 | { |
| 3923 | 3921 | enum_node->data.container_decl.init_arg_expr = tag_int_type; |
| 3924 | 3922 | } |
| ... | ... | @@ -3928,7 +3926,7 @@ static AstNode *resolve_enum_decl(Context *c, const EnumDecl *enum_decl) { |
| 3928 | 3926 | it_end = enum_def->enumerator_end(); |
| 3929 | 3927 | it != it_end; ++it, i += 1) |
| 3930 | 3928 | { |
| 3931 | | const EnumConstantDecl *enum_const = *it; |
| 3929 | const clang::EnumConstantDecl *enum_const = *it; |
| 3932 | 3930 | |
| 3933 | 3931 | Buf *enum_val_name = buf_create_from_str(decl_name(enum_const)); |
| 3934 | 3932 | Buf *field_name; |
| ... | ... | @@ -3969,7 +3967,7 @@ static AstNode *resolve_enum_decl(Context *c, const EnumDecl *enum_decl) { |
| 3969 | 3967 | } |
| 3970 | 3968 | } |
| 3971 | 3969 | |
| 3972 | | static AstNode *demote_struct_to_opaque(Context *c, const RecordDecl *record_decl, |
| 3970 | static AstNode *demote_struct_to_opaque(Context *c, const clang::RecordDecl *record_decl, |
| 3973 | 3971 | Buf *full_type_name, Buf *bare_name) |
| 3974 | 3972 | { |
| 3975 | 3973 | AstNode *opaque_node = trans_create_node_opaque(c); |
| ... | ... | @@ -3984,7 +3982,7 @@ static AstNode *demote_struct_to_opaque(Context *c, const RecordDecl *record_dec |
| 3984 | 3982 | return symbol_node; |
| 3985 | 3983 | } |
| 3986 | 3984 | |
| 3987 | | static AstNode *resolve_record_decl(Context *c, const RecordDecl *record_decl) { |
| 3985 | static AstNode *resolve_record_decl(Context *c, const clang::RecordDecl *record_decl) { |
| 3988 | 3986 | auto existing_entry = c->decl_table.maybe_get((void*)record_decl->getCanonicalDecl()); |
| 3989 | 3987 | if (existing_entry) { |
| 3990 | 3988 | return existing_entry->value; |
| ... | ... | @@ -4010,7 +4008,7 @@ static AstNode *resolve_record_decl(Context *c, const RecordDecl *record_decl) { |
| 4010 | 4008 | Buf *full_type_name = (bare_name == nullptr) ? |
| 4011 | 4009 | nullptr : buf_sprintf("%s_%s", container_kind_name, buf_ptr(bare_name)); |
| 4012 | 4010 | |
| 4013 | | RecordDecl *record_def = record_decl->getDefinition(); |
| 4011 | clang::RecordDecl *record_def = record_decl->getDefinition(); |
| 4014 | 4012 | if (record_def == nullptr) { |
| 4015 | 4013 | return demote_struct_to_opaque(c, record_decl, full_type_name, bare_name); |
| 4016 | 4014 | } |
| ... | ... | @@ -4021,7 +4019,7 @@ static AstNode *resolve_record_decl(Context *c, const RecordDecl *record_decl) { |
| 4021 | 4019 | it_end = record_def->field_end(); |
| 4022 | 4020 | it != it_end; ++it, field_count += 1) |
| 4023 | 4021 | { |
| 4024 | | const FieldDecl *field_decl = *it; |
| 4022 | const clang::FieldDecl *field_decl = *it; |
| 4025 | 4023 | |
| 4026 | 4024 | if (field_decl->isBitField()) { |
| 4027 | 4025 | emit_warning(c, field_decl->getLocation(), "%s %s demoted to opaque type - has bitfield", |
| ... | ... | @@ -4051,7 +4049,7 @@ static AstNode *resolve_record_decl(Context *c, const RecordDecl *record_decl) { |
| 4051 | 4049 | it_end = record_def->field_end(); |
| 4052 | 4050 | it != it_end; ++it, i += 1) |
| 4053 | 4051 | { |
| 4054 | | const FieldDecl *field_decl = *it; |
| 4052 | const clang::FieldDecl *field_decl = *it; |
| 4055 | 4053 | |
| 4056 | 4054 | AstNode *field_node = trans_create_node(c, NodeTypeStructField); |
| 4057 | 4055 | field_node->data.struct_field.name = buf_create_from_str(decl_name(field_decl)); |
| ... | ... | @@ -4078,13 +4076,13 @@ static AstNode *resolve_record_decl(Context *c, const RecordDecl *record_decl) { |
| 4078 | 4076 | } |
| 4079 | 4077 | } |
| 4080 | 4078 | |
| 4081 | | static AstNode *trans_ap_value(Context *c, APValue *ap_value, QualType qt, const SourceLocation &source_loc) { |
| 4079 | static AstNode *trans_ap_value(Context *c, clang::APValue *ap_value, clang::QualType qt, const clang::SourceLocation &source_loc) { |
| 4082 | 4080 | switch (ap_value->getKind()) { |
| 4083 | | case APValue::Int: |
| 4081 | case clang::APValue::Int: |
| 4084 | 4082 | return trans_create_node_apint(c, ap_value->getInt()); |
| 4085 | | case APValue::Uninitialized: |
| 4083 | case clang::APValue::Uninitialized: |
| 4086 | 4084 | return trans_create_node(c, NodeTypeUndefinedLiteral); |
| 4087 | | case APValue::Array: { |
| 4085 | case clang::APValue::Array: { |
| 4088 | 4086 | emit_warning(c, source_loc, "TODO add a test case for this code"); |
| 4089 | 4087 | |
| 4090 | 4088 | unsigned init_count = ap_value->getArrayInitializedElts(); |
| ... | ... | @@ -4098,10 +4096,10 @@ static AstNode *trans_ap_value(Context *c, APValue *ap_value, QualType qt, const |
| 4098 | 4096 | init_node->data.container_init_expr.type = arr_type_node; |
| 4099 | 4097 | init_node->data.container_init_expr.kind = ContainerInitKindArray; |
| 4100 | 4098 | |
| 4101 | | QualType child_qt = qt.getTypePtr()->getAsArrayTypeUnsafe()->getElementType(); |
| 4099 | clang::QualType child_qt = qt.getTypePtr()->getAsArrayTypeUnsafe()->getElementType(); |
| 4102 | 4100 | |
| 4103 | 4101 | for (size_t i = 0; i < init_count; i += 1) { |
| 4104 | | APValue &elem_ap_val = ap_value->getArrayInitializedElt(i); |
| 4102 | clang::APValue &elem_ap_val = ap_value->getArrayInitializedElt(i); |
| 4105 | 4103 | AstNode *elem_node = trans_ap_value(c, &elem_ap_val, child_qt, source_loc); |
| 4106 | 4104 | if (elem_node == nullptr) |
| 4107 | 4105 | return nullptr; |
| ... | ... | @@ -4111,7 +4109,7 @@ static AstNode *trans_ap_value(Context *c, APValue *ap_value, QualType qt, const |
| 4111 | 4109 | return init_node; |
| 4112 | 4110 | } |
| 4113 | 4111 | |
| 4114 | | APValue &filler_ap_val = ap_value->getArrayFiller(); |
| 4112 | clang::APValue &filler_ap_val = ap_value->getArrayFiller(); |
| 4115 | 4113 | AstNode *filler_node = trans_ap_value(c, &filler_ap_val, child_qt, source_loc); |
| 4116 | 4114 | if (filler_node == nullptr) |
| 4117 | 4115 | return nullptr; |
| ... | ... | @@ -4139,60 +4137,60 @@ static AstNode *trans_ap_value(Context *c, APValue *ap_value, QualType qt, const |
| 4139 | 4137 | |
| 4140 | 4138 | return trans_create_node_bin_op(c, init_node, BinOpTypeArrayCat, rhs_node); |
| 4141 | 4139 | } |
| 4142 | | case APValue::LValue: { |
| 4143 | | const APValue::LValueBase lval_base = ap_value->getLValueBase(); |
| 4144 | | if (const Expr *expr = lval_base.dyn_cast<const Expr *>()) { |
| 4140 | case clang::APValue::LValue: { |
| 4141 | const clang::APValue::LValueBase lval_base = ap_value->getLValueBase(); |
| 4142 | if (const clang::Expr *expr = lval_base.dyn_cast<const clang::Expr *>()) { |
| 4145 | 4143 | return trans_expr(c, ResultUsedYes, &c->global_scope->base, expr, TransRValue); |
| 4146 | 4144 | } |
| 4147 | | //const ValueDecl *value_decl = lval_base.get<const ValueDecl *>(); |
| 4148 | | emit_warning(c, source_loc, "TODO handle initializer LValue ValueDecl"); |
| 4145 | //const clang::ValueDecl *value_decl = lval_base.get<const clang::ValueDecl *>(); |
| 4146 | emit_warning(c, source_loc, "TODO handle initializer LValue clang::ValueDecl"); |
| 4149 | 4147 | return nullptr; |
| 4150 | 4148 | } |
| 4151 | | case APValue::Float: |
| 4149 | case clang::APValue::Float: |
| 4152 | 4150 | emit_warning(c, source_loc, "unsupported initializer value kind: Float"); |
| 4153 | 4151 | return nullptr; |
| 4154 | | case APValue::ComplexInt: |
| 4152 | case clang::APValue::ComplexInt: |
| 4155 | 4153 | emit_warning(c, source_loc, "unsupported initializer value kind: ComplexInt"); |
| 4156 | 4154 | return nullptr; |
| 4157 | | case APValue::ComplexFloat: |
| 4155 | case clang::APValue::ComplexFloat: |
| 4158 | 4156 | emit_warning(c, source_loc, "unsupported initializer value kind: ComplexFloat"); |
| 4159 | 4157 | return nullptr; |
| 4160 | | case APValue::Vector: |
| 4158 | case clang::APValue::Vector: |
| 4161 | 4159 | emit_warning(c, source_loc, "unsupported initializer value kind: Vector"); |
| 4162 | 4160 | return nullptr; |
| 4163 | | case APValue::Struct: |
| 4161 | case clang::APValue::Struct: |
| 4164 | 4162 | emit_warning(c, source_loc, "unsupported initializer value kind: Struct"); |
| 4165 | 4163 | return nullptr; |
| 4166 | | case APValue::Union: |
| 4164 | case clang::APValue::Union: |
| 4167 | 4165 | emit_warning(c, source_loc, "unsupported initializer value kind: Union"); |
| 4168 | 4166 | return nullptr; |
| 4169 | | case APValue::MemberPointer: |
| 4167 | case clang::APValue::MemberPointer: |
| 4170 | 4168 | emit_warning(c, source_loc, "unsupported initializer value kind: MemberPointer"); |
| 4171 | 4169 | return nullptr; |
| 4172 | | case APValue::AddrLabelDiff: |
| 4170 | case clang::APValue::AddrLabelDiff: |
| 4173 | 4171 | emit_warning(c, source_loc, "unsupported initializer value kind: AddrLabelDiff"); |
| 4174 | 4172 | return nullptr; |
| 4175 | 4173 | } |
| 4176 | 4174 | zig_unreachable(); |
| 4177 | 4175 | } |
| 4178 | 4176 | |
| 4179 | | static void visit_var_decl(Context *c, const VarDecl *var_decl) { |
| 4177 | static void visit_var_decl(Context *c, const clang::VarDecl *var_decl) { |
| 4180 | 4178 | Buf *name = buf_create_from_str(decl_name(var_decl)); |
| 4181 | 4179 | |
| 4182 | 4180 | switch (var_decl->getTLSKind()) { |
| 4183 | | case VarDecl::TLS_None: |
| 4181 | case clang::VarDecl::TLS_None: |
| 4184 | 4182 | break; |
| 4185 | | case VarDecl::TLS_Static: |
| 4183 | case clang::VarDecl::TLS_Static: |
| 4186 | 4184 | emit_warning(c, var_decl->getLocation(), |
| 4187 | 4185 | "ignoring variable '%s' - static thread local storage", buf_ptr(name)); |
| 4188 | 4186 | return; |
| 4189 | | case VarDecl::TLS_Dynamic: |
| 4187 | case clang::VarDecl::TLS_Dynamic: |
| 4190 | 4188 | emit_warning(c, var_decl->getLocation(), |
| 4191 | 4189 | "ignoring variable '%s' - dynamic thread local storage", buf_ptr(name)); |
| 4192 | 4190 | return; |
| 4193 | 4191 | } |
| 4194 | 4192 | |
| 4195 | | QualType qt = var_decl->getType(); |
| 4193 | clang::QualType qt = var_decl->getType(); |
| 4196 | 4194 | AstNode *var_type = trans_qual_type(c, qt, var_decl->getLocation()); |
| 4197 | 4195 | if (var_type == nullptr) { |
| 4198 | 4196 | emit_warning(c, var_decl->getLocation(), "ignoring variable '%s' - unresolved type", buf_ptr(name)); |
| ... | ... | @@ -4206,7 +4204,7 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { |
| 4206 | 4204 | if (is_static && !is_extern) { |
| 4207 | 4205 | AstNode *init_node; |
| 4208 | 4206 | if (var_decl->hasInit()) { |
| 4209 | | APValue *ap_value = var_decl->evaluateValue(); |
| 4207 | clang::APValue *ap_value = var_decl->evaluateValue(); |
| 4210 | 4208 | if (ap_value == nullptr) { |
| 4211 | 4209 | emit_warning(c, var_decl->getLocation(), |
| 4212 | 4210 | "ignoring variable '%s' - unable to evaluate initializer", buf_ptr(name)); |
| ... | ... | @@ -4236,24 +4234,24 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { |
| 4236 | 4234 | return; |
| 4237 | 4235 | } |
| 4238 | 4236 | |
| 4239 | | static bool decl_visitor(void *context, const Decl *decl) { |
| 4237 | static bool decl_visitor(void *context, const clang::Decl *decl) { |
| 4240 | 4238 | Context *c = (Context*)context; |
| 4241 | 4239 | |
| 4242 | 4240 | switch (decl->getKind()) { |
| 4243 | | case Decl::Function: |
| 4244 | | visit_fn_decl(c, static_cast<const FunctionDecl*>(decl)); |
| 4241 | case clang::Decl::Function: |
| 4242 | visit_fn_decl(c, static_cast<const clang::FunctionDecl*>(decl)); |
| 4245 | 4243 | break; |
| 4246 | | case Decl::Typedef: |
| 4247 | | resolve_typedef_decl(c, static_cast<const TypedefNameDecl *>(decl)); |
| 4244 | case clang::Decl::Typedef: |
| 4245 | resolve_typedef_decl(c, static_cast<const clang::TypedefNameDecl *>(decl)); |
| 4248 | 4246 | break; |
| 4249 | | case Decl::Enum: |
| 4250 | | resolve_enum_decl(c, static_cast<const EnumDecl *>(decl)); |
| 4247 | case clang::Decl::Enum: |
| 4248 | resolve_enum_decl(c, static_cast<const clang::EnumDecl *>(decl)); |
| 4251 | 4249 | break; |
| 4252 | | case Decl::Record: |
| 4253 | | resolve_record_decl(c, static_cast<const RecordDecl *>(decl)); |
| 4250 | case clang::Decl::Record: |
| 4251 | resolve_record_decl(c, static_cast<const clang::RecordDecl *>(decl)); |
| 4254 | 4252 | break; |
| 4255 | | case Decl::Var: |
| 4256 | | visit_var_decl(c, static_cast<const VarDecl *>(decl)); |
| 4253 | case clang::Decl::Var: |
| 4254 | visit_var_decl(c, static_cast<const clang::VarDecl *>(decl)); |
| 4257 | 4255 | break; |
| 4258 | 4256 | default: |
| 4259 | 4257 | emit_warning(c, decl->getLocation(), "ignoring %s decl", decl->getDeclKindName()); |
| ... | ... | @@ -4674,24 +4672,24 @@ static void process_macro(Context *c, CTokenize *ctok, Buf *name, const char *ch |
| 4674 | 4672 | c->macro_table.put(name, result_node); |
| 4675 | 4673 | } |
| 4676 | 4674 | |
| 4677 | | static void process_preprocessor_entities(Context *c, ASTUnit &unit) { |
| 4675 | static void process_preprocessor_entities(Context *c, clang::ASTUnit &unit) { |
| 4678 | 4676 | CTokenize ctok = {{0}}; |
| 4679 | 4677 | |
| 4680 | 4678 | // TODO if we see #undef, delete it from the table |
| 4681 | 4679 | |
| 4682 | | for (PreprocessedEntity *entity : unit.getLocalPreprocessingEntities()) { |
| 4680 | for (clang::PreprocessedEntity *entity : unit.getLocalPreprocessingEntities()) { |
| 4683 | 4681 | switch (entity->getKind()) { |
| 4684 | | case PreprocessedEntity::InvalidKind: |
| 4685 | | case PreprocessedEntity::InclusionDirectiveKind: |
| 4686 | | case PreprocessedEntity::MacroExpansionKind: |
| 4682 | case clang::PreprocessedEntity::InvalidKind: |
| 4683 | case clang::PreprocessedEntity::InclusionDirectiveKind: |
| 4684 | case clang::PreprocessedEntity::MacroExpansionKind: |
| 4687 | 4685 | continue; |
| 4688 | | case PreprocessedEntity::MacroDefinitionKind: |
| 4686 | case clang::PreprocessedEntity::MacroDefinitionKind: |
| 4689 | 4687 | { |
| 4690 | | MacroDefinitionRecord *macro = static_cast<MacroDefinitionRecord *>(entity); |
| 4688 | clang::MacroDefinitionRecord *macro = static_cast<clang::MacroDefinitionRecord *>(entity); |
| 4691 | 4689 | const char *raw_name = macro->getName()->getNameStart(); |
| 4692 | | SourceRange range = macro->getSourceRange(); |
| 4693 | | SourceLocation begin_loc = range.getBegin(); |
| 4694 | | SourceLocation end_loc = range.getEnd(); |
| 4690 | clang::SourceRange range = macro->getSourceRange(); |
| 4691 | clang::SourceLocation begin_loc = range.getBegin(); |
| 4692 | clang::SourceLocation end_loc = range.getEnd(); |
| 4695 | 4693 | |
| 4696 | 4694 | if (begin_loc == end_loc) { |
| 4697 | 4695 | // this means it is a macro without a value |
| ... | ... | @@ -4816,9 +4814,9 @@ Error parse_h_file(ImportTableEntry *import, ZigList<ErrorMsg *> *errors, const |
| 4816 | 4814 | // to make the [start...end] argument work |
| 4817 | 4815 | clang_argv.append(nullptr); |
| 4818 | 4816 | |
| 4819 | | IntrusiveRefCntPtr<DiagnosticsEngine> diags(CompilerInstance::createDiagnostics(new DiagnosticOptions)); |
| 4817 | clang::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diags(clang::CompilerInstance::createDiagnostics(new clang::DiagnosticOptions)); |
| 4820 | 4818 | |
| 4821 | | std::shared_ptr<PCHContainerOperations> pch_container_ops = std::make_shared<PCHContainerOperations>(); |
| 4819 | std::shared_ptr<clang::PCHContainerOperations> pch_container_ops = std::make_shared<clang::PCHContainerOperations>(); |
| 4822 | 4820 | |
| 4823 | 4821 | bool only_local_decls = true; |
| 4824 | 4822 | bool capture_diagnostics = true; |
| ... | ... | @@ -4827,13 +4825,13 @@ Error parse_h_file(ImportTableEntry *import, ZigList<ErrorMsg *> *errors, const |
| 4827 | 4825 | bool single_file_parse = false; |
| 4828 | 4826 | bool for_serialization = false; |
| 4829 | 4827 | const char *resources_path = buf_ptr(codegen->zig_c_headers_dir); |
| 4830 | | std::unique_ptr<ASTUnit> err_unit; |
| 4831 | | std::unique_ptr<ASTUnit> ast_unit(ASTUnit::LoadFromCommandLine( |
| 4828 | std::unique_ptr<clang::ASTUnit> err_unit; |
| 4829 | std::unique_ptr<clang::ASTUnit> ast_unit(clang::ASTUnit::LoadFromCommandLine( |
| 4832 | 4830 | &clang_argv.at(0), &clang_argv.last(), |
| 4833 | 4831 | pch_container_ops, diags, resources_path, |
| 4834 | | only_local_decls, capture_diagnostics, None, true, 0, TU_Complete, |
| 4835 | | false, false, allow_pch_with_compiler_errors, SkipFunctionBodiesScope::None, |
| 4836 | | single_file_parse, user_files_are_volatile, for_serialization, None, &err_unit, |
| 4832 | only_local_decls, capture_diagnostics, clang::None, true, 0, clang::TU_Complete, |
| 4833 | false, false, allow_pch_with_compiler_errors, clang::SkipFunctionBodiesScope::None, |
| 4834 | single_file_parse, user_files_are_volatile, for_serialization, clang::None, &err_unit, |
| 4837 | 4835 | nullptr)); |
| 4838 | 4836 | |
| 4839 | 4837 | // Early failures in LoadFromCommandLine may return with ErrUnit unset. |
| ... | ... | @@ -4846,26 +4844,26 @@ Error parse_h_file(ImportTableEntry *import, ZigList<ErrorMsg *> *errors, const |
| 4846 | 4844 | err_unit = std::move(ast_unit); |
| 4847 | 4845 | } |
| 4848 | 4846 | |
| 4849 | | for (ASTUnit::stored_diag_iterator it = err_unit->stored_diag_begin(), |
| 4847 | for (clang::ASTUnit::stored_diag_iterator it = err_unit->stored_diag_begin(), |
| 4850 | 4848 | it_end = err_unit->stored_diag_end(); |
| 4851 | 4849 | it != it_end; ++it) |
| 4852 | 4850 | { |
| 4853 | 4851 | switch (it->getLevel()) { |
| 4854 | | case DiagnosticsEngine::Ignored: |
| 4855 | | case DiagnosticsEngine::Note: |
| 4856 | | case DiagnosticsEngine::Remark: |
| 4857 | | case DiagnosticsEngine::Warning: |
| 4852 | case clang::DiagnosticsEngine::Ignored: |
| 4853 | case clang::DiagnosticsEngine::Note: |
| 4854 | case clang::DiagnosticsEngine::Remark: |
| 4855 | case clang::DiagnosticsEngine::Warning: |
| 4858 | 4856 | continue; |
| 4859 | | case DiagnosticsEngine::Error: |
| 4860 | | case DiagnosticsEngine::Fatal: |
| 4857 | case clang::DiagnosticsEngine::Error: |
| 4858 | case clang::DiagnosticsEngine::Fatal: |
| 4861 | 4859 | break; |
| 4862 | 4860 | } |
| 4863 | 4861 | StringRef msg_str_ref = it->getMessage(); |
| 4864 | 4862 | Buf *msg = string_ref_to_buf(msg_str_ref); |
| 4865 | | FullSourceLoc fsl = it->getLocation(); |
| 4863 | clang::FullSourceLoc fsl = it->getLocation(); |
| 4866 | 4864 | if (fsl.hasManager()) { |
| 4867 | | FileID file_id = fsl.getFileID(); |
| 4868 | | StringRef filename = fsl.getManager().getFilename(fsl); |
| 4865 | clang::FileID file_id = fsl.getFileID(); |
| 4866 | clang::StringRef filename = fsl.getManager().getFilename(fsl); |
| 4869 | 4867 | unsigned line = fsl.getSpellingLineNumber() - 1; |
| 4870 | 4868 | unsigned column = fsl.getSpellingColumnNumber() - 1; |
| 4871 | 4869 | unsigned offset = fsl.getManager().getFileOffset(fsl); |