Commit Graph

25 Commits

Author SHA1 Message Date
Ian Anderson
3a78559408 [utils] Add swift-api-digester arguments to split-cmdline
Add -typecheck-module-from-interface arguments.
2025-07-22 16:54:28 -07:00
Ian Anderson
f671e0b48f [utils] Add swift-api-digester arguments to split-cmdline
Add a couple of common swift-api-digester arguments.
2025-07-21 14:31:06 -07:00
Ian Anderson
fc96b8518b [utils] expand @-filelist files with .resp filename extensions
Xcode puts clang command line arguments in a single line in .resp files.
Split the argument printing routine into its own function print_arg.
When a clang response file is encountered, split each line into arguments and loop them through print_arg.
-c has an argument for clang
2025-07-18 22:35:53 -07:00
Erik Eckstein
589ff40994 utils: let split-cmdline expand @-filelist files which end with "FileList"
So far only ".txt" were handled
2025-07-18 09:45:28 +02:00
Erik Eckstein
4a32f0959d utils: fix split-cmdline
If an argument does not start with an "-", it's not necessarily an argument parameter. It can also be e.g. an input file name.
2025-07-18 09:45:28 +02:00
Ian Anderson
2251dc77c0 [utils] Add more flags to split-cmdline
Add several clang flags that don't show up in its --help (many are cc1 flags).
Add a heuristic that if an argument doesn't start with a '-' then it's an argument parameter.
Special case -finclude-tree-preserve-pch-path as not an argument that has a parameter.
2025-07-10 16:43:47 -07:00
Ian Anderson
8fdcdbc9ef [utils] Add -Isystem and -load-resolved-plugin to split-cmdline 2025-07-08 14:46:11 -07:00
Artem Chikin
41e471288a [Dependency Scanning] Deprecate/Remove batch scanning capability
Batch dependency scanning was added as a mechanism to support multiple compilation contexts within a single module dependency graph.
The Swift compiler and the Explicitly-built modules model has long since abandoned this approach and this code has long been stale. It is time to remove it and its associated C API.
2025-01-28 15:30:39 -08:00
Erik Eckstein
3de0af9a13 split-cmdline: the -c option only has an argument for swiftpm, but not for the compiler 2024-11-15 12:18:05 +01:00
John Hui
1626b0f0f6 Add several argument flags to split-cmdline (#77280)
* Add missing arg-flags to split-cmdline

* Add parameter arguments scraped from --help menus to split-cmdline

* Break apart line in comment to fix lint error
2024-11-05 16:58:21 -08:00
Andrew Trick
a60f5c45a7 Fix dev-scripts/split-cmdline: quote ';' arguments
When printing an argument that contains ';', add back
the quotes that are normally stripped.

I regularly waste half a day building Swift only to find that I built
the wrong thing because everything after the semicolon is dropped from
the build script when it contains arguments like this:

'--llvm-install-components=libclang;libclang-headers'

Ideally, split-cmdline would just preserve the original quotes. But
this quick fix solves the problem in the cases that I care about.
2024-04-26 08:58:06 -07:00
Ludwig Hollmann
a31e5f0305 Fix spelling: an -> and 2022-09-24 20:58:28 +02:00
YOCKOW
d10381557b [NFC] Python Lint: Fix E275(missing whitespace after keyword) issues. 2022-08-21 16:07:07 +09:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Karoy Lorentey
c195b2e724 [utils] split-cmdline: Handle -working-directory 2021-02-10 13:11:05 -08:00
Karoy Lorentey
33049fab81 [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.
2021-02-10 13:01:51 -08:00
Ross Bayer
29a7edded6 [Python] Update the .flake8 config file to lint all existing Python scripts.
The utils/dev-scripts/at-to-filelist, utils/dev-scripts/split-cmdline and utils/build-parser-lib scripts needed to be reformatted with the black tool to agree with the linter.
2020-02-06 15:39:25 -08:00
Nate Chandler
da385bd938 [csvcolumn_to_scurve] Avoid division by zero.
Check whether the value in the "before" column is zero (specifically,
whether the file size in that column is greater than zero since
filesizes are non-negative) before dividing the value in the "after"
column by it.
2019-10-02 12:54:29 -07:00
Michael Gottesman
31b8c29355 [dev-scripts] Add a new tool called scurve_printer to print scurve data produced by csvcolumn_to_scurve.
This used matplotlib internally to plot the values. Now one can produce scurves
without leaving the command line.

I tried to get logarithmic scale to work, but I was unable to do so in a trivial
way. That is something for a different hacking session. I need to move on.
2018-07-06 16:44:34 -07:00
Michael Gottesman
70b58fa88d [dev-scripts] Add csv_to_scurve.py to convert csv documents into an scurve csv file ready for graphing.
I am upstreaming this for two reasons:

1. Traditionally I have done this by hand in a spreadsheet program. I would
rather just have a program fix it up for me.
2. Multiple people have asked me about how to produce this sort of graph and I
would just like to document it via a script.

I hope it is useful to others. You use the script by invoking it as:

./csvcolumn_to_scurve <input_file> <before_column> <after_column> [output_file]
2018-07-06 16:31:40 -07:00
Michael Gottesman
157aebc639 [dev-script] Add a new script called at-to-filelist.
This script in combination with <(...) can be used to speed up creating
reproductions from command lines that use '@' files to define their inputs.

An example use case:

Consider a swiftc command line that uses the @ symbol.

  swiftc @/foo/bar/baz.txt

When this is run, the @ command is expanded into a filelist in a temporary
file. This doesn't work with -### since -### outputs the command line with a
temporary file for the filelist, but uses a path to a temporary file that
doesn't exist, e.g.:

  swift -frontend -filelist /tmp/tmp.filelist ...

To run this command, you use the at-to-filelist command as follows:

  swift -frontend -filelist <(at-to-filelist /foo/bar/baz.txt)
2018-02-10 22:43:36 -08:00
Michael Gottesman
2a6e1b32ac [dev-scripts] Add a tool called emacs-compile that runs $@ in an emacs compile session.
Something useful that I use all the time that I would like to give to others. It
enables emacs compile-mode to be used like a standalone-ish application instead
of one application with many modes, one of which is compile-mode.
2018-02-07 12:37:02 -08:00
Erik Eckstein
a7c7d63a9b Add a utility script to split a disassembled function from lldb into basic blocks.
Useful to show the control flow graph of a disassembled function.
The control flow graph can the be viewed with the viewcfg utility:

(lldb) disassemble
   <copy-paste output to file.s>
$ blockifyasm < file.s | viewcfg
2018-02-02 15:30:48 -08:00
Erik Eckstein
4262a12dc8 split-cmdline: Correctly handle spaces in arguments.
Also add an example in the script header.
2017-11-13 12:47:30 -08:00
Erik Eckstein
47e5a0757a A utility script to split long swift compiler command lines.
For details see the comment in split-cmdline

I put this under a new directory utils/dev-script because we have so much stuff in utils already.
Other, similar scripts can then be added in dev-scripts as well.
2017-10-29 15:27:32 -07:00