「Clang」 入门
1 安装
1.1 源码
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build
cd build
cmake -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../llvm
make
# This builds both LLVM and Clang for debug mode.
# Note: For subsequent Clang development, you can just run make clang.
1.2 检验
- 尝试
clang --help clang file.c -fsyntax-only # (check for correctness) clang file.c -S -emit-llvm -o - (print out unoptimized llvm code) clang file.c -S -emit-llvm -o - -O3 clang file.c -S -O3 -o - # (output native machine code)
- 测试
make check-clang
Comments