Skip to content

Commit 846b279

Browse files
authored
Merge pull request #797 from secure-software-engineering/development
Release v2510
2 parents 8c178ff + a210610 commit 846b279

File tree

423 files changed

+19858
-8481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

423 files changed

+19858
-8481
lines changed

.clang-tidy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ Checks: '-*,
2929
-cppcoreguidelines-init-variables,
3030
-cppcoreguidelines-macro-usage,
3131
-cppcoreguidelines-avoid-do-while,
32+
-cppcoreguidelines-avoid-c-arrays,
3233
bugprone-*,
3334
-bugprone-easily-swappable-parameters,
3435
modernize-*,
3536
-modernize-use-trailing-return-type,
37+
-modernize-avoid-c-arrays,
3638
performance-*,
3739
clang-analyzer-*
3840
'
@@ -59,7 +61,7 @@ CheckOptions:
5961
- key: readability-identifier-naming.ParameterIgnoredRegexp
6062
value: (d|d1|d2|d3|d4|d5|eP|f|n)
6163
- key: readability-identifier-naming.FunctionIgnoredRegexp
62-
value: (try_emplace|from_json|to_json|equal_to|to_string|DToString|NToString|FToString|LToString|hash_value)
64+
value: (try_emplace|from_json|to_json|equal_to|to_string|DToString|NToString|FToString|LToString|hash_value|dyn_cast)
6365
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
6466
value: 1
6567
- key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions

.github/workflows/ci.yml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
os: [ubuntu-20.04, ubuntu-24.04-arm]
17+
os: [ubuntu-24.04, ubuntu-24.04-arm]
1818
compiler: [ [clang++-19, clang-19, "clang-19 libclang-rt-19-dev"] ]
1919
build: [ Debug, Release, DebugLibdeps ]
2020
include:
@@ -46,12 +46,7 @@ jobs:
4646
run: |
4747
./utils/InstallAptDependencies.sh --noninteractive tzdata ${{ matrix.compiler[2] }}
4848
49-
- uses: swift-actions/setup-swift@v2
50-
if: matrix.os == 'ubuntu-20.04'
51-
with:
52-
swift-version: "5.8.1"
53-
- name: Building Phasar in ${{ matrix.build }} with ${{ matrix.compiler[0] }} including swift
54-
if: matrix.os == 'ubuntu-20.04'
49+
- name: Building Phasar in ${{ matrix.build }} with ${{ matrix.compiler[0] }}
5550
env:
5651
CXX: ${{ matrix.compiler[0] }}
5752
CC: ${{ matrix.compiler[1] }}
@@ -60,29 +55,25 @@ jobs:
6055
cmake -S . -B build \
6156
-DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
6257
-DBUILD_PHASAR_CLANG=OFF \
63-
-DBUILD_SWIFT_TESTS=ON \
6458
-DPHASAR_USE_Z3=ON \
6559
${{ matrix.flags }} \
6660
-G Ninja
6761
ninja -C build
6862
69-
- name: Building Phasar in ${{ matrix.build }} with ${{ matrix.compiler[0] }}
70-
if: matrix.os != 'ubuntu-20.04'
71-
env:
72-
CXX: ${{ matrix.compiler[0] }}
73-
CC: ${{ matrix.compiler[1] }}
63+
- name: Run Unittests
7464
shell: bash
7565
run: |
76-
cmake -S . -B build \
77-
-DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
78-
-DBUILD_PHASAR_CLANG=OFF \
79-
-DPHASAR_USE_Z3=ON \
80-
${{ matrix.flags }} \
81-
-G Ninja
82-
ninja -C build
66+
cmake --build ./build --target check-phasar-unittests
8367
84-
- name: Run Unittests
68+
- name: Install PhASAR and Build Examples
69+
if: matrix.build == 'DebugLibdeps' # Circumvent conflicting ASAn flags
70+
env:
71+
CXX: ${{ matrix.compiler[0] }}
72+
CC: ${{ matrix.compiler[1] }}
8573
shell: bash
8674
run: |
87-
cd build
88-
cmake --build . --target check-phasar-unittests
75+
cmake -DCMAKE_INSTALL_PREFIX=./INSTALL -P ./build/cmake_install.cmake
76+
PHASAR_ROOT_DIR=$(pwd)
77+
cd ./examples/how-to
78+
cmake -S . -B build -Dphasar_ROOT="$PHASAR_ROOT_DIR/INSTALL"
79+
cmake --build ./build --target run_sample_programs

