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
2 changes: 1 addition & 1 deletion .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout DG
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install clang-format 14
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout DG
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build the Docker image
run: |
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/hash_map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
os: [ubuntu-22.04]
compiler: [gcc, clang]
hashmap: [tsl-hopscotch]

Expand All @@ -18,18 +18,22 @@ jobs:

steps:
- name: Checkout DG
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Checkout TSL Hopscotch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: Tessil/hopscotch-map
# Pinned: this checkout used to float on hopscotch-map's master, so
# the job broke whenever that project moved. v2.4.0 and current
# master do not compile against DG's SparseBitvectorImpl usage.
ref: v2.3.1
path: tsl-hopscotch

- name: Install dependencies
run: |
sudo apt update
sudo apt install ccache cmake ninja-build clang-10 llvm-10-dev
sudo apt install ccache cmake ninja-build clang-14 llvm-14-dev

- name: Set environment
id: env
Expand All @@ -41,8 +45,8 @@ jobs:
esac

if [[ "${{matrix.compiler}}" = "clang" ]]; then
echo "CC=clang-10" >> $GITHUB_ENV
echo "CXX=clang++-10" >> $GITHUB_ENV
echo "CC=clang-14" >> $GITHUB_ENV
echo "CXX=clang++-14" >> $GITHUB_ENV

# force coloured output
echo "CFLAGS=$CFLAGS -fcolor-diagnostics" >> $GITHUB_ENV
Expand All @@ -66,10 +70,10 @@ jobs:
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=400M" >> $GITHUB_ENV

echo "::set-output name=timestamp::$(date -u -Iseconds)"
echo "timestamp=$(date -u -Iseconds)" >> $GITHUB_OUTPUT

- name: Set up ccache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .ccache
key: ${{matrix.os}}-${{matrix.hashmap}}-${{matrix.compiler}}-${{steps.env.outputs.timestamp}}
Expand All @@ -81,7 +85,7 @@ jobs:
-B_build \
-GNinja \
-DUSE_SANITIZERS:BOOL=ON \
-DLLVM_DIR:PATH="$(llvm-config-10 --cmakedir)" \
-DLLVM_DIR:PATH="$(llvm-config-14 --cmakedir)" \
-D${HASHMAP}:PATH="$GITHUB_WORKSPACE/${{matrix.hashmap}}"

- name: Build
Expand Down
43 changes: 12 additions & 31 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,21 @@ jobs:
fail-fast: false
matrix:
include:
# LLVM 3.9-10 are dropped: they only ever shipped in the
# ubuntu-18.04/20.04 runner images, which GitHub has retired, and
# apt.llvm.org no longer carries them either. The range below is
# what Symbiotic builds DG against.

# Linux with GCC
- {os: ubuntu-18.04, llvm: '3.9', compiler: gcc}
- {os: ubuntu-18.04, llvm: '4.0', compiler: gcc}
- {os: ubuntu-18.04, llvm: '5.0', compiler: gcc}
- {os: ubuntu-18.04, llvm: '6.0', compiler: gcc}
- {os: ubuntu-18.04, llvm: 7, compiler: gcc}
- {os: ubuntu-18.04, llvm: 8, compiler: gcc}
- {os: ubuntu-18.04, llvm: 9, compiler: gcc}
- {os: ubuntu-20.04, llvm: 10, compiler: gcc}
- {os: ubuntu-20.04, llvm: 11, compiler: gcc}
- {os: ubuntu-20.04, llvm: 12, compiler: gcc}
- {os: ubuntu-22.04, llvm: 11, compiler: gcc}
- {os: ubuntu-22.04, llvm: 12, compiler: gcc}
- {os: ubuntu-22.04, llvm: 13, compiler: gcc}
- {os: ubuntu-22.04, llvm: 14, compiler: gcc}
- {os: ubuntu-22.04, llvm: 14, compiler: gcc, type: Debug}

# Linux with Clang
- {os: ubuntu-18.04, llvm: '3.9', compiler: clang}
- {os: ubuntu-18.04, llvm: '4.0', compiler: clang}
- {os: ubuntu-18.04, llvm: '5.0', compiler: clang}
- {os: ubuntu-18.04, llvm: '6.0', compiler: clang}
- {os: ubuntu-18.04, llvm: 7, compiler: clang}
- {os: ubuntu-18.04, llvm: 8, compiler: clang}
- {os: ubuntu-18.04, llvm: 9, compiler: clang}
- {os: ubuntu-20.04, llvm: 10, compiler: clang}
- {os: ubuntu-20.04, llvm: 11, compiler: clang}
- {os: ubuntu-20.04, llvm: 12, compiler: clang}
- {os: ubuntu-22.04, llvm: 11, compiler: clang}
- {os: ubuntu-22.04, llvm: 12, compiler: clang}
- {os: ubuntu-22.04, llvm: 13, compiler: clang}
- {os: ubuntu-22.04, llvm: 14, compiler: clang}
- {os: ubuntu-22.04, llvm: 14, compiler: clang, type: Debug}
Expand All @@ -46,13 +35,7 @@ jobs:

