|
| 1 | +# Running IDS |
| 2 | + |
| 3 | +There are a number of command-line arguments to IDS that dictate its behavior. |
| 4 | + |
| 5 | +```bash |
| 6 | +USAGE: idt [options] <source0> [... <sourceN>] |
| 7 | + |
| 8 | +OPTIONS: |
| 9 | + |
| 10 | +Generic Options: |
| 11 | + |
| 12 | + --help - Display available options (--help-hidden for more) |
| 13 | + --help-list - Display list of available options (--help-list-hidden for more) |
| 14 | + --version - Display the version of this program |
| 15 | + |
| 16 | +interface definition scanner options: |
| 17 | + |
| 18 | + --apply-fixits - Apply suggested changes to decorate interfaces |
| 19 | + --export-macro=<define> - The macro to decorate interfaces with |
| 20 | + --extra-arg=<string> - Additional argument to append to the compiler command line |
| 21 | + --extra-arg-before=<string> - Additional argument to prepend to the compiler command line |
| 22 | + --ignore=<function-name[,function-name...]> - Ignore one or more functions |
| 23 | + --include-header=<header> - Header required for export macro |
| 24 | + --inplace - Apply suggested changes in-place |
| 25 | + -p <string> - Build path |
| 26 | +``` |
| 27 | + |
| 28 | +At a minimum, the `--export-macro` argument must be provided to specify the |
| 29 | +macro used to annotate public symbols. See [Export Macro |
| 30 | +Definitions](Docs/ExportMacroDefinitions.md) for details. Additionally, at |
| 31 | +least one source file must be specified as a positional argument. |
| 32 | + |
| 33 | +While it is possible to specify a number of source files, IDS generally works |
| 34 | +better when invoked to process one file at a time. |
| 35 | + |
| 36 | +## Windows Example |
| 37 | + |
| 38 | +```powershell |
| 39 | +S:\Source\ids\build\bin\idt.exe ` |
| 40 | + -p S:\Source\MyProject\build ` |
| 41 | + --apply-fixits ` |
| 42 | + --inplace ` |
| 43 | + --export-macro=PUBLIC_ABI ` |
| 44 | + --include-header="include/MyAnnotations.h" ` |
| 45 | + --extra-arg="-DPUBLIC_ABI=__declspec(dllexport)" ` |
| 46 | + --extra-arg="-Wno-macro-redefined" ` |
| 47 | + --extra-arg="-fno-delayed-template-parsing" ` |
| 48 | + S:\Source\MyProject\include\ProjectHeader1.h ` |
| 49 | + S:\Source\MyProject\include\ProjectHeader2.h |
| 50 | +``` |
| 51 | + |
| 52 | +## Linux Example |
| 53 | + |
| 54 | +```bash |
| 55 | +/home/user/src/ids/out/bin/idt \ |
| 56 | + -p /home/user/src/MyProject/build \ |
| 57 | + --apply-fixits \ |
| 58 | + --inplace \ |
| 59 | + --export-macro=PUBLIC_ABI \ |
| 60 | + --include-header="include/MyAnnotations.h" \ |
| 61 | + --extra-arg='-DLLVM_ABI=[[gnu::visibility("default")]]' \ |
| 62 | + --extra-arg="-Wno-macro-redefined" \ |
| 63 | + S:\Source\MyProject\include\ProjectHeader1.h \ |
| 64 | + S:\Source\MyProject\include\ProjectHeader2.h |
| 65 | +``` |
| 66 | + |
| 67 | +The arguments in the above examples have the following effects: |
| 68 | +- `-p` refers to the build directory for the project containing a |
| 69 | + `compile_commands.json` file used by IDS to configure build options |
| 70 | +- `--apply-fixits` and `--inplace` instruct IDS to modify the source file in |
| 71 | + place |
| 72 | +- `--export-macro` indicates that the `PUBLIC_ABI` macro will be used to |
| 73 | + annotate public symbols |
| 74 | +- `--include-header` specifies a local header file that will be added as a |
| 75 | + `#include` in the processed source files if needed. This would typically |
| 76 | + refer to the header file containing the export macro definition. |
| 77 | +- The first two `--extra-arg` arguments ensure that `PUBLIC_ABI` is always |
| 78 | + defined (differently for Windows and Linux), and suppress the warning emitted |
| 79 | + if it already is. These arguments ensure the `PUBLIC_ABI` annotation is not |
| 80 | + mistakenly added to a symbol that already has it. |
| 81 | +- The third `--extra-arg` argument is Windows-specific and ensures that |
| 82 | + templates are always expanded while parsing. It is ensures overloaded private |
| 83 | + methods get properly exported when referenced only from inline templates. |
| 84 | +- The trailing positional arguments are the names of source files for IDS to |
| 85 | + scan. |
| 86 | + |
0 commit comments