Skip to content

Commit

Permalink
Upgrade LLVM to v15.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcserep committed Feb 7, 2024
1 parent f589d15 commit cbb76ab
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 22 deletions.
11 changes: 9 additions & 2 deletions .github/scripts/ubuntu-20.04/setup_build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/bash

# Add official LLVM repositories
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" | sudo tee /etc/apt/sources.list.d/llvm.list
echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
sudo apt-get update

# Install required packages for CodeCompass build
sudo apt-get install -y git cmake make g++ libboost-all-dev llvm-11-dev clang-11 \
libclang-11-dev odb libodb-dev default-jdk libssl-dev \
sudo apt-get install -y git cmake make g++ libboost-all-dev \
llvm-15-dev clang-15 libclang-15-dev odb \
libodb-dev default-jdk libssl-dev \
libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen libgtest-dev npm libldap2-dev
2 changes: 1 addition & 1 deletion .github/scripts/ubuntu-22.04/setup_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Install required packages for CodeCompass build
sudo apt install git cmake make g++ libboost-all-dev \
llvm-11-dev clang-11 libclang-11-dev \
llvm-15-dev clang-15 libclang-15-dev \
gcc-11-plugin-dev thrift-compiler libthrift-dev \
default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev exuberant-ctags doxygen \
libldap2-dev libgtest-dev
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ jobs:
-DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.os }}/${{ matrix.db }}/cc-install
-DDATABASE=$DB_TYPE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DLLVM_DIR=/usr/lib/llvm-11/cmake
-DClang_DIR=/usr/lib/cmake/clang-11
-DLLVM_DIR=/usr/lib/llvm-15/cmake
-DClang_DIR=/usr/lib/cmake/clang-15
-DTEST_DB=$DB_CONNSTRING
- name: Build
Expand Down
8 changes: 4 additions & 4 deletions .gitlab/build-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ export PATH=$DEPS_INSTALL_RUNTIME_DIR/python-install/bin:$PATH

if [ ! -f $DEPS_INSTALL_RUNTIME_DIR/llvm-install/bin/clang ]; then
cd $PACKAGES_DIR
wget --no-verbose --no-clobber https://github.com/llvm/llvm-project/archive/llvmorg-11.1.0.tar.gz
tar -xf llvmorg-11.1.0.tar.gz
mv llvm-project-llvmorg-11.1.0 llvm-project
wget --no-verbose --no-clobber https://github.com/llvm/llvm-project/archive/llvmorg-15.0.7.tar.gz
tar -xf llvmorg-15.0.7.tar.gz
mv llvm-project-llvmorg-15.0.7 llvm-project
mkdir llvm-project/build
cd llvm-project/build

Expand All @@ -264,7 +264,7 @@ if [ ! -f $DEPS_INSTALL_RUNTIME_DIR/llvm-install/bin/clang ]; then
-DLLVM_ENABLE_RTTI=ON

make install --quiet --jobs $(nproc)
rm -f $PACKAGES_DIR/llvmorg-11.1.0.tar.gz
rm -f $PACKAGES_DIR/llvmorg-15.0.7.tar.gz
else
echo "Found LLVM/Clang in cache."
fi
Expand Down
19 changes: 14 additions & 5 deletions doc/deps.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ be installed from the official repository of the given Linux distribution.
is required. (Alternatively, you can compile with Clang.)
- **`gcc-X`, `gcc-X-plugin-dev`**: For building ODB.
- **`libboost-all-dev`**: Boost can be used during the development.
- **`llvm-11-dev`**, **`clang-11`**, **`libclang-11-dev`**: C++ parser uses
- **`llvm-15-dev`**, **`clang-15`**, **`libclang-15-dev`**: C++ parser uses
LLVM/Clang for parsing the source code.
- **`odb`**, **`libodb-dev`**: For persistence ODB can be used which is an
Object Relation Mapping (ORM) system.
Expand Down Expand Up @@ -52,9 +52,18 @@ known issues.

#### Ubuntu 20.04 ("Focal Fossa") LTS

The standard Ubuntu Focal package repository contains only LLCM/Clang version 12,
which is not sufficient for CodeCompass, as at least version 15 is required.
Therefore LLVM and Clang should be installed from the official LLVM repositories:

