@@ -30,12 +30,15 @@ void swiftscan_scanner_dispose(swiftscan_scanner_t c_scanner) {
30
30
31
31
swiftscan_dependency_result_t
32
32
swiftscan_scan_dependencies (swiftscan_scanner_t *scanner,
33
- const char *working_directory, int argc,
34
- const char *const *argv) {
33
+ swiftscan_scan_invocation_t invocation) {
35
34
DependencyScanningTool *ScanningTool = unwrap_scanner (scanner);
35
+ swiftscan_impl_scan_invocation_t *InvocationImpl =
36
+ unwrap_scan_invocation (invocation);
37
+ int argc = InvocationImpl->argv ->count ;
36
38
std::vector<const char *> Compilation;
37
39
for (int i = 0 ; i < argc; ++i)
38
- Compilation.push_back (argv[i]);
40
+ Compilation.push_back (
41
+ swiftscan_get_C_string (InvocationImpl->argv ->strings [i]));
39
42
40
43
// Execute the scan and bridge the result
41
44
auto ScanResult = ScanningTool->getDependencies (Compilation, {});
@@ -47,13 +50,16 @@ swiftscan_scan_dependencies(swiftscan_scanner_t *scanner,
47
50
48
51
swiftscan_batch_scan_result_t *
49
52
swiftscan_batch_scan_dependencies (swiftscan_scanner_t *scanner,
50
- const char *working_directory,
51
53
swiftscan_batch_scan_input_t *batch_input,
52
- int argc, const char * const *argv ) {
54
+ swiftscan_scan_invocation_t invocation ) {
53
55
DependencyScanningTool *ScanningTool = unwrap_scanner (scanner);
56
+ swiftscan_impl_scan_invocation_t *InvocationImpl =
57
+ unwrap_scan_invocation (invocation);
58
+ int argc = InvocationImpl->argv ->count ;
54
59
std::vector<const char *> Compilation;
55
60
for (int i = 0 ; i < argc; ++i)
56
- Compilation.push_back (argv[i]);
61
+ Compilation.push_back (
62
+ swiftscan_get_C_string (InvocationImpl->argv ->strings [i]));
57
63
58
64
std::vector<BatchScanInput> BatchInput;
59
65
for (int i = 0 ; i < batch_input->count ; ++i) {
@@ -83,12 +89,15 @@ swiftscan_batch_scan_dependencies(swiftscan_scanner_t *scanner,
83
89
84
90
swiftscan_prescan_result_t
85
91
swiftscan_prescan_dependencies (swiftscan_scanner_t *scanner,
86
- const char *working_directory, int argc,
87
- const char *const *argv) {
92
+ swiftscan_scan_invocation_t invocation) {
88
93
DependencyScanningTool *ScanningTool = unwrap_scanner (scanner);
94
+ swiftscan_impl_scan_invocation_t *InvocationImpl =
95
+ unwrap_scan_invocation (invocation);
96
+ int argc = InvocationImpl->argv ->count ;
89
97
std::vector<const char *> Compilation;
90
98
for (int i = 0 ; i < argc; ++i)
91
- Compilation.push_back (argv[i]);
99
+ Compilation.push_back (
100
+ swiftscan_get_C_string (InvocationImpl->argv ->strings [i]));
92
101
93
102
// Execute the scan and bridge the result
94
103
auto PreScanResult = ScanningTool->getImports (Compilation);
@@ -261,6 +270,22 @@ swiftscan_prescan_result_get_import_set(swiftscan_prescan_result_t result) {
261
270
return unwrap_prescan_result (result)->import_set ;
262
271
}
263
272
273
+ // === Scanner Invocation Functions ----------------------------------------===//
274
+
275
+ swiftscan_string_t swiftscan_scan_invocation_get_working_directory (
276
+ swiftscan_scan_invocation_t invocation) {
277
+ return unwrap_scan_invocation (invocation)->working_directory ;
278
+ }
279
+
280
+ int swiftscan_scan_invocation_get_argc (swiftscan_scan_invocation_t invocation) {
281
+ return unwrap_scan_invocation (invocation)->argv ->count ;
282
+ }
283
+
284
+ swiftscan_string_set_t *
285
+ swiftscan_scan_invocation_get_argv (swiftscan_scan_invocation_t invocation) {
286
+ return unwrap_scan_invocation (invocation)->argv ;
287
+ }
288
+
264
289
// === Cleanup Functions ---------------------------------------------------===//
265
290
266
291
void swiftscan_dependency_info_details_dispose (
@@ -363,3 +388,11 @@ void swiftscan_batch_scan_result_dispose(
363
388
delete[] result->results ;
364
389
delete result;
365
390
}
391
+
392
+ void swiftscan_scan_invocation_dispose (swiftscan_scan_invocation_t invocation) {
393
+ swiftscan_impl_scan_invocation_t *invocation_impl =
394
+ unwrap_scan_invocation (invocation);
395
+ swiftscan_string_dispose (invocation_impl->working_directory );
396
+ swiftscan_string_set_dispose (invocation_impl->argv );
397
+ delete invocation_impl;
398
+ }
0 commit comments