[llvm] [ci] Add ids workflow for checking llvm apis have been annotated with LLVM_ABI (PR #128370)

Andrew Rogers via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 09:39:50 PDT 2025


andrurogerz wrote:

I have been using ids locally to keep up on new symbols while adding annotations throughout the codebase and it has been working well. I am generally running it on Windows, though the analysis *should* be the same running on Ubuntu. It might be worth switching this job to run on a Windows-runner if possible, though.

There are some additional things the job will need to consider to make it work properly:

1. Only run ids on changed header files under `llvm/include/llvm`. Exclude the subdir `llvm/include/llvm/Debuginfod` because Debuginfod is not an llvm component library. It should also exclude files under `llvm/include/llvm/Demangle` and run those separately with different command line args. **I have found it works best to invoke ids on one file at a time rather than pass it a bunch of files at once.**

2. Since the LLVM build providing the `compile_commands.json` may not have `LLVM_ABI` defined correctly, explicitly define it via ids' `--extra-arg`:
```
--extra-arg="-DLLVM_ABI=__attribute__((visibility(\"default\")))" --extra-arg="-Wno-macro-redefined"
```

3. Make sure the header defining `LLVM_ABI` gets added when needed:
```
--include-header="llvm/Support/Compiler.h"
```

4. Make sure fixits are emitted. I'm not sure how these options interact when running in a GitHub action. Maybe it can't actually edit the files for you, in which case we should not include `--inplace`.
```
--apply-fixits --inplace
```

5. Run an alternate command for modified files under `llvm/include/llvm-c` because there is a different annotation and header file.
```
--export-macro=LLVM_C_ABI --include-header="llvm-c/Visibility.h" --extra-arg="-DLLVM_C_ABI=__attribute__((visibility(\"default\")))"
```

6. Similarly, run an alternate command for modified files under `llvm/include/llvm/Demangle`.
```
--export-macro=DEMANGLE_ABI --include-header="llvm/Demangle/Visibility.h" --extra-arg="-DEMANGLE_ABI=__attribute__((visibility(\"default\")))"
```

7. Because ids analyses transitive includes, it may flag files that are not part of the PR. We should filter out these results if possible to reduce noise.

https://github.com/llvm/llvm-project/pull/128370


More information about the llvm-commits mailing list