Setup Clang
Set up a specific version of a Clang compiler and add it to the PATH. In most workflows, this is used as an auxiliary action for the setup-cpp action.
This allows us to test a C++ library with any Clang version, and not only the versions circumstantially provided by apt-get.
This action uses a number of alternatives to find or install Clang:
-
The Clang path provided to 'path'
-
Any other version of Clang it can find in the system
-
Any other version of Clang available from APT
-
A version of Clang from LLVM binary releases
When searching APT packages, the action prefers packages in this order:
-
Unversioned packages (e.g.,
clang) - best system integration -
Raw versioned packages (e.g.,
clang-14) - what users typically expect -
Other versioned packages - fallback only
After installation, the action also installs companion packages for tool parity:
-
llvmorllvm-XXfor llvm-symbolizer (readable sanitizer stack traces) -
libclang-rt-XX-devfor sanitizer runtimes (ASan, UBSan, TSan, MSan)
In most workflows, this is used as an auxiliary action for the Setup C++ action, which already calls this action if necessary.
Next steps
After setting up the proper C++ compiler for a matrix entry, the next step in your workflow should usually be Install Packages.
Input Parameters
Parameter |
Description |
Default |
|
Trace commands executed by the workflow. |
|
|
Version range or exact version of Clang to use, using SemVer’s version range syntax. By default, it uses any version available in the environment. |
|
|
The clang or clang++ executable. We attempt to find Clang at this path first. |
|
|
By default, when Clang is not available, this action will install the minimum version in the version spec. This ensures the code respects its contract in terms of what minimum Clang version is supported. Set this option if you want the action to check for the latest available version that satisfies the version spec instead. |
|
|
Set this option if you want the action to update environment variables. |
|
Outputs
Output |
Description |
|
The absolute path to the clang executable. |
|
The absolute path to the clang++ executable. |
|
The absolute path to the Clang directory containing the executable. |
|
The installed Clang version. Useful when given a version range as input. |
|
The installed Clang version major. Useful when given a version range as input. |
|
The installed Clang version minor. Useful when given a version range as input. |
|
The installed Clang version patch. Useful when given a version range as input. |
|
The absolute path to llvm-symbolizer (Linux only). This is also exported as LLVM_SYMBOLIZER_PATH, ASAN_SYMBOLIZER_PATH, MSAN_SYMBOLIZER_PATH, TSAN_SYMBOLIZER_PATH, and UBSAN_SYMBOLIZER_PATH environment variables when update-environment is true. |