.github/workflows/deploy-docs.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Deploy Doxygen Docs
2+
on:
3+
push:
4+
branches: [ development ]
5+
# pull_request: # For testing only. Remove before merge!
6+
# branches: [ development ]
7+
permissions:
8+
contents: write
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-24.04
12+
strategy:
13+
fail-fast: true
14+
continue-on-error: false
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
submodules: recursive
22+
23+
- name: Install Phasar Dependencies
24+
shell: bash
25+
run: |
26+
./utils/InstallAptDependencies.sh --noninteractive tzdata doxygen graphviz
27+
28+
- name: Build Doxygen Docs
29+
shell: bash
30+
env:
31+
CXX: clang++-15
32+
CC: clang-15
33+
run: |
34+
cmake -S . -B build -DPHASAR_BUILD_DOC=ON
35+
cmake --build ./build --target doc_doxygen
36+
37+
- name: Deploy Doxygen Docs on GitHub Pages
38+
uses: JamesIves/github-pages-deploy-action@v4
39+
with:
40+
folder: build/docs/html
41+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pre-commit.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ on:
55

66
jobs:
77
pre-commit:
8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-24.04
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111
with:
1212
fetch-depth: 0
1313

14-
- uses: actions/setup-python@v2
14+
- uses: actions/setup-python@v5
1515

16-
- uses: pre-commit/action@v2.0.0
16+
- uses: pre-commit/action@v3.0.1
1717
with:
1818
extra_args: --from-ref origin/development --to-ref HEAD

.github/workflows/reviewdog-clang-format.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,23 @@ on:
66

77
jobs:
88
format:
9-
runs-on: ubuntu-20.04
9+
runs-on: ubuntu-24.04
1010
strategy:
1111
fail-fast: false
1212
matrix:
1313
tool: [ clang-format ]
1414
include:
1515
- tool: clang-format
1616
install: |
17-
sudo apt-key adv --fetch-keys https://apt.llvm.org/llvm-snapshot.gpg.key
18-
sudo add-apt-repository -y 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main'
1917
sudo apt-get update
20-
sudo apt-get -y install --no-install-recommends clang-format-14
18+
sudo apt-get -y install --no-install-recommends clang-format-19
2119
regex: \.(h|c|hpp|cpp)$
22-
command: clang-format-14 --style=file -i
20+
command: clang-format-19 --style=file -i
2321

2422
continue-on-error: false
2523
steps:
2624
- name: Checkout
27-
uses: actions/checkout@v2
25+
uses: actions/checkout@v4
2826
with:
2927
submodules: recursive
3028

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ doc/*
3030
log/*
3131
**/*/logs/
3232

