Skip to content

[clang][docs] Improve "Obtaining Clang" section #71313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2024
Merged
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
14 changes: 7 additions & 7 deletions clang/docs/LibASTMatchersTutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ started guide <https://llvm.org/docs/GettingStarted.html>`_.

.. code-block:: console

cd ~/clang-llvm
mkdir ~/clang-llvm && cd ~/clang-llvm
git clone https://github.com/llvm/llvm-project.git

Next you need to obtain the CMake build system and Ninja build tool.
Expand All @@ -33,11 +33,11 @@ Next you need to obtain the CMake build system and Ninja build tool.
git clone https://github.com/martine/ninja.git
cd ninja
git checkout release
./bootstrap.py
./configure.py --bootstrap
sudo cp ninja /usr/bin/

cd ~/clang-llvm
git clone git://cmake.org/stage/cmake.git
git clone https://gitlab.kitware.com/cmake/cmake.git
cd cmake
git checkout next
./bootstrap
Expand All @@ -50,7 +50,7 @@ Okay. Now we'll build Clang!

cd ~/clang-llvm
mkdir build && cd build
cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_TESTS=ON
cmake -G Ninja ../llvm-project/llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_TESTS=ON
ninja
ninja check # Test LLVM only.
ninja clang-test # Test Clang only.
Expand All @@ -65,7 +65,7 @@ Finally, we want to set Clang as its own compiler.
.. code-block:: console

cd ~/clang-llvm/build
ccmake ../llvm
ccmake ../llvm-project/llvm

The second command will bring up a GUI for configuring Clang. You need
to set the entry for ``CMAKE_CXX_COMPILER``. Press ``'t'`` to turn on
Expand All @@ -89,7 +89,7 @@ live in the ``clang-tools-extra`` repository.

.. code-block:: console

cd ~/clang-llvm
cd ~/clang-llvm/llvm-project
mkdir clang-tools-extra/loop-convert
echo 'add_subdirectory(loop-convert)' >> clang-tools-extra/CMakeLists.txt
vim clang-tools-extra/loop-convert/CMakeLists.txt
Expand Down Expand Up @@ -314,7 +314,7 @@ handiwork:

.. code-block:: console

cd ~/clang-llvm/llvm/llvm_build/
cd ~/clang-llvm/build/
ninja loop-convert
vim ~/test-files/simple-loops.cc
bin/loop-convert ~/test-files/simple-loops.cc
Expand Down