steps:
- name: Checkout DG
uses: actions/checkout@v3

- name: '[LLVM ${{matrix.llvm}}] Add repositories'
if: matrix.llvm >= 15
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{matrix.llvm}} main"
uses: actions/checkout@v4

- name: Install dependencies
run: |
Expand Down Expand Up @@ -83,7 +66,6 @@ jobs:
sudo /usr/sbin/update-ccache-symlinks
echo "/usr/lib/ccache" >> $GITHUB_PATH

# Bionic does not create symlinks to versioned clang
sudo ln -sfr /usr/bin/ccache /usr/lib/ccache/clang-${{matrix.llvm}}
sudo ln -sfr /usr/bin/ccache /usr/lib/ccache/clang++-${{matrix.llvm}}

Expand All @@ -93,10 +75,10 @@ jobs:
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=400M" >> $GITHUB_ENV

echo "::set-output name=timestamp::$(date -u -Iseconds)"
echo "timestamp=$(date -u -Iseconds)" >> $GITHUB_OUTPUT

- name: Set up ccache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .ccache
key: ${{matrix.os}}-${{matrix.llvm}}-${{matrix.compiler}}-${{matrix.type}}-${{steps.env.outputs.timestamp}}
Expand All @@ -110,7 +92,6 @@ jobs:
-DCMAKE_BUILD_TYPE:STRING="${{matrix.type}}" \
-DUSE_SANITIZERS:BOOL=ON \
-DLLVM_DIR:PATH="/usr/lib/llvm-${{matrix.llvm}}/lib/cmake/llvm"
# llvm-config-3.9 does not take --cmakedir yet!

- name: '[Dynamic LLVM] Build'
run: cmake --build _build
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-12]
os: [macos-15]
build: [Debug, RelWithDebInfo]

runs-on: ${{matrix.os}}
Expand All @@ -18,7 +18,7 @@ jobs:

steps:
- name: Checkout DG
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install dependencies
run: brew install ninja ccache llvm@14
Expand All @@ -32,12 +32,12 @@ jobs:
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=400M" >> $GITHUB_ENV

echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
echo "$(brew --prefix ccache)/libexec" >> $GITHUB_PATH

echo "::set-output name=timestamp::$(date -u +%Y-%m-%dT%H:%M:%S%z)"
echo "timestamp=$(date -u +%Y-%m-%dT%H:%M:%S%z)" >> $GITHUB_OUTPUT

- name: Set-up ccache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .ccache
key: ${{matrix.os}}-${{matrix.build}}-${{steps.env.outputs.timestamp}}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/svf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ jobs:

steps:
- name: Checkout DG
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Checkout SVF
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: SVF-2.4
repository: SVF-tools/SVF
path: svf

- name: Checkout SVF test-suite
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# ref corresponding to the SVF ref above
ref: 2338ede904c1f46293b64ccf32feb09b3904401f
Expand Down Expand Up @@ -69,10 +69,10 @@ jobs:
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=400M" >> $GITHUB_ENV

echo "::set-output name=timestamp::$(date -u -Iseconds)"
echo "timestamp=$(date -u -Iseconds)" >> $GITHUB_OUTPUT

- name: Set up ccache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .ccache
key: ${{matrix.os}}-svf-${{matrix.compiler}}-${{steps.env.outputs.timestamp}}
Expand Down
21 changes: 15 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,20 @@ check_cxx_source_compiles(
HAS_FUZZER)
set(CMAKE_REQUIRED_FLAGS "")

option(ENABLE_FUZZING "Enable fuzzing tests" ${HAS_FUZZER})
# clang 11 accepts these flags but the binary aborts at startup against
# glibc 2.35, so this has to run, not just compile (llvm/llvm-project#55785).
include(CheckCXXSourceRuns)
set(CMAKE_REQUIRED_FLAGS "-fsanitize=address,undefined")
check_cxx_source_runs("int main() { return 0; }" SANITIZER_RUNTIME_WORKS)
set(CMAKE_REQUIRED_FLAGS "")

if(HAS_FUZZER AND SANITIZER_RUNTIME_WORKS)
set(FUZZING_DEFAULT ON)
else()
set(FUZZING_DEFAULT OFF)
endif()