```bash
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" | sudo tee /etc/apt/sources.list.d/llvm.list
echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" | sudo -a tee /etc/apt/sources.list.d/llvm.list
sudo apt-get update

sudo apt install git cmake make g++ libboost-all-dev \
llvm-11-dev clang-11 libclang-11-dev \
llvm-15-dev clang-15 libclang-15-dev \
odb libodb-dev \
default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen \
libldap2-dev libgtest-dev
Expand All @@ -64,7 +73,7 @@ sudo apt install git cmake make g++ libboost-all-dev \

```bash
sudo apt install git cmake make g++ libboost-all-dev \
llvm-11-dev clang-11 libclang-11-dev \
llvm-15-dev clang-15 libclang-15-dev \
gcc-11-plugin-dev thrift-compiler libthrift-dev \
default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev exuberant-ctags doxygen \
libldap2-dev libgtest-dev
Expand Down Expand Up @@ -269,8 +278,8 @@ cmake .. \
-DCMAKE_INSTALL_PREFIX=<CodeCompass_install_dir> \
-DDATABASE=<database_type> \
-DCMAKE_BUILD_TYPE=<build_type> \
-DLLVM_DIR=/usr/lib/llvm-11/cmake \
-DClang_DIR=/usr/lib/cmake/clang-11
-DLLVM_DIR=/usr/lib/llvm-15/cmake \
-DClang_DIR=/usr/lib/cmake/clang-15

# To specify linker for building CodeCompass use
# -DCODECOMPASS_LINKER=<path_to_linker>
Expand Down
6 changes: 3 additions & 3 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN set -x && apt-get update -qq \
libmagic-dev \
libsqlite3-dev \
libssl-dev \
llvm-11 clang-11 llvm-11-dev libclang-11-dev \
llvm-15 clang-15 llvm-15-dev libclang-15-dev \
thrift-compiler libthrift-dev \
postgresql-server-dev-14 \
postgresql-14 && \
Expand Down Expand Up @@ -70,7 +70,7 @@ ENV DATABASE=sqlite \
TEST_WORKSPACE=/CodeCompass/test_workspace \
TEST_DB="sqlite:database=$TEST_WORKSPACE/cc_test.sqlite" \
WITH_AUTH="plain;ldap" \
LLVM_DIR=/usr/lib/llvm-11/cmake \
Clang_DIR=/usr/lib/cmake/clang-11
LLVM_DIR=/usr/lib/llvm-15/cmake \
Clang_DIR=/usr/lib/cmake/clang-15

ENV PATH="$INSTALL_DIR/bin:$PATH"
2 changes: 1 addition & 1 deletion docker/runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ RUN set -x && apt-get update -qq && \
apt-get install -qq --yes --no-install-recommends \
curl ca-certificates gnupg \
wget \
llvm-11 \
llvm-15 \
libboost-filesystem-dev libboost-log-dev libboost-program-options-dev \
default-jre \
libgit2-dev \
Expand Down
2 changes: 1 addition & 1 deletion docker/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ COPY docker/dev/install_odb.sh /

RUN set -x && apt-get update -qq \
&& apt-get install -qqy --no-install-recommends \
llvm-11 \
llvm-15 \
libboost-filesystem-dev libboost-log-dev libboost-program-options-dev \
libsqlite3-dev \
postgresql-server-dev-14 \
Expand Down
2 changes: 1 addition & 1 deletion plugins/cpp/parser/src/clangastvisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ class ClangASTVisitor : public clang::RecursiveASTVisitor<ClangASTVisitor>
clang::DynTypedNodeList parents
= _astContext.getParents(*expr_);

const clang::ast_type_traits::DynTypedNode& parent = parents[0];
const clang::DynTypedNode& parent = parents[0];

if (const clang::BinaryOperator* op = parent.get<clang::BinaryOperator>())
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/cpp/parser/src/ppincludecallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void PPIncludeCallback::InclusionDirective(
clang::StringRef fileName_,
bool,
clang::CharSourceRange filenameRange_,
const clang::FileEntry*,
clang::Optional<clang::FileEntryRef>,
clang::StringRef searchPath_,
clang::StringRef,
const clang::Module*,
Expand Down
2 changes: 1 addition & 1 deletion plugins/cpp/parser/src/ppincludecallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PPIncludeCallback : public clang::PPCallbacks
clang::StringRef FileName,
bool IsAngled,
clang::CharSourceRange FilenameRange,
const clang::FileEntry *File,
clang::Optional<clang::FileEntryRef> File,
clang::StringRef SearchPath,
clang::StringRef RelativePath,
const clang::Module *Imported,
Expand Down

0 comments on commit cbb76ab

Please sign in to comment.