参考链接如下:

https://www.cnblogs.com/alog9/p/12097471.html

 1 [root@localhost yum.repos.d]# yum list |grep llvm
 2 devtoolset-7-llvm.x86_64                   7.0-5.el7              centos-sclo-rh
 3 holland-mysqllvm.noarch                    1.1.20-1.el7           epel
 4 llvm.x86_64                                3.4.2-9.el7            epel
 5 llvm-devel.x86_64                          3.4.2-9.el7            epel
 6 llvm-doc.noarch                            3.4.2-9.el7            epel
 7 llvm-libs.x86_64                           3.4.2-9.el7            epel
 8 llvm-ocaml.x86_64                          3.4.2-9.el7            epel
 9 llvm-ocaml-devel.x86_64                    3.4.2-9.el7            epel
10 llvm-ocaml-doc.noarch                      3.4.2-9.el7            epel
11 llvm-private.i686                          7.0.1-1.el7            base
12 llvm-private.x86_64                        7.0.1-1.el7            base
13 llvm-private-devel.i686                    7.0.1-1.el7            base
14 llvm-private-devel.x86_64                  7.0.1-1.el7            base
15 llvm-static.x86_64                         3.4.2-9.el7            epel
16 llvm-toolset-7.x86_64                      5.0.1-4.el7            centos-sclo-rh
17 llvm-toolset-7-build.x86_64                5.0.1-4.el7            centos-sclo-rh
18 llvm-toolset-7-clang.x86_64                5.0.1-4.el7            centos-sclo-rh
19 llvm-toolset-7-clang-analyzer.noarch       5.0.1-4.el7            centos-sclo-rh
20 llvm-toolset-7-clang-devel.x86_64          5.0.1-4.el7            centos-sclo-rh
21 llvm-toolset-7-clang-libs.x86_64           5.0.1-4.el7            centos-sclo-rh
22 llvm-toolset-7-clang-tools-extra.x86_64    5.0.1-4.el7            centos-sclo-rh
23 llvm-toolset-7-cmake.x86_64                3.6.2-9.el7            centos-sclo-rh
24 llvm-toolset-7-cmake-data.noarch           3.6.2-9.el7            centos-sclo-rh
25 llvm-toolset-7-cmake-doc.noarch            3.6.2-9.el7            centos-sclo-rh
26 llvm-toolset-7-compiler-rt.x86_64          5.0.1-2.el7            centos-sclo-rh
27 llvm-toolset-7-dockerfiles.x86_64          4.0.1-2.el7            centos-sclo-rh
28 llvm-toolset-7-git-clang-format.x86_64     5.0.1-4.el7            centos-sclo-rh
29 llvm-toolset-7-libomp.x86_64               5.0.1-2.el7            centos-sclo-rh
30 llvm-toolset-7-libomp-devel.x86_64         5.0.1-2.el7            centos-sclo-rh
31 llvm-toolset-7-lldb.x86_64                 5.0.1-4.el7            centos-sclo-rh
32 llvm-toolset-7-lldb-devel.x86_64           5.0.1-4.el7            centos-sclo-rh
33 llvm-toolset-7-llvm.x86_64                 5.0.1-8.el7            centos-sclo-rh
34 llvm-toolset-7-llvm-devel.x86_64           5.0.1-8.el7            centos-sclo-rh
35 llvm-toolset-7-llvm-doc.noarch             5.0.1-8.el7            centos-sclo-rh
36 llvm-toolset-7-llvm-libs.x86_64            5.0.1-8.el7            centos-sclo-rh
37 llvm-toolset-7-llvm-static.x86_64          5.0.1-8.el7            centos-sclo-rh
38 llvm-toolset-7-python-lldb.x86_64          5.0.1-4.el7            centos-sclo-rh
39 llvm-toolset-7-python2-lit.noarch          0.5.1-1.el7            centos-sclo-rh
40 llvm-toolset-7-runtime.x86_64              5.0.1-4.el7            centos-sclo-rh
41 llvm-toolset-7.0.x86_64                    7.0.1-2.el7            centos-sclo-rh
42 llvm-toolset-7.0-build.x86_64              7.0.1-2.el7            centos-sclo-rh
43 llvm-toolset-7.0-clang.x86_64              7.0.1-1.el7            centos-sclo-rh
44 llvm-toolset-7.0-clang-analyzer.noarch     7.0.1-1.el7            centos-sclo-rh
45 llvm-toolset-7.0-clang-devel.x86_64        7.0.1-1.el7            centos-sclo-rh
46 llvm-toolset-7.0-clang-libs.x86_64         7.0.1-1.el7            centos-sclo-rh
47 llvm-toolset-7.0-clang-tools-extra.x86_64  7.0.1-1.el7            centos-sclo-rh
48 llvm-toolset-7.0-cmake.x86_64              3.6.2-11.el7           centos-sclo-rh
49 llvm-toolset-7.0-cmake-data.noarch         3.6.2-11.el7           centos-sclo-rh
50 llvm-toolset-7.0-cmake-doc.noarch          3.6.2-11.el7           centos-sclo-rh
51 llvm-toolset-7.0-compiler-rt.x86_64        7.0.1-3.el7            centos-sclo-rh
52 llvm-toolset-7.0-git-clang-format.x86_64   7.0.1-1.el7            centos-sclo-rh
53 llvm-toolset-7.0-libomp.x86_64             7.0.1-2.el7            centos-sclo-rh
54 llvm-toolset-7.0-libomp-devel.x86_64       7.0.1-2.el7            centos-sclo-rh
55 llvm-toolset-7.0-libomp-test.x86_64        7.0.1-2.el7            centos-sclo-rh
56 llvm-toolset-7.0-lld.x86_64                7.0.1-2.el7            centos-sclo-rh
57 llvm-toolset-7.0-lld-devel.x86_64          7.0.1-2.el7            centos-sclo-rh
58 llvm-toolset-7.0-lld-libs.x86_64           7.0.1-2.el7            centos-sclo-rh
59 llvm-toolset-7.0-lldb.x86_64               7.0.1-1.el7            centos-sclo-rh
60 llvm-toolset-7.0-lldb-devel.x86_64         7.0.1-1.el7            centos-sclo-rh
61 llvm-toolset-7.0-llvm.x86_64               7.0.1-4.el7            centos-sclo-rh
62 llvm-toolset-7.0-llvm-devel.x86_64         7.0.1-4.el7            centos-sclo-rh
63 llvm-toolset-7.0-llvm-doc.noarch           7.0.1-4.el7            centos-sclo-rh
64 llvm-toolset-7.0-llvm-googletest.x86_64    7.0.1-4.el7            centos-sclo-rh
65 llvm-toolset-7.0-llvm-libs.x86_64          7.0.1-4.el7            centos-sclo-rh
66 llvm-toolset-7.0-llvm-static.x86_64        7.0.1-4.el7            centos-sclo-rh
67 llvm-toolset-7.0-python-lldb.x86_64        7.0.1-1.el7            centos-sclo-rh
68 llvm-toolset-7.0-python2-lit.noarch        0.7.1-1.el7            centos-sclo-rh
69 llvm-toolset-7.0-runtime.x86_64            7.0.1-2.el7            centos-sclo-rh
70 llvm3.9.x86_64                             3.9.1-7.el7            epel
71 llvm3.9-devel.x86_64                       3.9.1-7.el7            epel
72 llvm3.9-libs.x86_64                        3.9.1-7.el7            epel
73 llvm3.9-static.x86_64                      3.9.1-7.el7            epel
74 llvm5.0.x86_64                             5.0.1-7.el7            epel
75 llvm5.0-devel.x86_64                       5.0.1-7.el7            epel
76 llvm5.0-doc.noarch                         5.0.1-7.el7            epel
77 llvm5.0-libs.x86_64                        5.0.1-7.el7            epel
78 llvm5.0-static.x86_64                      5.0.1-7.el7            epel
79 llvm7.0.x86_64                             7.0.1-4.el7            epel
80 llvm7.0-devel.x86_64                       7.0.1-4.el7            epel
81 llvm7.0-doc.noarch                         7.0.1-4.el7            epel
82 llvm7.0-libs.x86_64                        7.0.1-4.el7            epel
83 llvm7.0-static.x86_64                      7.0.1-4.el7            epel
84 mesa-private-llvm.i686                     3.9.1-3.el7            base
85 mesa-private-llvm.x86_64                   3.9.1-3.el7            base
86 mesa-private-llvm-devel.i686               3.9.1-3.el7            base
87 mesa-private-llvm-devel.x86_64             3.9.1-3.el7            base
88 rh-eclipse46-eclipse-cdt-llvm.x86_64       1:9.2.1-2.1.el7        centos-sclo-rh
89 [root@localhost yum.repos.d]# 

安装如下两个包就可以使用clang编译器了。 

1    yum install llvm-toolset-7.0-clang.x86_64  llvm-toolset-7.0-llvm-libs.x86_64
2    ldconfig
12-14 23:27