option(ENABLE_FUZZING "Enable fuzzing tests" ${FUZZING_DEFAULT})
if(NOT ENABLE_FUZZING)
message(STATUS "Will NOT build fuzzing tests (requires Clang 6 or newer)")
endif()
Expand Down Expand Up @@ -199,11 +212,7 @@ if (NO_EXCEPTIONS)
endif()

if (USE_SANITIZERS)
set(CMAKE_REQUIRED_FLAGS "-fsanitize=undefined,address") # for linker
check_cxx_compiler_flag("-fsanitize=undefined,address" sanitizers_work)
set(CMAKE_REQUIRED_FLAGS "")

if (sanitizers_work)
if (SANITIZER_RUNTIME_WORKS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize-recover=all")
Expand Down
4 changes: 3 additions & 1 deletion include/dg/CallGraph/CallGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class GenericCallGraph {
bool isCalledBy(FuncNode *x) const { return _contains(x, _callers); }

bool forks(const FuncNode *x) const { return _contains(x, _forks); }
bool isForkedBy(const FuncNode *x) const { return _contains(x, _forkers); }
bool isForkedBy(const FuncNode *x) const {
return _contains(x, _forkers);
}

unsigned getID() const { return _id; }
unsigned getSCCId() const { return _scc_id; }
Expand Down
2 changes: 1 addition & 1 deletion include/dg/DataDependence/DataDependenceAnalysisOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct FunctionModel {
}

bool handles(unsigned i) const {
return defines(i) || uses(i) || _definesAllArgs;
return defines(i) || uses(i) || _definesAllArgs;
}

private:
Expand Down
5 changes: 3 additions & 2 deletions include/dg/ReadWriteGraph/RWNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,9 @@ class RWNodeFork : public RWNode {
}

static const RWNodeFork *get(const RWNode *n) {
return n->getType() == RWNodeType::FORK ? static_cast<const RWNodeFork *>(n)
: nullptr;
return n->getType() == RWNodeType::FORK
? static_cast<const RWNodeFork *>(n)
: nullptr;
}

RWCalledValue *getSingleForkee() {
Expand Down
16 changes: 8 additions & 8 deletions include/dg/ReadWriteGraph/ReadWriteGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ class ReadWriteGraph {

RWNode &create(RWNodeType t) {
switch (t) {
case RWNodeType::CALL:
_nodes.emplace_back(new RWNodeCall(++lastNodeID));
break;
case RWNodeType::FORK:
_nodes.emplace_back(new RWNodeFork(++lastNodeID));
break;
default:
_nodes.emplace_back(new RWNode(++lastNodeID, t));
case RWNodeType::CALL:
_nodes.emplace_back(new RWNodeCall(++lastNodeID));
break;
case RWNodeType::FORK:
_nodes.emplace_back(new RWNodeFork(++lastNodeID));
break;
default:
_nodes.emplace_back(new RWNode(++lastNodeID, t));
}

return *_nodes.back().get();
Expand Down
4 changes: 2 additions & 2 deletions include/dg/ValueRelations/RelationsGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ class RelationsGraph {
RelationsMap result;
std::set_intersection(ltGE.begin(), ltGE.end(), rtLE.begin(),
rtLE.end(), std::inserter(result, result.begin()),
[](RelationsMap::value_type &ltPair,
RelationsMap::value_type &rtPair) {
[](const RelationsMap::value_type &ltPair,
const RelationsMap::value_type &rtPair) {
return ltPair.first < rtPair.first;
});

Expand Down
4 changes: 2 additions & 2 deletions include/dg/llvm/LLVMSlicer.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ class LLVMSlicer : public Slicer<LLVMNode> {
F->deleteBody();

if (!F->hasAddressTaken()) {
// remove the function only if it does not have its address taken
// to maintain valid pointers to it
// remove the function only if it does not have its address
// taken to maintain valid pointers to it
F->replaceAllUsesWith(llvm::UndefValue::get(F->getType()));
F->eraseFromParent();
}
Expand Down
3 changes: 2 additions & 1 deletion lib/llvm/PointerAnalysis/Threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ PSNodeFork *LLVMPointerGraphBuilder::createForkNode(const llvm::CallInst *CInst,

const Value *spawnedFunc = CInst->getArgOperand(2)->stripPointerCasts();
if (const Function *func = dyn_cast<Function>(spawnedFunc)) {
PS.registerFork(getPointsToNode(CInst->getParent()->getParent()), getPointsToNode(func));
PS.registerFork(getPointsToNode(CInst->getParent()->getParent()),
getPointsToNode(func));
addFunctionToFork(getNodes(func)->getSingleNode(), forkNode);
}

Expand Down
Loading
Loading