From 87f6452b5d189121067865517305ad81937b07b0 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 26 Nov 2017 22:56:23 -0800 Subject: [PATCH] Rename clang_args to .cquery --- README.md | 18 ++++++------------ src/command_line.cc | 2 +- src/project.cc | 2 +- src/project.h | 2 +- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ca95ceab..8bccf188 100644 --- a/README.md +++ b/README.md @@ -65,30 +65,24 @@ If you run into issues, you can view debug output by running the ## Project setup -### compile_commands.json (Best) +### `compile_commands.json` (Best) -To get the most accurate index possible, you can give cquery a compilation -database emitted from your build system of choice. For example, here's how to -generate one in ninja. When you sync your code you should regenerate this file. - -```bash -$ ninja -C out/Release -t compdb cxx cc > compile_commands.json -``` +See [wiki](https://github.com/jacobdufault/cquery/wiki) for how to generate `compile_commands.json` with CMake, Build EAR, Ninja, ... If the `compile_commands.json` is not in the top-level workspace directory, then the `cquery.misc.compilationDatabaseDirectory` setting can be used to specify its location. -### cquery.index.extraClangArguments +### `cquery.index.extraClangArguments` If for whatever reason you cannot generate a `compile_commands.json` file, you can add the flags to the `cquery.index.extraClangArguments` configuration option. -### clang_args +### `.cquery` If for whatever reason you cannot generate a `compile_commands.json` file, you -can add the flags to a file called `clang_args` located in the top-level +can add the flags to a file called `.cquery` located in the top-level workspace directory. Each argument in that file is separated by a newline. Lines starting with `#` @@ -128,7 +122,7 @@ exclude v8, webkit, and third_party, it goes down to about 6.5gb. # Wiki -There are some additional tips on the [wiki](https://github.com/jacobdufault/cquery/wiki). +For Emacs/Vim/other editors integration and some additional tips, see [wiki](https://github.com/jacobdufault/cquery/wiki). # Chromium tips diff --git a/src/command_line.cc b/src/command_line.cc index bd9e4129..d2177718 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -3250,7 +3250,7 @@ int main(int argc, char** argv) { When opening up a directory, cquery will look for a compile_commands.json file emitted by your preferred build system. If not present, cquery will use a recursive directory listing instead. Command line flags can be - provided by adding a "clang_args" file in the top-level directory. Each + provided by adding a file named `.cquery` in the top-level directory. Each line in that file is a separate argument. There are also a number of configuration options available when diff --git a/src/project.cc b/src/project.cc index 1c52ff93..7d553072 100644 --- a/src/project.cc +++ b/src/project.cc @@ -203,7 +203,7 @@ std::vector LoadFromDirectoryListing(ProjectConfig* config) { std::vector args; std::cerr << "Using arguments: "; for (const std::string& line : - ReadLines(config->project_dir + "/clang_args")) { + ReadLines(config->project_dir + "/.cquery")) { if (line.empty() || StartsWith(line, "#")) continue; if (!args.empty()) diff --git a/src/project.h b/src/project.h index 00bbb892..039f184b 100644 --- a/src/project.h +++ b/src/project.h @@ -36,7 +36,7 @@ struct Project { // |root_directory| contains a compile_commands.json file, that one will be used // instead. Otherwise, a recursive directory listing of all *.cpp, *.cc, *.h, // and *.hpp files will be used. clang arguments can be specified in a - // clang_args file located inside of |root_directory|. + // .cquery file located inside of |root_directory|. void Load(const std::vector& extra_flags, const std::string& opt_compilation_db_dir, const std::string& root_directory,