Skip to content

Commit 2cb9e5b

Browse files
authored
Merge pull request #436 from secure-software-engineering/f-LLVM13Support
Add LLVM 13 support
2 parents 36445a6 + 83b519e commit 2cb9e5b

9 files changed

Lines changed: 32 additions & 21 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: true
1414
matrix:
15-
compiler: [ [clang++-12, clang-12] ]
15+
compiler: [ [clang++-13, clang-13] ]
1616
build: [ Debug, Release ]
1717

1818
continue-on-error: false
@@ -42,16 +42,16 @@ jobs:
4242
shell: bash
4343
run: |
4444
sudo apt-key adv --fetch-keys https://apt.llvm.org/llvm-snapshot.gpg.key
45-
sudo add-apt-repository -y 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main'
45+
sudo add-apt-repository -y 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'
4646
sudo apt-get update
4747
sudo apt-get -y install --no-install-recommends \
4848
${{ matrix.compiler[1] }} \
49-
llvm-12-dev \
50-
libllvm12 \
51-
libclang-common-12-dev \
52-
libclang-12-dev \
53-
libclang-cpp12-dev \
54-
clang-tidy-12
49+
llvm-13-dev \
50+
libllvm13 \
51+
libclang-common-13-dev \
52+
libclang-13-dev \
53+
libclang-cpp13-dev \
54+
clang-tidy-13
5555
5656
- name: Building Phasar in ${{ matrix.build }} with ${{ matrix.compiler[0] }}
5757
env:

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515
- tool: clang-format
1616
install: |
1717
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-12 main'
18+
sudo add-apt-repository -y 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'
1919
sudo apt-get update
20-
sudo apt-get -y install --no-install-recommends clang-format-12
20+
sudo apt-get -y install --no-install-recommends clang-format-13
2121
regex: \.(h|c|hpp|cpp)$
22-
command: clang-format-12 --style=file -i
22+
command: clang-format-13 --style=file -i
2323

2424
continue-on-error: false
2525
steps:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ repos:
1010
- id: check-added-large-files
1111
- id: requirements-txt-fixer
1212
- repo: https://github.com/pre-commit/mirrors-clang-format
13-
rev: 'v12.0.1'
13+
rev: 'v13.0.0'
1414
hooks:
1515
- id: clang-format

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ include_directories(${SQLITE3_INCLUDE_DIR})
179179
# LLVM
180180
if (NOT PHASAR_IN_TREE)
181181
# Only search for LLVM if we build out of tree
182-
find_package(LLVM 12 REQUIRED CONFIG)
182+
find_package(LLVM 13 REQUIRED CONFIG)
183183
include_directories(${LLVM_INCLUDE_DIRS})
184184
link_directories(${LLVM_LIB_PATH} ${LLVM_LIBRARY_DIRS})
185185
endif()

Config.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ foreach(component ${phasar_FIND_COMPONENTS})
99
endforeach()
1010

1111
function(phasar_config executable)
12-
find_package(LLVM 12 REQUIRED CONFIG)
12+
find_package(LLVM 13 REQUIRED CONFIG)
1313
include_directories(${LLVM_INCLUDE_DIRS})
1414
link_directories(${LLVM_LIB_PATH} ${LLVM_LIBRARY_DIRS})
1515
find_library(LLVM_LIBRARY NAMES LLVM HINTS ${LLVM_LIBRARY_DIRS})

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ PhASAR requires C++-17.
2020

2121
Currently supported version of LLVM
2222
-----------------------------------
23-
PhASAR is currently set up to support LLVM-12.0.
23+
PhASAR is currently set up to support LLVM-13.0.
2424

2525
What is PhASAR?
2626
---------------

bootstrap.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ source ./utils/safeCommandsSet.sh
55

66
readonly PHASAR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
77
readonly PHASAR_INSTALL_DIR="/usr/local/phasar"
8-
readonly LLVM_INSTALL_DIR="/usr/local/llvm-12"
8+
readonly LLVM_INSTALL_DIR="/usr/local/llvm-13"
99

1010
NUM_THREADS=$(nproc)
11-
LLVM_RELEASE=llvmorg-12.0.0
11+
LLVM_RELEASE=llvmorg-13.0.0
1212
DO_UNIT_TEST=true
1313

1414

include/phasar/Utils/BitVectorSet.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ template <typename T> class BitVectorSet {
270270
[[nodiscard]] size_t size() const noexcept { return Bits.count(); }
271271

272272
friend bool operator==(const BitVectorSet &Lhs, const BitVectorSet &Rhs) {
273+
bool LeftEmpty = Lhs.empty();
274+
bool RightEmpty = Rhs.empty();
275+
if (LeftEmpty || RightEmpty) {
276+
return LeftEmpty == RightEmpty;
277+
}
273278
// Check, whether Lhs and Rhs actually have the same bits set and not
274279
// whether their internal representation is exactly identitcal
275280
auto LhsWords = Lhs.Bits.getData();

lib/PhasarLLVM/DataFlowSolver/IfdsIde/IFDSFieldSensTaintAnalysis/Utils/DataFlowUtils.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,11 @@ normalizeGlobalGEPs(const std::vector<const llvm::Value *> &MemLocationSeq) {
274274
GepInst->idx_end());
275275

276276
auto *SplittedGEPInst = llvm::GetElementPtrInst::CreateInBounds(
277-
const_cast<llvm::Value *>( // FIXME this is terrible.
278-
NormalizedMemLocationSeq.back()),
277+
NormalizedMemLocationSeq.back()
278+
->getType()
279+
->getScalarType()
280+
->getPointerElementType(),
281+
const_cast<llvm::Value *>(NormalizedMemLocationSeq.back()),
279282
{Indices[0], Indices[1]}, "gepsplit0");
280283
NormalizedMemLocationSeq.push_back(SplittedGEPInst);
281284

@@ -289,8 +292,11 @@ normalizeGlobalGEPs(const std::vector<const llvm::Value *> &MemLocationSeq) {
289292
NameStream << "gepsplit" << (I - 1);
290293

291294
SplittedGEPInst = llvm::GetElementPtrInst::CreateInBounds(
292-
const_cast<llvm::Value *>( // FIXME this is terrible.
293-
NormalizedMemLocationSeq.back()),
295+
NormalizedMemLocationSeq.back()
296+
->getType()
297+
->getScalarType()
298+
->getPointerElementType(),
299+
const_cast<llvm::Value *>(NormalizedMemLocationSeq.back()),
294300
{ConstantZero, Index}, NameStream.str());
295301
NormalizedMemLocationSeq.push_back(SplittedGEPInst);
296302
}

0 commit comments

Comments
 (0)