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