Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,23 @@ on:
pull_request:
branches: [ master, development ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

# TODO test in tree build?
# TODO test conan build
jobs:
build:
name: ${{ matrix.build }} (LLVM-${{ matrix.llvm-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm]
compiler: [ [clang++-21, clang-21, "clang-21 libclang-rt-21-dev clang-tools-21"] ]
llvm-version: [ "21.1", "23.1" ]
build: [ Debug, Release, DebugLibdeps, DebugCov ]
llvm-version: [ 16, "22.1" ]
compiler: [ [clang++-21, clang-21, "clang-21 libclang-rt-21-dev clang-tools-21"] ]
include:
- build: Debug
cmake_build_type: Debug
Expand All @@ -32,24 +37,25 @@ jobs:
cmake_build_type: Debug
flags: -DCODE_COVERAGE=ON
extra_dependencies: llvm-21 # For coverage
- llvm-version: 16
llvm-major-version: 16
- llvm-version: "22.1"
llvm-major-version: 22
- llvm-version: "21.1"
llvm-major-version: 21
- llvm-version: "23.1"
llvm-major-version: 23
exclude:
- os: ubuntu-24.04-arm
build: Debug
- os: ubuntu-24.04-arm
build: DebugLibdeps
- os: ubuntu-24.04-arm
build: DebugCov
- llvm-version: "23.1" # One coverage report is enough
build: DebugCov

continue-on-error: false
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: recursive

- name: ccache # This should always come after the actions/checkout step.
Expand Down Expand Up @@ -80,6 +86,7 @@ jobs:
-DPHASAR_USE_Z3=ON \
-DPHASAR_BUILD_MODULES=ON \
-DPHASAR_TARGET_ARCH="" \
-DPHASAR_ALLOW_LTO_IN_RELEASE_BUILD=OFF \
-DPHASAR_LLVM_VERSION=${{ matrix.llvm-version }} \
${{ matrix.flags }} \
-G Ninja
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
# branches: [ development ]
permissions:
contents: write
concurrency: # Deploy one at a time, in push order
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
build-and-deploy:
if: github.repository == 'secure-software-engineering/phasar'
Expand All @@ -18,7 +21,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Install Phasar Dependencies
Expand All @@ -29,8 +31,8 @@ jobs:
- name: Build Doxygen Docs
shell: bash
env:
CXX: clang++-16
CC: clang-16
CXX: clang++-21
CC: clang-21
run: |
cmake -S . -B build -DPHASAR_BUILD_DOC=ON
cmake --build ./build --target doc_doxygen
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: pre-commit

on:
pull_request:
branches: [ master, development ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
Expand All @@ -15,4 +20,4 @@ jobs:

- uses: pre-commit/action@v3.0.1
with:
extra_args: --from-ref origin/development --to-ref HEAD
extra_args: --from-ref origin/${{ github.base_ref }} --to-ref HEAD
10 changes: 8 additions & 2 deletions .github/workflows/reviewdog-clang-format.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
name: Phasar clang-format review runner

# Temporarily disabled: pre-commit.yml already runs clang-format on every PR.
# To re-enable, restore the trigger below.
on:
pull_request:
branches: [ master, development ]
workflow_dispatch:
# pull_request:
# branches: [ master, development ]

jobs:
format:
runs-on: ubuntu-24.04
permissions:
contents: read
pull-requests: write # Needed by reviewdog/action-suggester to post suggestions
strategy:
fail-fast: false
matrix:
Expand Down
4 changes: 2 additions & 2 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The bootstrap script may ask for superuser permissions (to install the dependenc
### Requirements

PhASAR requires the following system dependencies:
- LLVM >=16
- LLVM >= 16 (default 21)
- We have tested PhASAR only with LLVM versions built with RTTI (runtime-type-info) enabled. Usually, this is no problem as the `llvm-dev` apt package ships with RTTI by default, but may be relevant if you wish to build LLVM from source.
- C++20 compatible compiler, *we recommend clang >=20*
- cmake >=3.23
Expand Down Expand Up @@ -104,7 +104,7 @@ When using CMake to compile PhASAR the following optional parameters can be used
| **PHASAR_ENABLE_PIC** : BOOL | Build Position-Independed Code (default is ON) |
| **PHASAR_ENABLE_WARNINGS** : BOOL | Enable compiler warnings (default is ON) |
| **CMAKE_CXX_STANDARD** : INT|Adapt the used C++ standard (minimum required is 20)|
| **PHASAR_LLVM_VERSION** : VERSION|The LLVM major-version to use. Can be between 16 and 22.1 (default is 16)|
| **PHASAR_LLVM_VERSION** : VERSION|The LLVM major-version to use. Can be between 16 and 23.1 (default is 21)|
| **PHASAR_USE_SVF** : BOOL| Enable using SVF points-to info from PhASAR. See [Use PhASAR with SVF](https://github.com/secure-software-engineering/phasar/wiki/FAQ#how-to-use-phasar-with-svf). Requires SVF installed (default OFF) |

You can use these parameters either directly or modify the installer-script `bootstrap.sh`
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ endif()
option(USE_LLVM_FAT_LIB "Link against libLLVM.so instead of the individual LLVM libraries if possible (default is OFF; always on if BUILD_SHARED_LIBS is ON)" OFF)

# LLVM
set(PHASAR_LLVM_VERSION 16 CACHE STRING "The LLVM major-version that PhASAR should use")
set(PHASAR_LLVM_VERSION 21.1 CACHE STRING "The LLVM major-version that PhASAR should use")

include(add_llvm)
add_llvm()
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ARG baseimage="ubuntu:24.04"
ARG baseimage="ubuntu:26.04"
FROM "$baseimage" AS build

RUN --mount=type=bind,source=./utils/InstallAptDependencies.sh,target=/InstallAptDependencies.sh \
set -eux; \
./InstallAptDependencies.sh --noninteractive tzdata clang-20 libclang-rt-20-dev clang-tools-20 llvm-16-tools llvm-20-tools
./InstallAptDependencies.sh --noninteractive tzdata clang-21 libclang-rt-21-dev clang-tools-21 llvm-21-tools

ENV CC=/usr/bin/clang-20 \
CXX=/usr/bin/clang++-20
ENV CC=/usr/bin/clang-21 \
CXX=/usr/bin/clang++-21

FROM build

Expand All @@ -22,8 +22,8 @@ RUN --mount=type=bind,source=.,target=/usr/src/phasar,rw \
-DCMAKE_BUILD_TYPE=Release \
-DPHASAR_TARGET_ARCH="" \
-DPHASAR_ENABLE_SANITIZERS=ON \
-DBUILD_PHASAR_CLANG=ON \
-DPHASAR_USE_Z3=ON \
-DPHASAR_ALLOW_LTO_IN_RELEASE_BUILD=OFF \
-DPHASAR_BUILD_UNITTESTS=$RUN_TESTS \
-DPHASAR_BUILD_IR=$RUN_TESTS \
-DPHASAR_ENABLE_INTEGRATIONTESTS=$RUN_TESTS \
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,18 @@ PhASAR supports C++20 modules as an experimental feature.

### LLVM Version

PhASAR supports LLVM versions **between LLVM-16 and LLVM-22.1**, using LLVM-16 by default.
PhASAR supports LLVM versions **between LLVM-16 and LLVM-23.1**, using LLVM-21 by default.

**Support for LLVM-23 is experimental.**

We actively test PhASAR with LLVM-16 and LLVM-22.1, so if something does not work, try these versions instead.
We actively test PhASAR with LLVM-21.1 and LLVM-23.1, so if something does not work, try these versions instead.
Specify the `PHASAR_LLVM_VERSION` cmake variable to change the LLVM version to use.

> [!NOTE]
> Since v18, LLVM uses minor versions, so use `-DPHASAR_LLVM_VERSION=17` for LLVM-17 but `-DPHASAR_LLVM_VERSION=18.1` for LLVM-18

> [!NOTE]
> We are slowly retiring support for LLVM 16-17, so if you are using one of these versions, we recommend to upgrade.
> Checkout the [Update to Newer LLVM Versions](https://github.com/secure-software-engineering/phasar/wiki/Update-to-Newer-LLVM-Versions) Wiki page for more information.

## Breaking Changes

To keep PhASAR in a state that is well suited for state-of-the-art research in static analysis, as well as for productive use, we have to make breaking changes. Please refer to [Breaking Changes](./BreakingChanges.md) for detailed information on what was broken recently and how to migrate.
Expand Down
4 changes: 2 additions & 2 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ source ./utils/safeCommandsSet.sh

readonly PHASAR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PHASAR_INSTALL_DIR="/usr/local/phasar"
LLVM_INSTALL_DIR="/usr/local/llvm-16"
LLVM_INSTALL_DIR="/usr/local/llvm-21"

NUM_THREADS=$(nproc)
LLVM_RELEASE=llvmorg-16.0.6
LLVM_RELEASE=llvmorg-21.0.8
DO_UNIT_TEST=true
DO_INSTALL=false
BUILD_TYPE=Release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ class EdgeValue {

public:
EdgeValue(const llvm::Value *Val);
EdgeValue(const EdgeValue &EV);
EdgeValue(llvm::APInt &&VI);
EdgeValue(const llvm::APInt &VI);
EdgeValue(llvm::APFloat &&VF);
EdgeValue(long long VI);
EdgeValue(int VI);
EdgeValue(double Double);
EdgeValue(float Float);
EdgeValue(std::string &&VS);
EdgeValue(std::string VS);
EdgeValue(std::nullptr_t);
~EdgeValue();

const static EdgeValue TopValue;
[[nodiscard]] bool tryGetInt(int64_t &Res) const;
[[nodiscard]] bool tryGetFP(double &Res) const;
Expand All @@ -60,7 +59,6 @@ class EdgeValue {
[[nodiscard]] EdgeValue performBinOp(llvm::BinaryOperator::BinaryOps Op,
const EdgeValue &Other) const;
[[nodiscard]] EdgeValue typecast(Type Dest, unsigned Bits) const;
EdgeValue &operator=(const EdgeValue &EV);

operator bool();
friend bool operator==(const EdgeValue &Lhs, const EdgeValue &Rhs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,31 +94,6 @@ EdgeValue::EdgeValue(const llvm::Value *Val) : VariantType(Top) {
}
}

EdgeValue::EdgeValue(const EdgeValue &Ev) : VariantType(Ev.VariantType) {
switch (VariantType) {
case Top:
ValVariant = nullptr;
break;
case Integer:
ValVariant = std::get<llvm::APInt>(Ev.ValVariant);
break;
case FloatingPoint:
ValVariant = std::get<llvm::APFloat>(Ev.ValVariant);
break;
case String:
ValVariant = std::get<std::string>(Ev.ValVariant);
break;
}
}

EdgeValue &EdgeValue::operator=(const EdgeValue &Ev) {
this->~EdgeValue();
new (this) EdgeValue(Ev);
return *this;
}

EdgeValue::~EdgeValue() { ValVariant.~variant(); }

EdgeValue::EdgeValue(llvm::APInt &&Vi) : VariantType(EdgeValue::Integer) {
ValVariant = llvm::APInt(std::move(Vi));
}
Expand Down Expand Up @@ -152,9 +127,8 @@ EdgeValue::EdgeValue(float Float) : VariantType(EdgeValue::FloatingPoint) {
ValVariant = llvm::APFloat(Float);
}

EdgeValue::EdgeValue(std::string &&Vs) : VariantType(EdgeValue::String) {
ValVariant = std::string(Vs);
}
EdgeValue::EdgeValue(std::string Vs)
: ValVariant(std::move(Vs)), VariantType(EdgeValue::String) {}

EdgeValue::EdgeValue(std::nullptr_t) : VariantType(EdgeValue::Top) {}
bool EdgeValue::tryGetInt(int64_t &Res) const {
Expand Down
8 changes: 4 additions & 4 deletions utils/InstallAptDependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -euo pipefail

noninteractive="false"
LLVM_IR_VERSION=16
LLVM_IR_VERSION=21

# Parsing command-line-parameters
# See "https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash" as a reference
Expand Down Expand Up @@ -31,7 +31,7 @@ case $key in
echo ""
echo "OPTIONS:"
echo -e "\t--noninteractive,-ni\t- Non-interactive mode for apt"
echo -e "\t--llvm-version=<value>\t- The LLVM major-version to use (16 or 17, default is 16)"
echo -e "\t--llvm-version=<value>\t- The LLVM major-version to use (16 - 23, default is 21)"
exit 0
;;
*) # unknown option
Expand All @@ -43,8 +43,8 @@ done
set -- "${POSITIONAL[@]}" # restore positional parameters
# End - Parsing command-line-parameters

if [ "$LLVM_IR_VERSION" -lt "16" ] || [ "$LLVM_IR_VERSION" -gt "22" ]; then
echo "Invalid LLVM version: $LLVM_IR_VERSION, expected a version between 16 and 22" >&2
if [ "$LLVM_IR_VERSION" -lt "16" ] || [ "$LLVM_IR_VERSION" -gt "23" ]; then
echo "Invalid LLVM version: $LLVM_IR_VERSION, expected a version between 16 and 23" >&2
exit 1
fi

Expand Down
Loading