| ... | @@ -67,7 +67,7 @@ static TypeTableEntry *resolve_enum_decl(Context *c, const EnumDecl *enum_decl); | ... | @@ -67,7 +67,7 @@ static TypeTableEntry *resolve_enum_decl(Context *c, const EnumDecl *enum_decl); |
| 67 | | 67 | |
| 68 | | 68 | |
| 69 | __attribute__ ((format (printf, 3, 4))) | 69 | __attribute__ ((format (printf, 3, 4))) |
| 70 | static void emit_warning(Context *c, const Decl *decl, const char *format, ...) { | 70 | static void emit_warning(Context *c, const SourceLocation &sl, const char *format, ...) { |
| 71 | if (!c->warnings_on) { | 71 | if (!c->warnings_on) { |
| 72 | return; | 72 | return; |
| 73 | } | 73 | } |
| ... | @@ -77,8 +77,6 @@ static void emit_warning(Context *c, const Decl *decl, const char *format, ...) | ... | @@ -77,8 +77,6 @@ static void emit_warning(Context *c, const Decl *decl, const char *format, ...) |
| 77 | Buf *msg = buf_vprintf(format, ap); | 77 | Buf *msg = buf_vprintf(format, ap); |
| 78 | va_end(ap); | 78 | va_end(ap); |
| 79 | | 79 | |
| 80 | SourceLocation sl = decl->getLocation(); | | |
| 81 | | | |
| 82 | StringRef filename = c->source_manager->getFilename(sl); | 80 | StringRef filename = c->source_manager->getFilename(sl); |
| 83 | const char *filename_bytes = (const char *)filename.bytes_begin(); | 81 | const char *filename_bytes = (const char *)filename.bytes_begin(); |
| 84 | Buf *path; | 82 | Buf *path; |
| ... | @@ -185,14 +183,14 @@ static ConstExprValue *create_const_int_ap(Context *c, TypeTableEntry *type, con | ... | @@ -185,14 +183,14 @@ static ConstExprValue *create_const_int_ap(Context *c, TypeTableEntry *type, con |
| 185 | { | 183 | { |
| 186 | if (aps_int.isSigned()) { | 184 | if (aps_int.isSigned()) { |
| 187 | if (aps_int > INT64_MAX || aps_int < INT64_MIN) { | 185 | if (aps_int > INT64_MAX || aps_int < INT64_MIN) { |
| 188 | emit_warning(c, source_decl, "integer overflow\n"); | 186 | emit_warning(c, source_decl->getLocation(), "integer overflow\n"); |
| 189 | return nullptr; | 187 | return nullptr; |
| 190 | } else { | 188 | } else { |
| 191 | return create_const_signed(type, aps_int.getExtValue()); | 189 | return create_const_signed(type, aps_int.getExtValue()); |
| 192 | } | 190 | } |
| 193 | } else { | 191 | } else { |
| 194 | if (aps_int > INT64_MAX) { | 192 | if (aps_int > INT64_MAX) { |
| 195 | emit_warning(c, source_decl, "integer overflow\n"); | 193 | emit_warning(c, source_decl->getLocation(), "integer overflow\n"); |
| 196 | return nullptr; | 194 | return nullptr; |
| 197 | } else { | 195 | } else { |
| 198 | return create_const_unsigned_negative(type, aps_int.getExtValue(), false); | 196 | return create_const_unsigned_negative(type, aps_int.getExtValue(), false); |
| ... | @@ -347,7 +345,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -347,7 +345,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 347 | case BuiltinType::OCLClkEvent: | 345 | case BuiltinType::OCLClkEvent: |
| 348 | case BuiltinType::OCLQueue: | 346 | case BuiltinType::OCLQueue: |
| 349 | case BuiltinType::OCLReserveID: | 347 | case BuiltinType::OCLReserveID: |
| 350 | emit_warning(c, decl, "missed a builtin type"); | 348 | emit_warning(c, decl->getLocation(), "missed a builtin type"); |
| 351 | return c->codegen->builtin_types.entry_invalid; | 349 | return c->codegen->builtin_types.entry_invalid; |
| 352 | } | 350 | } |
| 353 | break; | 351 | break; |
| ... | @@ -358,7 +356,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -358,7 +356,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 358 | QualType child_qt = pointer_ty->getPointeeType(); | 356 | QualType child_qt = pointer_ty->getPointeeType(); |
| 359 | TypeTableEntry *child_type = resolve_qual_type(c, child_qt, decl); | 357 | TypeTableEntry *child_type = resolve_qual_type(c, child_qt, decl); |
| 360 | if (type_is_invalid(child_type)) { | 358 | if (type_is_invalid(child_type)) { |
| 361 | emit_warning(c, decl, "pointer to unresolved type"); | 359 | emit_warning(c, decl->getLocation(), "pointer to unresolved type"); |
| 362 | return c->codegen->builtin_types.entry_invalid; | 360 | return c->codegen->builtin_types.entry_invalid; |
| 363 | } | 361 | } |
| 364 | | 362 | |
| ... | @@ -423,7 +421,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -423,7 +421,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 423 | case ETK_Class: | 421 | case ETK_Class: |
| 424 | case ETK_Typename: | 422 | case ETK_Typename: |
| 425 | case ETK_None: | 423 | case ETK_None: |
| 426 | emit_warning(c, decl, "unsupported elaborated type"); | 424 | emit_warning(c, decl->getLocation(), "unsupported elaborated type"); |
| 427 | return c->codegen->builtin_types.entry_invalid; | 425 | return c->codegen->builtin_types.entry_invalid; |
| 428 | } | 426 | } |
| 429 | } | 427 | } |
| ... | @@ -435,52 +433,52 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -435,52 +433,52 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 435 | case CC_C: // __attribute__((cdecl)) | 433 | case CC_C: // __attribute__((cdecl)) |
| 436 | break; | 434 | break; |
| 437 | case CC_X86StdCall: // __attribute__((stdcall)) | 435 | case CC_X86StdCall: // __attribute__((stdcall)) |
| 438 | emit_warning(c, decl, "function type has x86 stdcall calling convention"); | 436 | emit_warning(c, decl->getLocation(), "function type has x86 stdcall calling convention"); |
| 439 | return c->codegen->builtin_types.entry_invalid; | 437 | return c->codegen->builtin_types.entry_invalid; |
| 440 | case CC_X86FastCall: // __attribute__((fastcall)) | 438 | case CC_X86FastCall: // __attribute__((fastcall)) |
| 441 | emit_warning(c, decl, "function type has x86 fastcall calling convention"); | 439 | emit_warning(c, decl->getLocation(), "function type has x86 fastcall calling convention"); |
| 442 | return c->codegen->builtin_types.entry_invalid; | 440 | return c->codegen->builtin_types.entry_invalid; |
| 443 | case CC_X86ThisCall: // __attribute__((thiscall)) | 441 | case CC_X86ThisCall: // __attribute__((thiscall)) |
| 444 | emit_warning(c, decl, "function type has x86 thiscall calling convention"); | 442 | emit_warning(c, decl->getLocation(), "function type has x86 thiscall calling convention"); |
| 445 | return c->codegen->builtin_types.entry_invalid; | 443 | return c->codegen->builtin_types.entry_invalid; |
| 446 | case CC_X86VectorCall: // __attribute__((vectorcall)) | 444 | case CC_X86VectorCall: // __attribute__((vectorcall)) |
| 447 | emit_warning(c, decl, "function type has x86 vectorcall calling convention"); | 445 | emit_warning(c, decl->getLocation(), "function type has x86 vectorcall calling convention"); |
| 448 | return c->codegen->builtin_types.entry_invalid; | 446 | return c->codegen->builtin_types.entry_invalid; |
| 449 | case CC_X86Pascal: // __attribute__((pascal)) | 447 | case CC_X86Pascal: // __attribute__((pascal)) |
| 450 | emit_warning(c, decl, "function type has x86 pascal calling convention"); | 448 | emit_warning(c, decl->getLocation(), "function type has x86 pascal calling convention"); |
| 451 | return c->codegen->builtin_types.entry_invalid; | 449 | return c->codegen->builtin_types.entry_invalid; |
| 452 | case CC_Win64: // __attribute__((ms_abi)) | 450 | case CC_Win64: // __attribute__((ms_abi)) |
| 453 | emit_warning(c, decl, "function type has win64 calling convention"); | 451 | emit_warning(c, decl->getLocation(), "function type has win64 calling convention"); |
| 454 | return c->codegen->builtin_types.entry_invalid; | 452 | return c->codegen->builtin_types.entry_invalid; |
| 455 | case CC_X86_64SysV: // __attribute__((sysv_abi)) | 453 | case CC_X86_64SysV: // __attribute__((sysv_abi)) |
| 456 | emit_warning(c, decl, "function type has x86 64sysv calling convention"); | 454 | emit_warning(c, decl->getLocation(), "function type has x86 64sysv calling convention"); |
| 457 | return c->codegen->builtin_types.entry_invalid; | 455 | return c->codegen->builtin_types.entry_invalid; |
| 458 | case CC_X86RegCall: | 456 | case CC_X86RegCall: |
| 459 | emit_warning(c, decl, "function type has x86 reg calling convention"); | 457 | emit_warning(c, decl->getLocation(), "function type has x86 reg calling convention"); |
| 460 | return c->codegen->builtin_types.entry_invalid; | 458 | return c->codegen->builtin_types.entry_invalid; |
| 461 | case CC_AAPCS: // __attribute__((pcs("aapcs"))) | 459 | case CC_AAPCS: // __attribute__((pcs("aapcs"))) |
| 462 | emit_warning(c, decl, "function type has aapcs calling convention"); | 460 | emit_warning(c, decl->getLocation(), "function type has aapcs calling convention"); |
| 463 | return c->codegen->builtin_types.entry_invalid; | 461 | return c->codegen->builtin_types.entry_invalid; |
| 464 | case CC_AAPCS_VFP: // __attribute__((pcs("aapcs-vfp"))) | 462 | case CC_AAPCS_VFP: // __attribute__((pcs("aapcs-vfp"))) |
| 465 | emit_warning(c, decl, "function type has aapcs-vfp calling convention"); | 463 | emit_warning(c, decl->getLocation(), "function type has aapcs-vfp calling convention"); |
| 466 | return c->codegen->builtin_types.entry_invalid; | 464 | return c->codegen->builtin_types.entry_invalid; |
| 467 | case CC_IntelOclBicc: // __attribute__((intel_ocl_bicc)) | 465 | case CC_IntelOclBicc: // __attribute__((intel_ocl_bicc)) |
| 468 | emit_warning(c, decl, "function type has intel_ocl_bicc calling convention"); | 466 | emit_warning(c, decl->getLocation(), "function type has intel_ocl_bicc calling convention"); |
| 469 | return c->codegen->builtin_types.entry_invalid; | 467 | return c->codegen->builtin_types.entry_invalid; |
| 470 | case CC_SpirFunction: // default for OpenCL functions on SPIR target | 468 | case CC_SpirFunction: // default for OpenCL functions on SPIR target |
| 471 | emit_warning(c, decl, "function type has SPIR function calling convention"); | 469 | emit_warning(c, decl->getLocation(), "function type has SPIR function calling convention"); |
| 472 | return c->codegen->builtin_types.entry_invalid; | 470 | return c->codegen->builtin_types.entry_invalid; |
| 473 | case CC_OpenCLKernel: | 471 | case CC_OpenCLKernel: |
| 474 | emit_warning(c, decl, "function type has OpenCLKernel calling convention"); | 472 | emit_warning(c, decl->getLocation(), "function type has OpenCLKernel calling convention"); |
| 475 | return c->codegen->builtin_types.entry_invalid; | 473 | return c->codegen->builtin_types.entry_invalid; |
| 476 | case CC_Swift: | 474 | case CC_Swift: |
| 477 | emit_warning(c, decl, "function type has Swift calling convention"); | 475 | emit_warning(c, decl->getLocation(), "function type has Swift calling convention"); |
| 478 | return c->codegen->builtin_types.entry_invalid; | 476 | return c->codegen->builtin_types.entry_invalid; |
| 479 | case CC_PreserveMost: | 477 | case CC_PreserveMost: |
| 480 | emit_warning(c, decl, "function type has PreserveMost calling convention"); | 478 | emit_warning(c, decl->getLocation(), "function type has PreserveMost calling convention"); |
| 481 | return c->codegen->builtin_types.entry_invalid; | 479 | return c->codegen->builtin_types.entry_invalid; |
| 482 | case CC_PreserveAll: | 480 | case CC_PreserveAll: |
| 483 | emit_warning(c, decl, "function type has PreserveAll calling convention"); | 481 | emit_warning(c, decl->getLocation(), "function type has PreserveAll calling convention"); |
| 484 | return c->codegen->builtin_types.entry_invalid; | 482 | return c->codegen->builtin_types.entry_invalid; |
| 485 | } | 483 | } |
| 486 | | 484 | |
| ... | @@ -495,7 +493,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -495,7 +493,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 495 | } else { | 493 | } else { |
| 496 | fn_type_id.return_type = resolve_qual_type(c, fn_proto_ty->getReturnType(), decl); | 494 | fn_type_id.return_type = resolve_qual_type(c, fn_proto_ty->getReturnType(), decl); |
| 497 | if (type_is_invalid(fn_type_id.return_type)) { | 495 | if (type_is_invalid(fn_type_id.return_type)) { |
| 498 | emit_warning(c, decl, "unresolved function proto return type"); | 496 | emit_warning(c, decl->getLocation(), "unresolved function proto return type"); |
| 499 | return c->codegen->builtin_types.entry_invalid; | 497 | return c->codegen->builtin_types.entry_invalid; |
| 500 | } | 498 | } |
| 501 | // convert c_void to actual void (only for return type) | 499 | // convert c_void to actual void (only for return type) |
| ... | @@ -510,7 +508,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -510,7 +508,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 510 | TypeTableEntry *param_type = resolve_qual_type(c, qt, decl); | 508 | TypeTableEntry *param_type = resolve_qual_type(c, qt, decl); |
| 511 | | 509 | |
| 512 | if (type_is_invalid(param_type)) { | 510 | if (type_is_invalid(param_type)) { |
| 513 | emit_warning(c, decl, "unresolved function proto parameter type"); | 511 | emit_warning(c, decl->getLocation(), "unresolved function proto parameter type"); |
| 514 | return c->codegen->builtin_types.entry_invalid; | 512 | return c->codegen->builtin_types.entry_invalid; |
| 515 | } | 513 | } |
| 516 | | 514 | |
| ... | @@ -536,7 +534,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -536,7 +534,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 536 | const ConstantArrayType *const_arr_ty = static_cast<const ConstantArrayType *>(ty); | 534 | const ConstantArrayType *const_arr_ty = static_cast<const ConstantArrayType *>(ty); |
| 537 | TypeTableEntry *child_type = resolve_qual_type(c, const_arr_ty->getElementType(), decl); | 535 | TypeTableEntry *child_type = resolve_qual_type(c, const_arr_ty->getElementType(), decl); |
| 538 | if (child_type->id == TypeTableEntryIdInvalid) { | 536 | if (child_type->id == TypeTableEntryIdInvalid) { |
| 539 | emit_warning(c, decl, "unresolved array element type"); | 537 | emit_warning(c, decl->getLocation(), "unresolved array element type"); |
| 540 | return child_type; | 538 | return child_type; |
| 541 | } | 539 | } |
| 542 | uint64_t size = const_arr_ty->getSize().getLimitedValue(); | 540 | uint64_t size = const_arr_ty->getSize().getLimitedValue(); |
| ... | @@ -591,7 +589,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -591,7 +589,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 591 | case Type::Pipe: | 589 | case Type::Pipe: |
| 592 | case Type::ObjCTypeParam: | 590 | case Type::ObjCTypeParam: |
| 593 | case Type::DeducedTemplateSpecialization: | 591 | case Type::DeducedTemplateSpecialization: |
| 594 | emit_warning(c, decl, "missed a '%s' type", ty->getTypeClassName()); | 592 | emit_warning(c, decl->getLocation(), "missed a '%s' type", ty->getTypeClassName()); |
| 595 | return c->codegen->builtin_types.entry_invalid; | 593 | return c->codegen->builtin_types.entry_invalid; |
| 596 | } | 594 | } |
| 597 | zig_unreachable(); | 595 | zig_unreachable(); |
| ... | @@ -823,6 +821,8 @@ static AstNode * trans_implicit_cast_expr(Context *c, ImplicitCastExpr *stmt) { | ... | @@ -823,6 +821,8 @@ static AstNode * trans_implicit_cast_expr(Context *c, ImplicitCastExpr *stmt) { |
| 823 | switch (stmt->getCastKind()) { | 821 | switch (stmt->getCastKind()) { |
| 824 | case CK_LValueToRValue: | 822 | case CK_LValueToRValue: |
| 825 | return trans_expr(c, stmt->getSubExpr()); | 823 | return trans_expr(c, stmt->getSubExpr()); |
| | 824 | case CK_IntegralCast: |
| | 825 | zig_panic("TODO handle C translation cast CK_IntegralCast"); |
| 826 | case CK_Dependent: | 826 | case CK_Dependent: |
| 827 | zig_panic("TODO handle C translation cast CK_Dependent"); | 827 | zig_panic("TODO handle C translation cast CK_Dependent"); |
| 828 | case CK_BitCast: | 828 | case CK_BitCast: |
| ... | @@ -871,8 +871,6 @@ static AstNode * trans_implicit_cast_expr(Context *c, ImplicitCastExpr *stmt) { | ... | @@ -871,8 +871,6 @@ static AstNode * trans_implicit_cast_expr(Context *c, ImplicitCastExpr *stmt) { |
| 871 | zig_panic("TODO handle C translation cast CK_ToVoid"); | 871 | zig_panic("TODO handle C translation cast CK_ToVoid"); |
| 872 | case CK_VectorSplat: | 872 | case CK_VectorSplat: |
| 873 | zig_panic("TODO handle C translation cast CK_VectorSplat"); | 873 | zig_panic("TODO handle C translation cast CK_VectorSplat"); |
| 874 | case CK_IntegralCast: | | |
| 875 | zig_panic("TODO handle C translation cast CK_IntegralCast"); | | |
| 876 | case CK_IntegralToBoolean: | 874 | case CK_IntegralToBoolean: |
| 877 | zig_panic("TODO handle C translation cast CK_IntegralToBoolean"); | 875 | zig_panic("TODO handle C translation cast CK_IntegralToBoolean"); |
| 878 | case CK_IntegralToFloating: | 876 | case CK_IntegralToFloating: |
| ... | @@ -1424,7 +1422,7 @@ static void visit_fn_decl(Context *c, const FunctionDecl *fn_decl) { | ... | @@ -1424,7 +1422,7 @@ static void visit_fn_decl(Context *c, const FunctionDecl *fn_decl) { |
| 1424 | TypeTableEntry *fn_type = resolve_qual_type(c, fn_decl->getType(), fn_decl); | 1422 | TypeTableEntry *fn_type = resolve_qual_type(c, fn_decl->getType(), fn_decl); |
| 1425 | | 1423 | |
| 1426 | if (fn_type->id == TypeTableEntryIdInvalid) { | 1424 | if (fn_type->id == TypeTableEntryIdInvalid) { |
| 1427 | emit_warning(c, fn_decl, "ignoring function '%s' - unable to resolve type", buf_ptr(fn_name)); | 1425 | emit_warning(c, fn_decl->getLocation(), "ignoring function '%s' - unable to resolve type", buf_ptr(fn_name)); |
| 1428 | return; | 1426 | return; |
| 1429 | } | 1427 | } |
| 1430 | assert(fn_type->id == TypeTableEntryIdFn); | 1428 | assert(fn_type->id == TypeTableEntryIdFn); |
| ... | @@ -1482,7 +1480,7 @@ static void visit_typedef_decl(Context *c, const TypedefNameDecl *typedef_decl) | ... | @@ -1482,7 +1480,7 @@ static void visit_typedef_decl(Context *c, const TypedefNameDecl *typedef_decl) |
| 1482 | | 1480 | |
| 1483 | TypeTableEntry *child_type = resolve_qual_type(c, child_qt, typedef_decl); | 1481 | TypeTableEntry *child_type = resolve_qual_type(c, child_qt, typedef_decl); |
| 1484 | if (child_type->id == TypeTableEntryIdInvalid) { | 1482 | if (child_type->id == TypeTableEntryIdInvalid) { |
| 1485 | emit_warning(c, typedef_decl, "typedef %s - unresolved child type", buf_ptr(type_name)); | 1483 | emit_warning(c, typedef_decl->getLocation(), "typedef %s - unresolved child type", buf_ptr(type_name)); |
| 1486 | return; | 1484 | return; |
| 1487 | } | 1485 | } |
| 1488 | add_const_type(c, type_name, child_type); | 1486 | add_const_type(c, type_name, child_type); |
| ... | @@ -1663,7 +1661,7 @@ static TypeTableEntry *resolve_record_decl(Context *c, const RecordDecl *record_ | ... | @@ -1663,7 +1661,7 @@ static TypeTableEntry *resolve_record_decl(Context *c, const RecordDecl *record_ |
| 1663 | const char *raw_name = decl_name(record_decl); | 1661 | const char *raw_name = decl_name(record_decl); |
| 1664 | | 1662 | |
| 1665 | if (!record_decl->isStruct()) { | 1663 | if (!record_decl->isStruct()) { |
| 1666 | emit_warning(c, record_decl, "skipping record %s, not a struct", raw_name); | 1664 | emit_warning(c, record_decl->getLocation(), "skipping record %s, not a struct", raw_name); |
| 1667 | return c->codegen->builtin_types.entry_invalid; | 1665 | return c->codegen->builtin_types.entry_invalid; |
| 1668 | } | 1666 | } |
| 1669 | | 1667 | |
| ... | @@ -1702,7 +1700,7 @@ static TypeTableEntry *resolve_record_decl(Context *c, const RecordDecl *record_ | ... | @@ -1702,7 +1700,7 @@ static TypeTableEntry *resolve_record_decl(Context *c, const RecordDecl *record_ |
| 1702 | const FieldDecl *field_decl = *it; | 1700 | const FieldDecl *field_decl = *it; |
| 1703 | | 1701 | |
| 1704 | if (field_decl->isBitField()) { | 1702 | if (field_decl->isBitField()) { |
| 1705 | emit_warning(c, field_decl, "struct %s demoted to opaque type - has bitfield\n", buf_ptr(bare_name)); | 1703 | emit_warning(c, field_decl->getLocation(), "struct %s demoted to opaque type - has bitfield\n", buf_ptr(bare_name)); |
| 1706 | replace_with_fwd_decl(c, struct_type, full_type_name); | 1704 | replace_with_fwd_decl(c, struct_type, full_type_name); |
| 1707 | return struct_type; | 1705 | return struct_type; |
| 1708 | } | 1706 | } |
| ... | @@ -1729,7 +1727,7 @@ static TypeTableEntry *resolve_record_decl(Context *c, const RecordDecl *record_ | ... | @@ -1729,7 +1727,7 @@ static TypeTableEntry *resolve_record_decl(Context *c, const RecordDecl *record_ |
| 1729 | type_struct_field->type_entry = field_type; | 1727 | type_struct_field->type_entry = field_type; |
| 1730 | | 1728 | |
| 1731 | if (type_is_invalid(field_type) || !type_is_complete(field_type)) { | 1729 | if (type_is_invalid(field_type) || !type_is_complete(field_type)) { |
| 1732 | emit_warning(c, field_decl, "struct %s demoted to opaque type - unresolved type\n", buf_ptr(bare_name)); | 1730 | emit_warning(c, field_decl->getLocation(), "struct %s demoted to opaque type - unresolved type\n", buf_ptr(bare_name)); |
| 1733 | replace_with_fwd_decl(c, struct_type, full_type_name); | 1731 | replace_with_fwd_decl(c, struct_type, full_type_name); |
| 1734 | return struct_type; | 1732 | return struct_type; |
| 1735 | } | 1733 | } |
| ... | @@ -1810,17 +1808,17 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { | ... | @@ -1810,17 +1808,17 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { |
| 1810 | case VarDecl::TLS_None: | 1808 | case VarDecl::TLS_None: |
| 1811 | break; | 1809 | break; |
| 1812 | case VarDecl::TLS_Static: | 1810 | case VarDecl::TLS_Static: |
| 1813 | emit_warning(c, var_decl, "ignoring variable '%s' - static thread local storage\n", buf_ptr(name)); | 1811 | emit_warning(c, var_decl->getLocation(), "ignoring variable '%s' - static thread local storage\n", buf_ptr(name)); |
| 1814 | return; | 1812 | return; |
| 1815 | case VarDecl::TLS_Dynamic: | 1813 | case VarDecl::TLS_Dynamic: |
| 1816 | emit_warning(c, var_decl, "ignoring variable '%s' - dynamic thread local storage\n", buf_ptr(name)); | 1814 | emit_warning(c, var_decl->getLocation(), "ignoring variable '%s' - dynamic thread local storage\n", buf_ptr(name)); |
| 1817 | return; | 1815 | return; |
| 1818 | } | 1816 | } |
| 1819 | | 1817 | |
| 1820 | QualType qt = var_decl->getType(); | 1818 | QualType qt = var_decl->getType(); |
| 1821 | TypeTableEntry *var_type = resolve_qual_type(c, qt, var_decl); | 1819 | TypeTableEntry *var_type = resolve_qual_type(c, qt, var_decl); |
| 1822 | if (var_type->id == TypeTableEntryIdInvalid) { | 1820 | if (var_type->id == TypeTableEntryIdInvalid) { |
| 1823 | emit_warning(c, var_decl, "ignoring variable '%s' - unresolved type\n", buf_ptr(name)); | 1821 | emit_warning(c, var_decl->getLocation(), "ignoring variable '%s' - unresolved type\n", buf_ptr(name)); |
| 1824 | return; | 1822 | return; |
| 1825 | } | 1823 | } |
| 1826 | | 1824 | |
| ... | @@ -1830,12 +1828,12 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { | ... | @@ -1830,12 +1828,12 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { |
| 1830 | | 1828 | |
| 1831 | if (is_static && !is_extern) { | 1829 | if (is_static && !is_extern) { |
| 1832 | if (!var_decl->hasInit()) { | 1830 | if (!var_decl->hasInit()) { |
| 1833 | emit_warning(c, var_decl, "ignoring variable '%s' - no initializer\n", buf_ptr(name)); | 1831 | emit_warning(c, var_decl->getLocation(), "ignoring variable '%s' - no initializer\n", buf_ptr(name)); |
| 1834 | return; | 1832 | return; |
| 1835 | } | 1833 | } |
| 1836 | APValue *ap_value = var_decl->evaluateValue(); | 1834 | APValue *ap_value = var_decl->evaluateValue(); |
| 1837 | if (!ap_value) { | 1835 | if (!ap_value) { |
| 1838 | emit_warning(c, var_decl, "ignoring variable '%s' - unable to evaluate initializer\n", buf_ptr(name)); | 1836 | emit_warning(c, var_decl->getLocation(), "ignoring variable '%s' - unable to evaluate initializer\n", buf_ptr(name)); |
| 1839 | return; | 1837 | return; |
| 1840 | } | 1838 | } |
| 1841 | ConstExprValue *init_value = nullptr; | 1839 | ConstExprValue *init_value = nullptr; |
| ... | @@ -1843,7 +1841,7 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { | ... | @@ -1843,7 +1841,7 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { |
| 1843 | case APValue::Int: | 1841 | case APValue::Int: |
| 1844 | { | 1842 | { |
| 1845 | if (var_type->id != TypeTableEntryIdInt) { | 1843 | if (var_type->id != TypeTableEntryIdInt) { |
| 1846 | emit_warning(c, var_decl, | 1844 | emit_warning(c, var_decl->getLocation(), |
| 1847 | "ignoring variable '%s' - int initializer for non int type\n", buf_ptr(name)); | 1845 | "ignoring variable '%s' - int initializer for non int type\n", buf_ptr(name)); |
| 1848 | return; | 1846 | return; |
| 1849 | } | 1847 | } |
| ... | @@ -1864,7 +1862,7 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { | ... | @@ -1864,7 +1862,7 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { |
| 1864 | case APValue::Union: | 1862 | case APValue::Union: |
| 1865 | case APValue::MemberPointer: | 1863 | case APValue::MemberPointer: |
| 1866 | case APValue::AddrLabelDiff: | 1864 | case APValue::AddrLabelDiff: |
| 1867 | emit_warning(c, var_decl, | 1865 | emit_warning(c, var_decl->getLocation(), |
| 1868 | "ignoring variable '%s' - unrecognized initializer value kind\n", buf_ptr(name)); | 1866 | "ignoring variable '%s' - unrecognized initializer value kind\n", buf_ptr(name)); |
| 1869 | return; | 1867 | return; |
| 1870 | } | 1868 | } |
| ... | @@ -1881,7 +1879,7 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { | ... | @@ -1881,7 +1879,7 @@ static void visit_var_decl(Context *c, const VarDecl *var_decl) { |
| 1881 | return; | 1879 | return; |
| 1882 | } | 1880 | } |
| 1883 | | 1881 | |
| 1884 | emit_warning(c, var_decl, "ignoring variable '%s' - non-extern, non-static variable\n", buf_ptr(name)); | 1882 | emit_warning(c, var_decl->getLocation(), "ignoring variable '%s' - non-extern, non-static variable\n", buf_ptr(name)); |
| 1885 | return; | 1883 | return; |
| 1886 | } | 1884 | } |
| 1887 | | 1885 | |
| ... | @@ -1905,7 +1903,7 @@ static bool decl_visitor(void *context, const Decl *decl) { | ... | @@ -1905,7 +1903,7 @@ static bool decl_visitor(void *context, const Decl *decl) { |
| 1905 | visit_var_decl(c, static_cast<const VarDecl *>(decl)); | 1903 | visit_var_decl(c, static_cast<const VarDecl *>(decl)); |
| 1906 | break; | 1904 | break; |
| 1907 | default: | 1905 | default: |
| 1908 | emit_warning(c, decl, "ignoring %s decl\n", decl->getDeclKindName()); | 1906 | emit_warning(c, decl->getLocation(), "ignoring %s decl\n", decl->getDeclKindName()); |
| 1909 | } | 1907 | } |
| 1910 | | 1908 | |
| 1911 | return true; | 1909 | return true; |