Skip to content

Commit 67e6ef7

Browse files
LLVM 11 migration (#627)
LLVM and Clang 10 -> 11 migration
1 parent 150cde5 commit 67e6ef7

11 files changed

Lines changed: 46 additions & 20 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

33
# Install required packages for CodeCompass build
4-
sudo apt-get install -y git cmake make g++ libboost-all-dev llvm-10-dev clang-10 \
5-
libclang-10-dev odb libodb-dev thrift-compiler libthrift-dev default-jdk libssl-dev \
4+
sudo apt-get install -y git cmake make g++ libboost-all-dev llvm-11-dev clang-11 \
5+
libclang-11-dev odb libodb-dev thrift-compiler libthrift-dev default-jdk libssl-dev \
66
libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen libgtest-dev npm libldap2-dev

.github/scripts/setup_runtime_ubuntu-20.04.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Install required packages for CodeCompass runtime
44
sudo apt-get install -y git cmake make g++ graphviz \
55
libboost-filesystem1.71.0 libboost-log1.71.0 libboost-program-options1.71.0 \
6-
libllvm10 clang-10 libclang1-10 libthrift-0.13.0 default-jre libssl1.1 libmagic1 \
6+
libllvm11 clang-11 libclang1-11 libthrift-0.13.0 default-jre libssl1.1 libmagic1 \
77
libgit2-28 ctags googletest libldap-2.4-2

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ jobs:
8585
-DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.os }}/${{ matrix.db }}/cc-install
8686
-DDATABASE=$DB_TYPE
8787
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
88-
-DLLVM_DIR=/usr/lib/llvm-10/cmake
89-
-DClang_DIR=/usr/lib/cmake/clang-10
88+
-DLLVM_DIR=/usr/lib/llvm-11/cmake
89+
-DClang_DIR=/usr/lib/cmake/clang-11
9090
-DTEST_DB=$DB_CONNSTRING
9191
9292
- name: Build

.gitlab/build-deps.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,9 @@ export PATH=$DEPS_INSTALL_RUNTIME_DIR/python-install/bin:$PATH
254254

255255
if [ ! -f $DEPS_INSTALL_RUNTIME_DIR/llvm-install/bin/clang ]; then
256256
cd $PACKAGES_DIR
257-
wget --no-verbose --no-clobber https://github.com/llvm/llvm-project/archive/llvmorg-10.0.1.tar.gz
258-
tar -xf llvmorg-10.0.1.tar.gz
259-
mv llvm-project-llvmorg-10.0.1 llvm-project
257+
wget --no-verbose --no-clobber https://github.com/llvm/llvm-project/archive/llvmorg-11.1.0.tar.gz
258+
tar -xf llvmorg-11.1.0.tar.gz
259+
mv llvm-project-llvmorg-11.1.0 llvm-project
260260
mkdir llvm-project/build
261261
cd llvm-project/build
262262

@@ -268,7 +268,7 @@ if [ ! -f $DEPS_INSTALL_RUNTIME_DIR/llvm-install/bin/clang ]; then
268268
-DLLVM_ENABLE_RTTI=ON
269269

270270
make install --quiet --jobs $(nproc)
271-
rm -f $PACKAGES_DIR/llvmorg-10.0.1.tar.gz
271+
rm -f $PACKAGES_DIR/llvmorg-11.1.0.tar.gz
272272
else
273273
echo "Found LLVM/Clang in cache."
274274
fi

doc/deps.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ be installed from the official repository of the given Linux distribution.
1515
is required. (Alternatively, you can compile with Clang.)
1616
- **`gcc-X`, `gcc-X-plugin-dev`**: For building ODB.
1717
- **`libboost-all-dev`**: Boost can be used during the development.
18-
- **`llvm-10-dev`**, **`clang-10`**, **`libclang-10-dev`**: C++ parser uses
18+
- **`llvm-11-dev`**, **`clang-11`**, **`libclang-11-dev`**: C++ parser uses
1919
LLVM/Clang for parsing the source code.
2020
- **`odb`**, **`libodb-dev`**: For persistence ODB can be used which is an
2121
Object Relation Mapping (ORM) system.
@@ -59,12 +59,22 @@ sudo apt install git cmake make g++ gcc-7-plugin-dev libboost-all-dev \
5959

6060
```bash
6161
sudo apt install git cmake make g++ libboost-all-dev \
62-
llvm-10-dev clang-10 libclang-10-dev \
62+
llvm-11-dev clang-11 libclang-11-dev \
6363
odb libodb-dev thrift-compiler libthrift-dev \
6464
default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen \
6565
libldap2-dev libgtest-dev npm
6666
```
6767

68+
#### Ubuntu 22.04 ("Jammy Jellyfish") LTS
69+
70+
```bash
71+
sudo apt install git curl wget cmake make libboost-all-dev \
72+
g++ gcc-11-plugin-dev \
73+
llvm-11-dev clang-11 libclang-11-dev \
74+
default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev exuberant-ctags doxygen \
75+
libldap2-dev libgtest-dev
76+
```
77+
6878
#### Database engine support
6979

