@@ -43,6 +43,10 @@ def NoBatchOption : OptionFlag;
43
43
// The option should not force a full rebuild if added, changed, or removed.
44
44
def DoesNotAffectIncrementalBuild : OptionFlag;
45
45
46
+ // The option's argument is a file-system path that may be affected by the
47
+ // current working directory.
48
+ def ArgumentIsPath : OptionFlag;
49
+
46
50
/////////
47
51
// Options
48
52
@@ -129,47 +133,51 @@ def _DASH_DASH : Option<["--"], "", KIND_REMAINING_ARGS>,
129
133
130
134
def o : JoinedOrSeparate<["-"], "o">,
131
135
Flags<[FrontendOption, AutolinkExtractOption, ModuleWrapOption,
132
- NoInteractiveOption, SwiftFormatOption]>,
136
+ NoInteractiveOption, SwiftFormatOption, ArgumentIsPath ]>,
133
137
HelpText<"Write output to <file>">, MetaVarName<"<file>">;
134
138
135
139
def j : JoinedOrSeparate<["-"], "j">, Flags<[DoesNotAffectIncrementalBuild]>,
136
140
HelpText<"Number of commands to execute in parallel">, MetaVarName<"<n>">;
137
141
138
- def sdk : Separate<["-"], "sdk">, Flags<[FrontendOption]>,
142
+ def sdk : Separate<["-"], "sdk">, Flags<[FrontendOption, ArgumentIsPath ]>,
139
143
HelpText<"Compile against <sdk>">, MetaVarName<"<sdk>">;
140
144
141
145
def swift_version : Separate<["-"], "swift-version">, Flags<[FrontendOption]>,
142
146
HelpText<"Interpret input according to a specific Swift language version number">,
143
147
MetaVarName<"<vers>">;
144
148
145
149
def tools_directory : Separate<["-"], "tools-directory">,
146
- Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
150
+ Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
151
+ ArgumentIsPath]>,
147
152
HelpText<"Look for external executables (ld, clang, binutils) in <directory>">, MetaVarName<"<directory>">;
148
153
149
154
def D : JoinedOrSeparate<["-"], "D">, Flags<[FrontendOption]>,
150
155
HelpText<"Marks a conditional compilation flag as true">;
151
156
152
- def F : JoinedOrSeparate<["-"], "F">, Flags<[FrontendOption]>,
157
+ def F : JoinedOrSeparate<["-"], "F">, Flags<[FrontendOption, ArgumentIsPath ]>,
153
158
HelpText<"Add directory to framework search path">;
154
- def F_EQ : Joined<["-"], "F=">, Flags<[FrontendOption]>, Alias<F>;
159
+ def F_EQ : Joined<["-"], "F=">, Flags<[FrontendOption, ArgumentIsPath]>,
160
+ Alias<F>;
155
161
156
- def Fsystem : Separate<["-"], "Fsystem">, Flags<[FrontendOption]>,
162
+ def Fsystem : Separate<["-"], "Fsystem">,
163
+ Flags<[FrontendOption, ArgumentIsPath]>,
157
164
HelpText<"Add directory to system framework search path">;
158
165
159
- def I : JoinedOrSeparate<["-"], "I">, Flags<[FrontendOption]>,
166
+ def I : JoinedOrSeparate<["-"], "I">, Flags<[FrontendOption, ArgumentIsPath ]>,
160
167
HelpText<"Add directory to the import search path">;
161
- def I_EQ : Joined<["-"], "I=">, Flags<[FrontendOption]>, Alias<I>;
168
+ def I_EQ : Joined<["-"], "I=">, Flags<[FrontendOption, ArgumentIsPath]>,
169
+ Alias<I>;
162
170
163
171
def import_underlying_module : Flag<["-"], "import-underlying-module">,
164
172
Flags<[FrontendOption, NoInteractiveOption]>,
165
173
HelpText<"Implicitly imports the Objective-C half of a module">;
166
174
167
175
def import_objc_header : Separate<["-"], "import-objc-header">,
168
- Flags<[FrontendOption, HelpHidden]>,
176
+ Flags<[FrontendOption, HelpHidden, ArgumentIsPath ]>,
169
177
HelpText<"Implicitly imports an Objective-C header file">;
170
178
171
179
def pch_output_dir: Separate<["-"], "pch-output-dir">,
172
- Flags<[FrontendOption, HelpHidden]>,
180
+ Flags<[FrontendOption, HelpHidden, ArgumentIsPath ]>,
173
181
HelpText<"Directory to persist automatically created precompiled bridging headers">;
174
182
175
183
// FIXME: Unhide this once it doesn't depend on an output file map.
@@ -181,10 +189,11 @@ def nostdimport : Flag<["-"], "nostdimport">, Flags<[FrontendOption]>,
181
189
HelpText<"Don't search the standard library import path for modules">;
182
190
183
191
def output_file_map : Separate<["-"], "output-file-map">,
184
- Flags<[NoInteractiveOption]>,
192
+ Flags<[NoInteractiveOption, ArgumentIsPath ]>,
185
193
HelpText<"A file which specifies the location of outputs">,
186
194
MetaVarName<"<path>">;
187
195
def output_file_map_EQ : Joined<["-"], "output-file-map=">,
196
+ Flags<[NoInteractiveOption, ArgumentIsPath]>,
188
197
Alias<output_file_map>;
189
198
190
199
def save_temps : Flag<["-"], "save-temps">,
@@ -194,7 +203,7 @@ def driver_time_compilation : Flag<["-"], "driver-time-compilation">,
194
203
Flags<[NoInteractiveOption,DoesNotAffectIncrementalBuild]>,
195
204
HelpText<"Prints the total time it took to execute all compilation tasks">;
196
205
def stats_output_dir: Separate<["-"], "stats-output-dir">,
197
- Flags<[FrontendOption, HelpHidden]>,
206
+ Flags<[FrontendOption, HelpHidden, ArgumentIsPath ]>,
198
207
HelpText<"Directory to write unified compilation-statistics files to">;
199
208
def trace_stats_events: Flag<["-"], "trace-stats-events">,
200
209
Flags<[FrontendOption, HelpHidden]>,
@@ -208,28 +217,30 @@ def emit_loaded_module_trace : Flag<["-"], "emit-loaded-module-trace">,
208
217
Flags<[FrontendOption, NoInteractiveOption]>,
209
218
HelpText<"Emit a JSON file containing information about what modules were loaded">;
210
219
def emit_loaded_module_trace_path : Separate<["-"], "emit-loaded-module-trace-path">,
211
- Flags<[FrontendOption, NoInteractiveOption]>,
220
+ Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath ]>,
212
221
HelpText<"Emit the loaded module trace JSON to <path>">,
213
222
MetaVarName<"<path>">;
214
223
def emit_loaded_module_trace_path_EQ : Joined<["-"], "emit-loaded-module-trace-path=">,
215
- Flags<[FrontendOption, NoInteractiveOption]>, Alias<emit_loaded_module_trace_path>;
224
+ Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath]>,
225
+ Alias<emit_loaded_module_trace_path>;
216
226
217
227
def emit_tbd : Flag<["-"], "emit-tbd">,
218
228
HelpText<"Emit a TBD file">,
219
229
Flags<[FrontendOption, NoInteractiveOption]>;
220
230
def emit_tbd_path : Separate<["-"], "emit-tbd-path">,
221
- Flags<[FrontendOption, NoInteractiveOption]>,
231
+ Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath ]>,
222
232
HelpText<"Emit the TBD file to <path>">,
223
233
MetaVarName<"<path>">;
224
234
def emit_tbd_path_EQ : Joined<["-"], "emit-tbd-path=">,
225
- Flags<[FrontendOption, NoInteractiveOption]>, Alias<emit_tbd_path>;
235
+ Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath]>,
236
+ Alias<emit_tbd_path>;
226
237
227
238
def serialize_diagnostics : Flag<["-"], "serialize-diagnostics">,
228
239
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
229
240
HelpText<"Serialize diagnostics in a binary format">;
230
241
231
242
def module_cache_path : Separate<["-"], "module-cache-path">,
232
- Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
243
+ Flags<[FrontendOption, DoesNotAffectIncrementalBuild, ArgumentIsPath ]>,
233
244
HelpText<"Specifies the Clang module cache path">;
234
245
235
246
def module_name : Separate<["-"], "module-name">, Flags<[FrontendOption]>,
@@ -250,17 +261,21 @@ def emit_module : Flag<["-"], "emit-module">,
250
261
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
251
262
HelpText<"Emit an importable module">;
252
263
def emit_module_path : Separate<["-"], "emit-module-path">,
253
- Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
264
+ Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
265
+ ArgumentIsPath]>,
254
266
HelpText<"Emit an importable module to <path>">,
255
267
MetaVarName<"<path>">;
256
268
def emit_module_path_EQ : Joined<["-"], "emit-module-path=">,
257
- Flags<[FrontendOption, NoInteractiveOption]>, Alias<emit_module_path>;
269
+ Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
270
+ ArgumentIsPath]>,
271
+ Alias<emit_module_path>;
258
272
259
273
def emit_objc_header : Flag<["-"], "emit-objc-header">,
260
274
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
261
275
HelpText<"Emit an Objective-C header file">;
262
276
def emit_objc_header_path : Separate<["-"], "emit-objc-header-path">,
263
- Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
277
+ Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
278
+ ArgumentIsPath]>,
264
279
MetaVarName<"<path>">, HelpText<"Emit an Objective-C header file to <path>">;
265
280
266
281
def import_cf_types : Flag<["-"], "import-cf-types">,
@@ -337,7 +352,7 @@ def save_optimization_record : Flag<["-"], "save-optimization-record">,
337
352
Flags<[FrontendOption]>, HelpText<"Generate a YAML optimization record file">;
338
353
def save_optimization_record_path :
339
354
Separate<["-"], "save-optimization-record-path">,
340
- Flags<[FrontendOption]>,
355
+ Flags<[FrontendOption, ArgumentIsPath ]>,
341
356
HelpText<"Specify the file name of any generated YAML optimization record">;
342
357
343
358
// Platform options.
@@ -357,9 +372,11 @@ def framework : Separate<["-"], "framework">, Group<linker_option_Group>,
357
372
HelpText<"Specifies a framework which should be linked against">;
358
373
359
374
def L : JoinedOrSeparate<["-"], "L">, Group<linker_option_Group>,
360
- Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
375
+ Flags<[FrontendOption, DoesNotAffectIncrementalBuild, ArgumentIsPath ]>,
361
376
HelpText<"Add directory to library link search path">;
362
- def L_EQ : Joined<["-"], "L=">, Alias<L>;
377
+ def L_EQ : Joined<["-"], "L=">,
378
+ Flags<[FrontendOption, DoesNotAffectIncrementalBuild, ArgumentIsPath]>,
379
+ Alias<L>;
363
380
364
381
def link_objc_runtime : Flag<["-"], "link-objc-runtime">,
365
382
Flags<[DoesNotAffectIncrementalBuild]>;
@@ -495,12 +512,14 @@ def emit_migrated_file_path: Separate<["-"], "emit-migrated-file-path">,
495
512
MetaVarName<"<path>">;
496
513
497
514
def dump_migration_states_dir: Separate<["-"], "dump-migration-states-dir">,
498
- Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
515
+ Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
516
+ ArgumentIsPath]>,
499
517
HelpText<"Dump the input text, output text, and states for migration to <path>">,
500
518
MetaVarName<"<path>">;
501
519
502
520
def api_diff_data_file: Separate<["-"], "api-diff-data-file">,
503
- Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
521
+ Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
522
+ ArgumentIsPath]>,
504
523
HelpText<"API migration data is from <path>">,
505
524
MetaVarName<"<path>">;
506
525
@@ -654,7 +673,7 @@ def Xllvm : Separate<["-"], "Xllvm">,
654
673
MetaVarName<"<arg>">, HelpText<"Pass <arg> to LLVM.">;
655
674
656
675
def resource_dir : Separate<["-"], "resource-dir">,
657
- Flags<[FrontendOption, HelpHidden]>,
676
+ Flags<[FrontendOption, HelpHidden, ArgumentIsPath ]>,
658
677
MetaVarName<"</usr/lib/swift>">,
659
678
HelpText<"The directory that holds the compiler resource files">;
660
679
@@ -672,7 +691,8 @@ def profile_generate : Flag<["-"], "profile-generate">,
672
691
HelpText<"Generate instrumented code to collect execution counts">;
673
692
674
693
def profile_use : CommaJoined<["-"], "profile-use=">,
675
- Flags<[FrontendOption, NoInteractiveOption]>, MetaVarName<"<profdata>">,
694
+ Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath]>,
695
+ MetaVarName<"<profdata>">,
676
696
HelpText<"Supply a profdata file to enable profile-guided optimization">;
677
697
678
698
def profile_coverage_mapping : Flag<["-"], "profile-coverage-mapping">,
@@ -705,16 +725,22 @@ def index_file : Flag<["-"], "index-file">,
705
725
HelpText<"Produce index data for a source file">, ModeOpt,
706
726
Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
707
727
def index_file_path : Separate<["-"], "index-file-path">,
708
- Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
728
+ Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild, ArgumentIsPath ]>,
709
729
HelpText<"Produce index data for file <path>">,
710
730
MetaVarName<"<path>">;
711
731
712
732
def index_store_path : Separate<["-"], "index-store-path">,
713
- Flags<[FrontendOption]>, MetaVarName<"<path>">,
733
+ Flags<[FrontendOption, ArgumentIsPath ]>, MetaVarName<"<path>">,
714
734
HelpText<"Store indexing data to <path>">;
715
735
716
736
def enforce_exclusivity_EQ : Joined<["-"], "enforce-exclusivity=">,
717
737
Flags<[FrontendOption]>, MetaVarName<"<enforcement>">,
718
738
HelpText<"Enforce law of exclusivity">;
719
739
740
+ def working_directory : Separate<["-"], "working-directory">,
741
+ HelpText<"Resolve file paths relative to the specified directory">,
742
+ MetaVarName<"<path>">;
743
+ def working_directory_EQ : Joined<["-"], "working-directory=">,
744
+ Alias<working_directory>;
745
+
720
746
include "FrontendOptions.td"
0 commit comments