Project-Setup: clarify compiler driver clang++

Fangrui Song 2019-09-19 01:17:36 -07:00
parent 33c868c021
commit d6d6d0b280

@ -182,10 +182,13 @@ You may run into parsing errors like `unknown type name 'class'`.
### Compiler driver
The compiler driver (the first line unless `%compile_commands.json` is used) can usually just be `clang`.
`clang++` is usually unnecessary, and incorrect if some files are C.
Just use `clang` as the compiler driver (the first line unless `%compile_commands.json` is used).
Note that `clang a.cc` and `clang++ a.cc` are different, but the difference is only related to linking (what default runtime libraries are passed) and is not relevant for the frontend actions ccls performs.
* `clang` defaults to GCCMode (gcc). It correctly treats `.c` files as C and `.cpp` files as C++.
* `clang++` defaults to GXXMode (g++). It treats a `.c` file as C++ and issues a warning.
`clang a.cc` and `clang++ a.cc` are different, but the difference is only related to linking (what default runtime libraries are passed) and is not relevant for the frontend actions ccls performs.
So for ccls use cases, just stick with `clang`.
## `.ccls` examples