|
24 | 24 | -- units, using the procedures defined here, which will result in a crash (all
|
25 | 25 | -- the procedures are empty stubs raising an error).
|
26 | 26 |
|
| 27 | +with GNATCOLL.Projects; use GNATCOLL.Projects; |
| 28 | + |
27 | 29 | with Instrument.Base_Types; use Instrument.Base_Types;
|
28 | 30 | with Instrument.Common; use Instrument.Common;
|
| 31 | +with Switches; use Switches; |
29 | 32 |
|
30 | 33 | private package Instrument.C is
|
31 |
| - type C_Source_Decision is null record; |
32 | 34 |
|
33 |
| - type C_Source_Condition is null record; |
| 35 | + type C_Family_Instrumenter_Type is |
| 36 | + abstract new Language_Instrumenter with null record; |
| 37 | + -- Common instrumentation primitives for C/C++ |
34 | 38 |
|
35 |
| - type C_Unit_Inst_Context is null record; |
| 39 | + overriding function Skip_Source_File |
| 40 | + (Self : C_Family_Instrumenter_Type; |
| 41 | + Source_File : GNATCOLL.Projects.File_Info) return Boolean; |
36 | 42 |
|
37 |
| - type C_Source_Rewriter is tagged limited null record; |
| 43 | + overriding procedure Instrument_Unit |
| 44 | + (Self : C_Family_Instrumenter_Type; |
| 45 | + CU_Name : Compilation_Unit_Name; |
| 46 | + IC : in out Inst_Context; |
| 47 | + Unit_Info : in out Instrumented_Unit_Info); |
38 | 48 |
|
39 |
| - procedure Add_Auto_Dump_Buffers |
40 |
| - (IC : Inst_Context; |
41 |
| - Info : in out Project_Info; |
42 |
| - Main : Compilation_Unit_Name; |
43 |
| - Rew : C_Source_Rewriter); |
| 49 | + overriding procedure Auto_Dump_Buffers_In_Main |
| 50 | + (Self : C_Family_Instrumenter_Type; |
| 51 | + IC : in out Inst_Context; |
| 52 | + Main : Compilation_Unit_Name; |
| 53 | + Filename : String; |
| 54 | + Info : in out Project_Info); |
44 | 55 |
|
45 |
| - procedure Apply (Self : in out C_Source_Rewriter); |
| 56 | + overriding procedure Emit_Buffers_List_Unit |
| 57 | + (Self : C_Family_Instrumenter_Type; |
| 58 | + IC : in out Inst_Context; |
| 59 | + Root_Project_Info : in out Project_Info); |
46 | 60 |
|
47 |
| - procedure Start_Rewriting |
48 |
| - (Self : out C_Source_Rewriter; |
49 |
| - Info : in out Project_Info; |
50 |
| - Input_Filename : String); |
| 61 | + type C_Instrumenter_Type is |
| 62 | + new C_Family_Instrumenter_Type with null record; |
| 63 | + -- Instrumentation primitives for C |
51 | 64 |
|
52 |
| - procedure Emit_Buffers_List_Unit |
53 |
| - (IC : in out Inst_Context; |
54 |
| - Root_Project_Info : in out Project_Info); |
| 65 | + overriding function Language |
| 66 | + (Self : C_Instrumenter_Type) return Src_Supported_Language |
| 67 | + is (C_Language); |
55 | 68 |
|
56 |
| - procedure Instrument_Unit |
57 |
| - (CU_Name : Compilation_Unit_Name; |
58 |
| - IC : in out Inst_Context; |
59 |
| - Unit_Info : in out Instrumented_Unit_Info); |
| 69 | + type CPP_Instrumenter_Type is |
| 70 | + new C_Family_Instrumenter_Type with null record; |
| 71 | + -- Instrumentation primitives for C++ |
| 72 | + |
| 73 | + overriding function Language |
| 74 | + (Self : CPP_Instrumenter_Type) return Src_Supported_Language |
| 75 | + is (CPP_Language); |
| 76 | + |
| 77 | + C_Instrumenter : aliased constant C_Instrumenter_Type := (null record); |
| 78 | + CPP_Instrumenter : aliased constant CPP_Instrumenter_Type := (null record); |
60 | 79 |
|
61 | 80 | end Instrument.C;
|
0 commit comments