authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-16 13:34:32-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-16 14:09:00-05:00
logf4c5bcfea5f02dec30d7adede0550c95af424c71
tree4d80a5a0bb98870eb0e2a990b2c6bfc12898cbb5
parentf57182456d52615ece1133db9c33ef57e3ae187b
signaturelock-open Commit is signed but in an unrecognized format.

refactor translate-c - no more using namespace clang

this is in preparation for #1964

1 files changed, 1138 insertions(+), 1140 deletions(-)

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