33-
# CMake build dir
34-
build/*
35-
3633
# MS VS Code
37-
.vscode/*
34+
.vscode/
3835

3936
# Eclipse
4037
.cproject

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
path = external/json
33
url = https://github.com/nlohmann/json.git
44
ignore = dirty
5-
[submodule "lib/googletest"]
6-
path = external/googletest
7-
url = https://github.com/google/googletest.git
8-
branch = master
95
[submodule "external/json-schema-validator"]
106
path = external/json-schema-validator
117
url = https://github.com/pboettch/json-schema-validator.git

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ repos:
1212
- id: check-added-large-files
1313
- id: requirements-txt-fixer
1414
- repo: https://github.com/pre-commit/mirrors-clang-format
15-
rev: 'v14.0.6'
15+
rev: 'v19.1.7'
1616
hooks:
1717
- id: clang-format

BUILD.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Building PhASAR
2+
3+
4+
It is recommended to compile PhASAR yourself in order to get the full C++ experience and to have full control over the build mode.
5+
However, you may also want to try out one of the pre-built versions of PhASAR or the Docker container.
6+
7+
As a shortcut for the very first PhASAR build on your system, you can use our [bootstrap](./bootstrap.sh) script.
8+
Please note that you must have python installed for the script to work properly.
9+
10+
```bash
11+
./bootstrap.sh
12+
```
13+
14+
Note: If you want to do changes within PhASAR, it is recommended to build it in Debug mode:
15+
16+
```bash
17+
./bootstrap.sh -DCMAKE_BUILD_TYPE=Debug
18+
```
19+
20+
The bootstrap script may ask for superuser permissions (to install the dependencies); however it is not recommended to start the whole script with `sudo`.
21+
22+
For subsequent builds, see [Compiling PhASAR](#compiling-phasar-if-not-already-done-using-the-installation-scripts).
23+
24+
### Compiling PhASAR (if not already done using the bootstrap script)
25+
26+
Set the system's variables for the C and C++ compiler to clang:
27+
28+
```bash
29+
export CC=/usr/local/bin/clang
30+
export CXX=/usr/local/bin/clang++
31+
```
32+
33+
You may need to adjust the paths according to your system. When you cloned PhASAR from Github you need to initialize PhASAR's submodules before building it:
34+
35+
```bash
36+
git submodule update --init
37+
```
38+
39+
If you downloaded PhASAR as a compressed release (e.g. .zip or .tar.gz) you can use the `init-submodules-release.sh` script that manually clones the required submodules:
40+
41+
```bash
42+
utils/init-submodules-release.sh
43+
```
44+
45+
Navigate into the PhASAR directory. The following commands will do the job and compile the PhASAR framework:
46+
47+
```bash
48+
mkdir build
49+
cd build/
50+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
51+
ninja -j $(nproc) # or use a different number of cores to compile it
52+
sudo ninja install # only if you wish to install PhASAR system wide
53+
```
54+
55+
When you have used the `bootstrap.sh` script to install PhASAR, the above steps are already done.
56+
Use them as a reference if you wish to modify PhASAR and recompile it.
57+
58+
After compilation using cmake the following two binaries can be found in the build/tools directory:
59+
60+
+ `phasar-cli` - the PhASAR command-line tool (previously called `phasar-llvm`) that provides access to analyses that are already implemented within PhASAR. Use this if you don't want to build an own tool on top of PhASAR.
61+
+ `myphasartool` - an example tool that shows how tools can be build on top of PhASAR
62+
63+
Please be careful and check if errors occur during the compilation.
64+
65+
When using CMake to compile PhASAR the following optional parameters can be used:
66+
67+
| Parameter : Type| Effect |
68+
|-----------|--------|
69+
| **BUILD_SHARED_LIBS** : BOOL | Build shared libraries -- Not recommended anymore. You may want to use PHASAR_BUILD_DYNLIB instead (default is OFF) |
70+
| **PHASAR_BUILD_DYNLIB** : BOOL | Build one fat shared library (default is OFF) |
71+
| **CMAKE_BUILD_TYPE** : STRING | Build PhASAR in 'Debug', 'RelWithDebInfo' or 'Release' mode (default is 'Debug') |
72+
| **CMAKE_INSTALL_PREFIX** : PATH | Path where PhASAR will be installed if "ninja install” is invoked or the “install” target is built (default is /usr/local/phasar) |
73+
| **PHASAR_CUSTOM_CONFIG_INSTALL_DIR** : PATH | If set, customizes the directory, where configuration files for PhASAR are installed (default is /usr/local/.phasar-config)|
74+
| **PHASAR_ENABLE_DYNAMIC_LOG** : BOOL|Makes it possible to switch the logger on and off at runtime (default is ON)|
75+
| **PHASAR_BUILD_DOC** : BOOL | Build PhASAR documentation (default is OFF) |
76+
| **PHASAR_BUILD_UNITTESTS** : BOOL | Build PhASAR unit tests (default is ON) |
77+
| **PHASAR_BUILD_IR** : BOOL | Build PhASAR IR (required for running the unit tests) (default is ON) |
78+
| **PHASAR_BUILD_OPENSSL_TS_UNITTESTS** : BOOL | Build PhASAR unit tests that require OpenSSL (default is OFF) |
79+
| **PHASAR_ENABLE_PAMM** : STRING | Enable the performance measurement mechanism ('Off', 'Core' or 'Full', default is Off) |
80+
| **PHASAR_ENABLE_PIC** : BOOL | Build Position-Independed Code (default is ON) |
81+
| **PHASAR_ENABLE_WARNINGS** : BOOL | Enable compiler warnings (default is ON) |
82+
| **CMAKE_CXX_STANDARD** : INT|Build phasar in C++17 or C++20 mode (default is 17)|
83+
84+
You can use these parameters either directly or modify the installer-script `bootstrap.sh`
85+
86+
#### A Remark on Compile Time
87+
88+
C++'s long compile times are always a pain. As shown in the above, when using cmake the compilation can easily be run in parallel, resulting in shorter compilation times. Make use of it!
89+
90+
### Running a Test Solver
91+
92+
To test if everything works as expected please run the following command:
93+
94+
`$ phasar-cli -m test/llvm_test_code/basic/module_cpp.ll -D ifds-solvertest`
95+
96+
You can find the `phasar-cli` tool in the build-tree under `tools/phasar-cli`.
97+
98+
If you obtain output other than a segmentation fault or an exception terminating the program abnormally everything works as expected.
99+
100+
### Building PhASAR on a MacOS System
101+
102+
Due to unfortunate updates to MacOS and the handling of C++, especially on the newer M1 processors, we can't support native development on Mac.
103+
The easiest solution to develop PhASAR on a Mac right now is to use [dockers development environments](https://docs.docker.com/desktop/dev-environments/). Clone this repository as described in their documentation. Afterwards, you have to login once manually, as a root user by running `docker exec -it -u root <container name> /bin/bash` to complete the rest of the build process as described in this readme (install submodules, run bootstrap.sh, ...).
104+
Now you can just attach your docker container to VS Code or any other IDE, which supports remote development.
105+
106+
## Installation
107+
108+
PhASAR can be installed using the installer scripts as explained in the following.
109+
However, you do not need to install PhASAR in order to use it.
110+
111+
### Installing PhASAR on an Ubuntu System
112+
113+
In the following, we would like to give an complete example of how to install
114+
PhASAR using an Ubuntu or Unix-like system.
115+
116+
Therefore, we provide an installation script. To install PhASAR, just navigate to the top-level
117+
directory of PhASAR and use the following command:
118+
119+
```bash
120+
./bootstrap.sh --install
121+
```
122+
123+
The bootstrap script may ask for superuser permissions.
124+
125+
Done!
126+
127+
If You have already built phasar, you can just invoke
128+
```bash
129+
sudo ninja install
130+
```

BreakingChanges.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
*None*
66

7+
## v2510
8+
9+
- Removed some old APIs from `PhasarConfig`
10+
- Removed the header `phasar/Config/Version.h`. Use the generated header `phasar/Config/phasar-config.h` instead.
11+
- Removed `getAsJson()` from various classes. Use `printAsJson(llvm::raw_ostream &)` instead.
12+
- Removed `CallGraphAnalysisType::DTA` and the `DTAResolver` (see below)
13+
- Removed the legacy flow functions `Identity`, `LambdaFlow`, etc. Use the static functions from `FlowFunctionTemplates` instead.
14+
- Removed getter-functions from `GeneralStatistics`. Use the corresponding public fields instead.
15+
- Removed `LLVMAliasGraph`. Use `LLVMAliasSet` instead.
16+
- Removed `TypeGraphs/*` as they are not used.
17+
- Removed the namespace-scoped function `initializeLogger()`. Use the static functions in the `Logger` class instead.
18+
- Removed `legacy::stripPointer(const llvm::Type *)` as it does not work anymore with opaque pointers.
19+
20+
721
## v2503
822

923
- The `DTAResolver` and the cli option `--call-graph-analysis=dta` do not work anymore (due to opaque pointers) and will be removed for the next release. Please use the `OTF` or `RTA` resolver instead.

0 commit comments

Comments
 (0)