Skip to content

Commit 9ecb17a

Browse files
[Option][Caching] Clean up option caching exclusion list
Systematically declare CacheInvariant options in TableGen file instead of putting a list in the cache key computation function.
1 parent d5a3e2e commit 9ecb17a

File tree

4 files changed

+145
-146
lines changed

4 files changed

+145
-146
lines changed

include/swift/Option/FrontendOptions.td

+61-55
Original file line numberDiff line numberDiff line change
@@ -14,64 +14,97 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616

17-
let Flags = [FrontendOption, NoDriverOption] in {
18-
19-
def triple : Separate<["-"], "triple">, Alias<target>;
20-
21-
def primary_file : Separate<["-"], "primary-file">,
22-
HelpText<"Produce output for this file, not the whole module">;
17+
let Flags = [FrontendOption, NoDriverOption, ArgumentIsFileList] in {
2318

2419
def filelist : Separate<["-"], "filelist">,
2520
HelpText<"Specify source inputs in a file rather than on the command line">;
2621
def primary_filelist : Separate<["-"], "primary-filelist">,
2722
HelpText<"Specify primary inputs in a file rather than on the command line">;
23+
24+
} // end let Flags = [FrontendOption, NoDriverOption, ArgumentIsFileList]
25+
26+
27+
let Flags = [FrontendOption, NoDriverOption, CacheInvariant] in {
28+
2829
def output_filelist : Separate<["-"], "output-filelist">,
2930
HelpText<"Specify outputs in a file rather than on the command line">;
3031
def supplementary_output_file_map : Separate<["-"], "supplementary-output-file-map">,
3132
HelpText<"Specify supplementary outputs in a file rather than on the command line">;
33+
def index_unit_output_path_filelist : Separate<["-"], "index-unit-output-path-filelist">,
34+
HelpText<"Specify index unit output paths in a file rather than on the command line">;
3235

33-
def frontend_parseable_output : Flag<["-"], "frontend-parseable-output">,
34-
HelpText<"Emit textual output in a parseable format">;
35-
36-
def emit_module_doc : Flag<["-"], "emit-module-doc">,
37-
HelpText<"Emit a module documentation file based on documentation "
38-
"comments">;
3936
def emit_module_doc_path
4037
: Separate<["-"], "emit-module-doc-path">, MetaVarName<"<path>">,
4138
HelpText<"Output module documentation file <path>">;
42-
43-
def emit_module_source_info : Flag<["-"], "emit-module-source-info">,
44-
HelpText<"Output module source info file">;
45-
46-
def ignore_module_source_info : Flag<["-"], "ignore-module-source-info">,
47-
HelpText<"Avoid getting source location from .swiftsourceinfo files">;
48-
49-
def merge_modules
50-
: Flag<["-"], "merge-modules">, ModeOpt,
51-
HelpText<"Merge the input modules without otherwise processing them">;
52-
5339
def emit_dependencies_path
5440
: Separate<["-"], "emit-dependencies-path">, MetaVarName<"<path>">,
5541
HelpText<"Output basic Make-compatible dependencies file to <path>">;
56-
57-
def emit_reference_dependencies : Flag<["-"], "emit-reference-dependencies">,
58-
HelpText<"Emit a Swift-style dependencies file">;
5942
def emit_reference_dependencies_path
6043
: Separate<["-"], "emit-reference-dependencies-path">, MetaVarName<"<path>">,
6144
HelpText<"Output Swift-style dependencies file to <path>">;
6245

6346
def emit_fixits_path
6447
: Separate<["-"], "emit-fixits-path">, MetaVarName<"<path>">,
6548
HelpText<"Output compiler fixits as source edits to <path>">;
66-
6749
def emit_abi_descriptor_path
6850
: Separate<["-"], "emit-abi-descriptor-path">, MetaVarName<"<path>">,
6951
HelpText<"Output the ABI descriptor of current module to <path>">;
70-
7152
def emit_module_semantic_info_path
7253
: Separate<["-"], "emit-module-semantic-info-path">, MetaVarName<"<path>">,
7354
HelpText<"Output semantic info of current module to <path>">;
7455

56+
def diagnostic_documentation_path
57+
: Separate<["-"], "diagnostic-documentation-path">, MetaVarName<"<path>">,
58+
HelpText<"Path to diagnostic documentation resources">;
59+
60+
def dump_api_path : Separate<["-"], "dump-api-path">,
61+
HelpText<"The path to output swift interface files for the compiled source files">;
62+
63+
def group_info_path : Separate<["-"], "group-info-path">,
64+
HelpText<"The path to collect the group information of the compiled module">;
65+
66+
def prebuilt_module_cache_path :
67+
Separate<["-"], "prebuilt-module-cache-path">,
68+
HelpText<"Directory of prebuilt modules for loading module interfaces">;
69+
def prebuilt_module_cache_path_EQ :
70+
Joined<["-"], "prebuilt-module-cache-path=">,
71+
Alias<prebuilt_module_cache_path>;
72+
73+
def backup_module_interface_path :
74+
Separate<["-"], "backup-module-interface-path">,
75+
HelpText<"Directory of module interfaces as backups to those from SDKs">;
76+
def backup_module_interface_path_EQ :
77+
Joined<["-"], "backup-module-interface-path=">,
78+
Alias<backup_module_interface_path>;
79+
80+
} // end let Flags = [FrontendOption, NoDriverOption, CacheInvariant]
81+
82+
83+
let Flags = [FrontendOption, NoDriverOption] in {
84+
85+
def triple : Separate<["-"], "triple">, Alias<target>;
86+
87+
def primary_file : Separate<["-"], "primary-file">,
88+
HelpText<"Produce output for this file, not the whole module">;
89+
90+
def frontend_parseable_output : Flag<["-"], "frontend-parseable-output">,
91+
HelpText<"Emit textual output in a parseable format">;
92+
93+
def emit_module_doc : Flag<["-"], "emit-module-doc">,
94+
HelpText<"Emit a module documentation file based on documentation "
95+
"comments">;
96+
97+
def emit_module_source_info : Flag<["-"], "emit-module-source-info">,
98+
HelpText<"Output module source info file">;
99+
def ignore_module_source_info : Flag<["-"], "ignore-module-source-info">,
100+
HelpText<"Avoid getting source location from .swiftsourceinfo files">;
101+
102+
def merge_modules
103+
: Flag<["-"], "merge-modules">, ModeOpt,
104+
HelpText<"Merge the input modules without otherwise processing them">;
105+
def emit_reference_dependencies : Flag<["-"], "emit-reference-dependencies">,
106+
HelpText<"Emit a Swift-style dependencies file">;
107+
75108
def serialize_module_interface_dependency_hashes
76109
: Flag<["-"], "serialize-module-interface-dependency-hashes">,
77110
Flags<[HelpHidden]>;
@@ -127,10 +160,6 @@ def enable_cross_import_overlays : Flag<["-"], "enable-cross-import-overlays">,
127160
def disable_cross_import_overlays : Flag<["-"], "disable-cross-import-overlays">,
128161
HelpText<"Do not automatically import declared cross-import overlays.">;
129162

130-
def diagnostic_documentation_path
131-
: Separate<["-"], "diagnostic-documentation-path">, MetaVarName<"<path>">,
132-
HelpText<"Path to diagnostic documentation resources">;
133-
134163
def enable_testable_attr_requires_testable_module :
135164
Flag<["-"], "enable-testable-attr-requires-testable-module">,
136165
HelpText<"Enable checking of @testable">;
@@ -895,9 +924,6 @@ def index_ignore_stdlib :
895924
Flag<["-"], "index-ignore-stdlib">,
896925
HelpText<"Avoid emitting index data for the standard library.">;
897926

898-
def index_unit_output_path_filelist : Separate<["-"], "index-unit-output-path-filelist">,
899-
HelpText<"Specify index unit output paths in a file rather than on the command line">;
900-
901927
def dump_interface_hash : Flag<["-"], "dump-interface-hash">,
902928
HelpText<"Parse input file(s) and dump interface token hash(es)">,
903929
ModeOpt;
@@ -960,29 +986,9 @@ def experimental_one_way_closure_params :
960986
Flag<["-"], "experimental-one-way-closure-params">,
961987
HelpText<"Enable experimental support for one-way closure parameters">;
962988

963-
def prebuilt_module_cache_path :
964-
Separate<["-"], "prebuilt-module-cache-path">,
965-
HelpText<"Directory of prebuilt modules for loading module interfaces">;
966-
def prebuilt_module_cache_path_EQ :
967-
Joined<["-"], "prebuilt-module-cache-path=">,
968-
Alias<prebuilt_module_cache_path>;
969-
970-
def backup_module_interface_path :
971-
Separate<["-"], "backup-module-interface-path">,
972-
HelpText<"Directory of module interfaces as backups to those from SDKs">;
973-
def backup_module_interface_path_EQ :
974-
Joined<["-"], "backup-module-interface-path=">,
975-
Alias<backup_module_interface_path>;
976-
977989
def force_public_linkage : Flag<["-"], "force-public-linkage">,
978990
HelpText<"Force public linkage for private symbols. Used by LLDB.">;
979991

980-
def dump_api_path : Separate<["-"], "dump-api-path">,
981-
HelpText<"The path to output swift interface files for the compiled source files">;
982-
983-
def group_info_path : Separate<["-"], "group-info-path">,
984-
HelpText<"The path to collect the group information of the compiled module">;
985-
986992
def diagnostics_editor_mode : Flag<["-"], "diagnostics-editor-mode">,
987993
HelpText<"Diagnostics will be used in editor">;
988994

include/swift/Option/Options.h

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ namespace options {
4343
NewDriverOnlyOption = (1 << 18),
4444
ModuleInterfaceOptionIgnorable = (1 << 19),
4545
ModuleInterfaceOptionIgnorablePrivate = (1 << 20),
46+
ArgumentIsFileList = (1 << 21),
47+
CacheInvariant = (1 << 22),
4648
};
4749

4850
enum ID {

0 commit comments

Comments
 (0)