18
18
#ifndef SWIFT_C_DEPENDENCY_SCAN_H
19
19
#define SWIFT_C_DEPENDENCY_SCAN_H
20
20
21
- #include "DependencyScanMacros.h"
22
21
#include "DSString.h"
22
+ #include "DependencyScanMacros.h"
23
23
#include <stdbool.h>
24
24
#include <stddef.h>
25
25
#include <stdint.h>
32
32
33
33
DEPSCAN_BEGIN_DECLS
34
34
35
- //=== Scanner Data Types ------- -------------------------------------------===//
35
+ //=== Public Scanner Data Types -------------------------------------------===//
36
36
37
37
typedef enum {
38
38
DEPSCAN_DEPENDENCY_INFO_SWIFT_TEXTUAL = 0 ,
39
39
DEPSCAN_DEPENDENCY_INFO_SWIFT_BINARY = 1 ,
40
40
DEPSCAN_DEPENDENCY_INFO_SWIFT_PLACEHOLDER = 2 ,
41
41
DEPSCAN_DEPENDENCY_INFO_CLANG = 3
42
- } depscan_dependency_info_kind_t ;
43
-
44
- /// Swift modules to be built from a module interface, may have a bridging
45
- /// header.
46
- typedef struct {
47
- /// The module interface from which this module was built, if any.
48
- ds_string_t module_interface_path ;
49
-
50
- /// The paths of potentially ready-to-use compiled modules for the interface.
51
- ds_string_set_t * compiled_module_candidates ;
52
-
53
- /// The bridging header, if any.
54
- ds_string_t bridging_header_path ;
55
-
56
- /// The source files referenced by the bridging header.
57
- ds_string_set_t * bridging_source_files ;
42
+ } ds_dependency_info_kind_t ;
58
43
59
- /// (Clang) modules on which the bridging header depends.
60
- ds_string_set_t * bridging_module_dependencies ;
61
-
62
- /// Options to the compile command required to build this module interface
63
- ds_string_set_t * command_line ;
64
-
65
- /// To build a PCM to be used by this Swift module, we need to append these
66
- /// arguments to the generic PCM build arguments reported from the dependency
67
- /// graph.
68
- ds_string_set_t * extra_pcm_args ;
69
-
70
- /// The hash value that will be used for the generated module
71
- ds_string_t context_hash ;
72
-
73
- /// A flag to indicate whether or not this module is a framework.
74
- bool is_framework ;
75
- } depscan_swift_textual_details_t ;
76
-
77
- /// Swift modules with only a binary module file.
78
- typedef struct {
79
- /// The path to the pre-compiled binary module
80
- ds_string_t compiled_module_path ;
81
-
82
- /// The path to the .swiftModuleDoc file.
83
- ds_string_t module_doc_path ;
84
-
85
- /// The path to the .swiftSourceInfo file.
86
- ds_string_t module_source_info_path ;
87
- } depscan_swift_binary_details_t ;
88
-
89
- /// Swift placeholder modules carry additional details that specify their
90
- /// module doc path and source info paths.
91
- typedef struct {
92
- /// The path to the pre-compiled binary module
93
- ds_string_t compiled_module_path ;
94
-
95
- /// The path to the .swiftModuleDoc file.
96
- ds_string_t module_doc_path ;
97
-
98
- /// The path to the .swiftSourceInfo file.
99
- ds_string_t module_source_info_path ;
100
- } depscan_swift_placeholder_details_t ;
101
-
102
- /// Clang modules are built from a module map file.
103
- typedef struct {
104
- /// The path to the module map used to build this module.
105
- ds_string_t module_map_path ;
106
-
107
- /// clang-generated context hash
108
- ds_string_t context_hash ;
109
-
110
- /// Options to the compile command required to build this clang modulemap
111
- ds_string_set_t * command_line ;
112
- } depscan_clang_details_t ;
113
-
114
- typedef struct {
115
- depscan_dependency_info_kind_t kind ;
116
- union {
117
- depscan_swift_textual_details_t swift_textual_details ;
118
- depscan_swift_binary_details_t swift_binary_details ;
119
- depscan_swift_placeholder_details_t swift_placeholder_details ;
120
- depscan_clang_details_t clang_details ;
121
- };
122
- } depscan_module_details_t ;
44
+ /// Opaque container of the details specific to a given module dependency.
45
+ typedef void * ds_module_details_t ;
123
46
124
47
typedef struct {
125
48
/// The module's name
@@ -136,78 +59,139 @@ typedef struct {
136
59
ds_string_t module_path ;
137
60
138
61
/// The source files used to build this module.
139
- ds_string_set_t * source_files ;
62
+ ds_string_set_t * source_files ;
140
63
141
64
/**
142
65
* The list of modules which this module direct depends on.
143
66
* The format is:
144
67
* `<module-kind>:<module-name>`
145
68
*/
146
- ds_string_set_t * direct_dependencies ;
69
+ ds_string_set_t * direct_dependencies ;
147
70
148
71
/// Specific details of a particular kind of module.
149
- depscan_module_details_t * details ;
150
- } depscan_dependency_info_t ;
72
+ ds_module_details_t details ;
73
+ } ds_dependency_info_t ;
151
74
152
75
/// Full Dependency Graph (Result)
153
76
154
77
typedef struct {
155
78
int count ;
156
- depscan_dependency_info_t * modules ;
157
- } depscan_dependency_set_t ;
79
+ ds_dependency_info_t * modules ;
80
+ } ds_dependency_set_t ;
158
81
159
82
typedef struct {
160
83
/// The name of the main module for this dependency graph (root node)
161
84
ds_string_t main_module_name ;
162
85
163
86
/// The complete list of modules discovered
164
- depscan_dependency_set_t * module_set ;
165
- } depscan_dependency_result_t ;
87
+ ds_dependency_set_t * module_set ;
88
+ } ds_dependency_result_t ;
166
89
167
90
typedef struct {
168
91
/// The complete list of imports discovered
169
- ds_string_set_t * import_set ;
170
- } depscan_prescan_result_t ;
92
+ ds_string_set_t * import_set ;
93
+ } ds_prescan_result_t ;
171
94
172
95
//=== Dependency Result Functions -----------------------------------------===//
173
96
174
- DEPSCAN_PUBLIC void
175
- depscan_dependency_info_details_dispose ( depscan_module_details_t * details );
97
+ DEPSCAN_PUBLIC ds_dependency_info_kind_t
98
+ ds_get_module_detail_kind ( ds_module_details_t details );
176
99
177
- DEPSCAN_PUBLIC void
178
- depscan_dependency_info_dispose (depscan_dependency_info_t * info );
100
+ //=== Swift Textual Module Details query APIs -----------------------------===//
101
+ DEPSCAN_PUBLIC ds_string_t
102
+ ds_get_swift_textual_detail_module_interface_path (ds_module_details_t details );
179
103
180
- DEPSCAN_PUBLIC void
181
- depscan_dependency_set_dispose (depscan_dependency_set_t * set );
104
+ DEPSCAN_PUBLIC ds_string_set_t *
105
+ ds_get_swift_textual_detail_compiled_module_candidates (
106
+ ds_module_details_t details );
107
+
108
+ DEPSCAN_PUBLIC ds_string_t
109
+ ds_get_swift_textual_detail_bridging_header_path (ds_module_details_t details );
110
+
111
+ DEPSCAN_PUBLIC ds_string_set_t *
112
+ ds_get_swift_textual_detail_bridging_source_files (ds_module_details_t details );
113
+
114
+ DEPSCAN_PUBLIC ds_string_set_t *
115
+ ds_get_swift_textual_detail_bridging_module_dependencies (
116
+ ds_module_details_t details );
117
+
118
+ DEPSCAN_PUBLIC ds_string_set_t *
119
+ ds_get_swift_textual_detail_command_line (ds_module_details_t details );
120
+
121
+ DEPSCAN_PUBLIC ds_string_set_t *
122
+ ds_get_swift_textual_detail_extra_pcm_args (ds_module_details_t details );
123
+
124
+ DEPSCAN_PUBLIC ds_string_t
125
+ ds_get_swift_textual_detail_context_hash (ds_module_details_t details );
126
+
127
+ DEPSCAN_PUBLIC bool
128
+ ds_get_swift_textual_detail_is_framework (ds_module_details_t details );
129
+
130
+ //=== Swift Binary Module Details query APIs ------------------------------===//
131
+
132
+ DEPSCAN_PUBLIC ds_string_t
133
+ ds_get_swift_binary_detail_compiled_module_path (ds_module_details_t details );
134
+
135
+ DEPSCAN_PUBLIC ds_string_t
136
+ ds_get_swift_binary_detail_module_doc_path (ds_module_details_t details );
137
+
138
+ DEPSCAN_PUBLIC ds_string_t ds_get_swift_binary_detail_module_source_info_path (
139
+ ds_module_details_t * details );
140
+
141
+ //=== Swift Placeholder Module Details query APIs -------------------------===//
142
+
143
+ DEPSCAN_PUBLIC ds_string_t ds_get_swift_placeholder_detail_compiled_module_path (
144
+ ds_module_details_t details );
145
+
146
+ DEPSCAN_PUBLIC ds_string_t
147
+ ds_get_swift_placeholder_detail_module_doc_path (ds_module_details_t details );
148
+
149
+ DEPSCAN_PUBLIC ds_string_t
150
+ ds_get_swift_placeholder_detail_module_source_info_path (
151
+ ds_module_details_t details );
152
+
153
+ //=== Clang Module Details query APIs -------------------------------------===//
154
+
155
+ DEPSCAN_PUBLIC ds_string_t
156
+ ds_get_clang_detail_module_map_path (ds_module_details_t details );
157
+
158
+ DEPSCAN_PUBLIC ds_string_t
159
+ ds_get_clang_detail_context_hash (ds_module_details_t details );
160
+
161
+ DEPSCAN_PUBLIC ds_string_set_t *
162
+ ds_get_clang_detail_command_line (ds_module_details_t details );
163
+
164
+ //=== Cleanup Functions ---------------------------------------------------===//
182
165
183
166
DEPSCAN_PUBLIC void
184
- depscan_dependency_result_dispose (depscan_dependency_result_t * result );
167
+ ds_dependency_info_details_dispose (ds_module_details_t details );
168
+
169
+ DEPSCAN_PUBLIC void ds_dependency_info_dispose (ds_dependency_info_t * info );
170
+
171
+ DEPSCAN_PUBLIC void ds_dependency_set_dispose (ds_dependency_set_t * set );
185
172
186
173
DEPSCAN_PUBLIC void
187
- depscan_prescan_result_dispose (depscan_prescan_result_t * result );
174
+ ds_dependency_result_dispose (ds_dependency_result_t * result );
175
+
176
+ DEPSCAN_PUBLIC void ds_prescan_result_dispose (ds_prescan_result_t * result );
188
177
189
178
//=== Scanner Functions ---------------------------------------------------===//
190
179
191
- /// Container of the configuration state and shared cache for dependency scanning.
192
- typedef void * depscan_scanner_t ;
180
+ /// Container of the configuration state and shared cache for dependency
181
+ /// scanning.
182
+ typedef void * ds_scanner_t ;
193
183
194
- DEPSCAN_PUBLIC depscan_scanner_t
195
- depscan_scanner_create (void );
184
+ DEPSCAN_PUBLIC ds_scanner_t ds_scanner_create (void );
196
185
197
- DEPSCAN_PUBLIC void
198
- depscan_scanner_dispose (depscan_scanner_t );
199
-
200
- DEPSCAN_PUBLIC depscan_dependency_result_t *
201
- depscan_scan_dependencies (depscan_scanner_t * scanner ,
202
- const char * working_directory ,
203
- int argc ,
204
- const char * const * argv );
205
-
206
- DEPSCAN_PUBLIC depscan_prescan_result_t *
207
- depscan_prescan_dependencies (depscan_scanner_t * scanner ,
208
- const char * working_directory ,
209
- int argc ,
210
- const char * const * argv );
186
+ DEPSCAN_PUBLIC void ds_scanner_dispose (ds_scanner_t );
187
+
188
+ DEPSCAN_PUBLIC ds_dependency_result_t *
189
+ ds_scan_dependencies (ds_scanner_t * scanner , const char * working_directory ,
190
+ int argc , const char * const * argv );
191
+
192
+ DEPSCAN_PUBLIC ds_prescan_result_t *
193
+ ds_prescan_dependencies (ds_scanner_t * scanner , const char * working_directory ,
194
+ int argc , const char * const * argv );
211
195
212
196
DEPSCAN_END_DECLS
213
197
0 commit comments