From d6d6d0b280b7c67134529c3ab661617aed260aec Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 19 Sep 2019 01:17:36 -0700 Subject: [PATCH] Project-Setup: clarify compiler driver clang++ --- Project-Setup.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Project-Setup.md b/Project-Setup.md index ec8b69f..2756380 100644 --- a/Project-Setup.md +++ b/Project-Setup.md @@ -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