|
1 | 1 | #![allow(non_camel_case_types)]
|
2 | 2 | #![allow(non_upper_case_globals)]
|
3 | 3 |
|
4 |
| -use crate::coverageinfo::map_data as coverage_map; |
5 |
| - |
6 | 4 | use super::debuginfo::{
|
7 | 5 | DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator,
|
8 | 6 | DIFile, DIFlags, DIGlobalVariableExpression, DILexicalBlock, DILocation, DINameSpace,
|
@@ -688,204 +686,6 @@ extern "C" {
|
688 | 686 | pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
|
689 | 687 | pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
|
690 | 688 |
|
691 |
| -pub mod coverageinfo { |
692 |
| - use super::coverage_map; |
693 |
| - |
694 |
| - /// Corresponds to enum `llvm::coverage::CounterMappingRegion::RegionKind`. |
695 |
| - /// |
696 |
| - /// Must match the layout of `LLVMRustCounterMappingRegionKind`. |
697 |
| - #[derive(Copy, Clone, Debug)] |
698 |
| - #[repr(C)] |
699 |
| - pub enum RegionKind { |
700 |
| - /// A CodeRegion associates some code with a counter |
701 |
| - CodeRegion = 0, |
702 |
| - |
703 |
| - /// An ExpansionRegion represents a file expansion region that associates |
704 |
| - /// a source range with the expansion of a virtual source file, such as |
705 |
| - /// for a macro instantiation or #include file. |
706 |
| - ExpansionRegion = 1, |
707 |
| - |
708 |
| - /// A SkippedRegion represents a source range with code that was skipped |
709 |
| - /// by a preprocessor or similar means. |
710 |
| - SkippedRegion = 2, |
711 |
| - |
712 |
| - /// A GapRegion is like a CodeRegion, but its count is only set as the |
713 |
| - /// line execution count when its the only region in the line. |
714 |
| - GapRegion = 3, |
715 |
| - |
716 |
| - /// A BranchRegion represents leaf-level boolean expressions and is |
717 |
| - /// associated with two counters, each representing the number of times the |
718 |
| - /// expression evaluates to true or false. |
719 |
| - BranchRegion = 4, |
720 |
| - } |
721 |
| - |
722 |
| - /// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the |
723 |
| - /// coverage map, in accordance with the |
724 |
| - /// [LLVM Code Coverage Mapping Format](https://github.com/rust-lang/llvm-project/blob/rustc/13.0-2021-09-30/llvm/docs/CoverageMappingFormat.rst#llvm-code-coverage-mapping-format). |
725 |
| - /// The struct composes fields representing the `Counter` type and value(s) (injected counter |
726 |
| - /// ID, or expression type and operands), the source file (an indirect index into a "filenames |
727 |
| - /// array", encoded separately), and source location (start and end positions of the represented |
728 |
| - /// code region). |
729 |
| - /// |
730 |
| - /// Corresponds to struct `llvm::coverage::CounterMappingRegion`. |
731 |
| - /// |
732 |
| - /// Must match the layout of `LLVMRustCounterMappingRegion`. |
733 |
| - #[derive(Copy, Clone, Debug)] |
734 |
| - #[repr(C)] |
735 |
| - pub struct CounterMappingRegion { |
736 |
| - /// The counter type and type-dependent counter data, if any. |
737 |
| - counter: coverage_map::Counter, |
738 |
| - |
739 |
| - /// If the `RegionKind` is a `BranchRegion`, this represents the counter |
740 |
| - /// for the false branch of the region. |
741 |
| - false_counter: coverage_map::Counter, |
742 |
| - |
743 |
| - /// An indirect reference to the source filename. In the LLVM Coverage Mapping Format, the |
744 |
| - /// file_id is an index into a function-specific `virtual_file_mapping` array of indexes |
745 |
| - /// that, in turn, are used to look up the filename for this region. |
746 |
| - file_id: u32, |
747 |
| - |
748 |
| - /// If the `RegionKind` is an `ExpansionRegion`, the `expanded_file_id` can be used to find |
749 |
| - /// the mapping regions created as a result of macro expansion, by checking if their file id |
750 |
| - /// matches the expanded file id. |
751 |
| - expanded_file_id: u32, |
752 |
| - |
753 |
| - /// 1-based starting line of the mapping region. |
754 |
| - start_line: u32, |
755 |
| - |
756 |
| - /// 1-based starting column of the mapping region. |
757 |
| - start_col: u32, |
758 |
| - |
759 |
| - /// 1-based ending line of the mapping region. |
760 |
| - end_line: u32, |
761 |
| - |
762 |
| - /// 1-based ending column of the mapping region. If the high bit is set, the current |
763 |
| - /// mapping region is a gap area. |
764 |
| - end_col: u32, |
765 |
| - |
766 |
| - kind: RegionKind, |
767 |
| - } |
768 |
| - |
769 |
| - impl CounterMappingRegion { |
770 |
| - pub(crate) fn code_region( |
771 |
| - counter: coverage_map::Counter, |
772 |
| - file_id: u32, |
773 |
| - start_line: u32, |
774 |
| - start_col: u32, |
775 |
| - end_line: u32, |
776 |
| - end_col: u32, |
777 |
| - ) -> Self { |
778 |
| - Self { |
779 |
| - counter, |
780 |
| - false_counter: coverage_map::Counter::zero(), |
781 |
| - file_id, |
782 |
| - expanded_file_id: 0, |
783 |
| - start_line, |
784 |
| - start_col, |
785 |
| - end_line, |
786 |
| - end_col, |
787 |
| - kind: RegionKind::CodeRegion, |
788 |
| - } |
789 |
| - } |
790 |
| - |
791 |
| - // This function might be used in the future; the LLVM API is still evolving, as is coverage |
792 |
| - // support. |
793 |
| - #[allow(dead_code)] |
794 |
| - pub(crate) fn branch_region( |
795 |
| - counter: coverage_map::Counter, |
796 |
| - false_counter: coverage_map::Counter, |
797 |
| - file_id: u32, |
798 |
| - start_line: u32, |
799 |
| - start_col: u32, |
800 |
| - end_line: u32, |
801 |
| - end_col: u32, |
802 |
| - ) -> Self { |
803 |
| - Self { |
804 |
| - counter, |
805 |
| - false_counter, |
806 |
| - file_id, |
807 |
| - expanded_file_id: 0, |
808 |
| - start_line, |
809 |
| - start_col, |
810 |
| - end_line, |
811 |
| - end_col, |
812 |
| - kind: RegionKind::BranchRegion, |
813 |
| - } |
814 |
| - } |
815 |
| - |
816 |
| - // This function might be used in the future; the LLVM API is still evolving, as is coverage |
817 |
| - // support. |
818 |
| - #[allow(dead_code)] |
819 |
| - pub(crate) fn expansion_region( |
820 |
| - file_id: u32, |
821 |
| - expanded_file_id: u32, |
822 |
| - start_line: u32, |
823 |
| - start_col: u32, |
824 |
| - end_line: u32, |
825 |
| - end_col: u32, |
826 |
| - ) -> Self { |
827 |
| - Self { |
828 |
| - counter: coverage_map::Counter::zero(), |
829 |
| - false_counter: coverage_map::Counter::zero(), |
830 |
| - file_id, |
831 |
| - expanded_file_id, |
832 |
| - start_line, |
833 |
| - start_col, |
834 |
| - end_line, |
835 |
| - end_col, |
836 |
| - kind: RegionKind::ExpansionRegion, |
837 |
| - } |
838 |
| - } |
839 |
| - |
840 |
| - // This function might be used in the future; the LLVM API is still evolving, as is coverage |
841 |
| - // support. |
842 |
| - #[allow(dead_code)] |
843 |
| - pub(crate) fn skipped_region( |
844 |
| - file_id: u32, |
845 |
| - start_line: u32, |
846 |
| - start_col: u32, |
847 |
| - end_line: u32, |
848 |
| - end_col: u32, |
849 |
| - ) -> Self { |
850 |
| - Self { |
851 |
| - counter: coverage_map::Counter::zero(), |
852 |
| - false_counter: coverage_map::Counter::zero(), |
853 |
| - file_id, |
854 |
| - expanded_file_id: 0, |
855 |
| - start_line, |
856 |
| - start_col, |
857 |
| - end_line, |
858 |
| - end_col, |
859 |
| - kind: RegionKind::SkippedRegion, |
860 |
| - } |
861 |
| - } |
862 |
| - |
863 |
| - // This function might be used in the future; the LLVM API is still evolving, as is coverage |
864 |
| - // support. |
865 |
| - #[allow(dead_code)] |
866 |
| - pub(crate) fn gap_region( |
867 |
| - counter: coverage_map::Counter, |
868 |
| - file_id: u32, |
869 |
| - start_line: u32, |
870 |
| - start_col: u32, |
871 |
| - end_line: u32, |
872 |
| - end_col: u32, |
873 |
| - ) -> Self { |
874 |
| - Self { |
875 |
| - counter, |
876 |
| - false_counter: coverage_map::Counter::zero(), |
877 |
| - file_id, |
878 |
| - expanded_file_id: 0, |
879 |
| - start_line, |
880 |
| - start_col, |
881 |
| - end_line, |
882 |
| - end_col: (1_u32 << 31) | end_col, |
883 |
| - kind: RegionKind::GapRegion, |
884 |
| - } |
885 |
| - } |
886 |
| - } |
887 |
| -} |
888 |
| - |
889 | 689 | pub mod debuginfo {
|
890 | 690 | use super::{InvariantOpaque, Metadata};
|
891 | 691 | use bitflags::bitflags;
|
@@ -1911,9 +1711,9 @@ extern "C" {
|
1911 | 1711 | pub fn LLVMRustCoverageWriteMappingToBuffer(
|
1912 | 1712 | VirtualFileMappingIDs: *const c_uint,
|
1913 | 1713 | NumVirtualFileMappingIDs: c_uint,
|
1914 |
| - Expressions: *const coverage_map::CounterExpression, |
| 1714 | + Expressions: *const crate::coverageinfo::ffi::CounterExpression, |
1915 | 1715 | NumExpressions: c_uint,
|
1916 |
| - MappingRegions: *const coverageinfo::CounterMappingRegion, |
| 1716 | + MappingRegions: *const crate::coverageinfo::ffi::CounterMappingRegion, |
1917 | 1717 | NumMappingRegions: c_uint,
|
1918 | 1718 | BufferOut: &RustString,
|
1919 | 1719 | );
|
|
0 commit comments