7080
Depending on the desired database engines to be supported, the following
@@ -94,6 +104,15 @@ sudo apt install libodb-sqlite-dev libsqlite3-dev
94104
sudo apt install libodb-pgsql-dev postgresql-server-dev-<version>
95105
```
96106

107+
##### Ubuntu 22.04 ("Jammy Jellyfish") LTS
108+
109+
```bash
110+
# For SQLite database systems:
111+
sudo apt install libsqlite3-dev
112+
113+
# For PostgreSQL database systems:
114+
sudo apt install postgresql-server-dev-14
115+
```
97116

98117
## Known issues
99118
Some third-party tools are present in the distribution's package manager in a
@@ -106,7 +125,7 @@ by other processes which could, in extreme cases, make the system very hard or
106125
impossible to recover. **Please do NOT add a `sudo` in front of any `make` or
107126
other commands below, unless *explicitly* specified!**
108127

109-
### ODB (for Ubuntu 18.04)
128+
### ODB (for Ubuntu 18.04, Ubuntu 22.04)
110129
ODB is an Object Relational Mapping tool, that is required by CodeCompass.
111130
For Ubuntu 18.04, the official release of ODB conflicts with the official
112131
compiler (GNU G++ 7) of the distribution. A newer version of ODB must be
@@ -153,7 +172,7 @@ time (depending on the machine one is using).
153172
> **Note:** now you may delete the *Build2* toolchain installed in the
154173
> `<build2_install_dir>` folder, if you do not need any longer.
155174
156-
### Thrift (for Ubuntu 18.04)
175+
### Thrift (for Ubuntu 18.04, Ubuntu 22.04)
157176
CodeCompass needs [Thrift](https://thrift.apache.org/) which provides Remote
158177
Procedure Call (RPC) between the server and the client. A suitable version of
159178
Thrift is, unfortunately, not part of the official Ubuntu repositories for
@@ -215,7 +234,7 @@ seen by CMake. Please set this environment before executing the build.
215234
```bash
216235
export GTEST_ROOT=<gtest_install_dir>
217236

218-
# If using Ubuntu 18.04:
237+
# If using Ubuntu 18.04 or Ubuntu 22.04:
219238
export CMAKE_PREFIX_PATH=<thrift_install_dir>:$CMAKE_PREFIX_PATH
220239
export CMAKE_PREFIX_PATH=<odb_install_directory>:$CMAKE_PREFIX_PATH
221240

@@ -239,8 +258,8 @@ cmake .. \
239258
-DCMAKE_INSTALL_PREFIX=<CodeCompass_install_dir> \
240259
-DDATABASE=<database_type> \
241260
-DCMAKE_BUILD_TYPE=<build_type> \
242-
-DLLVM_DIR=/usr/lib/llvm-10/cmake \
243-
-DClang_DIR=/usr/lib/cmake/clang-10
261+
-DLLVM_DIR=/usr/lib/llvm-11/cmake \
262+
-DClang_DIR=/usr/lib/cmake/clang-11
244263

245264
# To specify linker for building CodeCompass use
246265
# -DCODECOMPASS_LINKER=<path_to_linker>

plugins/cpp/model/include/model/cppfriendship.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#define CC_MODEL_CPPFRIENDSHIP_H
33

44
#include <memory>
5+
#include <cstdint>
6+
#include <string>
57

68
namespace cc
79
{

plugins/cpp/model/include/model/cpprelation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#define CC_MODEL_CPPRELATION_H
33

44
#include <memory>
5+
#include <cstdint>
6+
#include <string>
57

68
namespace cc
79
{

plugins/cpp/parser/include/cppparser/filelocutil.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class FileLocUtil
9595
if (!fileEntry)
9696
return std::string();
9797

98-
return fileEntry->getName();
98+
return std::string(fileEntry->getName());
9999
}
100100

101101
private:

plugins/cpp/parser/src/clangastvisitor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <clang/Basic/SourceManager.h>
1111
#include <clang/AST/Decl.h>
1212
#include <clang/AST/RecursiveASTVisitor.h>
13+
#include <clang/AST/ParentMapContext.h>
1314
#include <llvm/Support/raw_ostream.h>
1415

1516
#include <model/cppastnode.h>
@@ -1385,7 +1386,7 @@ class ClangASTVisitor : public clang::RecursiveASTVisitor<ClangASTVisitor>
13851386
{
13861387
while (expr_)
13871388
{
1388-
clang::ASTContext::DynTypedNodeList parents
1389+
clang::DynTypedNodeList parents
13891390
= _astContext.getParents(*expr_);
13901391

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

plugins/cpp_reparse/service/src/asthtml.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,14 @@ class ASTSubtreeHTMLPrinter
192192
{
193193
if (_locator.matchNodeAgainstLocation(s_))
194194
{
195-
s_->dump(*_out, _context.getSourceManager());
195+
s_->dump(*_out, _context);
196196
return true;
197197
}
198198
return Base::TraverseStmt(s_);
199199
}
200200

201201
private:
202+
202203
std::unique_ptr<raw_ostream> _out;
203204
ASTContext& _context;
204205
cc::service::reparse::ASTNodeLocator _locator;
@@ -221,7 +222,7 @@ std::unique_ptr<clang::ASTConsumer> ASTHTMLActionFactory::newASTConsumer()
221222
assert(_stream && "Must not call newASTConsumer twice as the underlying "
222223
"stream has been moved out.");
223224
return clang::CreateASTDumper(std::move(_stream), "",
224-
true, true, false, clang::ADOF_Default);
225+
true, true, false, false, clang::ADOF_Default);
225226
}
226227

227228
std::unique_ptr<clang::ASTConsumer>

0 commit comments

Comments
 (0)