Skip to content

Commit 33049fa

Browse files
committed
[utils] split-cmdline: Handle typical compiler invocations better
Add a general heuristic that options ending in -path expect an argument. Remove such options from the explicit is_arg_param list and sort it to simplify maintenance. Recognize -target-sdk-version.
1 parent e148032 commit 33049fa

File tree

1 file changed

+30
-34
lines changed

1 file changed

+30
-34
lines changed

utils/dev-scripts/split-cmdline

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -78,50 +78,46 @@ def main():
7878

7979
# A hard-coded list of options which expect a parameter
8080
is_arg_param = arg in [
81-
"-o",
82-
"-target",
83-
"-isysroot",
84-
"-emit-sil",
85-
"-emit-ir",
86-
"-module-name",
87-
"-framework",
88-
"-Xlinker",
89-
"-arch",
81+
"--sdk",
82+
"--toolchain",
9083
"-D",
91-
"-sdk",
92-
"-module-cache-path",
9384
"-F",
94-
"-output-file-map",
95-
"-emit-module-path",
96-
"-Xcc",
9785
"-I",
98-
"-iquote",
99-
"-emit-objc-header-path",
100-
"-Xfrontend",
101-
"-filelist",
102-
"-num-threads",
103-
"-Xclang",
104-
"-x",
10586
"-L",
106-
"-rpath",
107-
"-macosx_version_min",
108-
"-syslibroot",
87+
"-Xcc",
88+
"-Xclang",
89+
"-Xfrontend",
90+
"-Xlinker",
91+
"-Xllvm",
10992
"-add_ast_path",
93+
"-arch",
94+
"-emit-ir",
95+
"-emit-sil",
96+
"-filelist",
97+
"-fileno",
98+
"-framework",
11099
"-import-objc-header",
111-
"-serialize-diagnostics-path",
112-
"-emit-dependencies-path",
113-
"-emit-reference-dependencies-path",
100+
"-iquote",
101+
"-isysroot",
102+
"-macosx_version_min",
103+
"-module-link-name",
104+
"-module-name",
105+
"-num-threads",
106+
"-o",
107+
"-output-file-map",
114108
"-primary-file",
115109
"-resource-dir",
116-
"--sdk",
117-
"--toolchain",
118-
"-emit-module-doc-path",
119-
"-module-link-name",
120-
"-group-info-path",
121-
"-fileno",
110+
"-rpath",
111+
"-sdk",
122112
"-swift-version",
123-
"-Xllvm",
113+
"-syslibroot",
114+
"-target",
115+
"-target-sdk-version",
116+
"-x",
124117
]
118+
# Heuristic: options ending in -path expect an argument
119+
if arg.startswith("-") and arg.endswith("-path"):
120+
is_arg_param = True
125121

126122
# Print 2 new lines after each command line
127123
print("\n")

0 commit comments

Comments
 (0)