Rename clang_args to .cquery

This commit is contained in:
Fangrui Song 2017-11-26 22:56:23 -08:00 committed by Jacob Dufault
parent 7923b5d219
commit 87f6452b5d
4 changed files with 9 additions and 15 deletions

View File

@ -65,30 +65,24 @@ If you run into issues, you can view debug output by running the
## Project setup ## Project setup
### compile_commands.json (Best) ### `compile_commands.json` (Best)
To get the most accurate index possible, you can give cquery a compilation See [wiki](https://github.com/jacobdufault/cquery/wiki) for how to generate `compile_commands.json` with CMake, Build EAR, Ninja, ...
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
```
If the `compile_commands.json` is not in the top-level workspace directory, If the `compile_commands.json` is not in the top-level workspace directory,
then the `cquery.misc.compilationDatabaseDirectory` setting can be used to then the `cquery.misc.compilationDatabaseDirectory` setting can be used to
specify its location. specify its location.
### cquery.index.extraClangArguments ### `cquery.index.extraClangArguments`
If for whatever reason you cannot generate a `compile_commands.json` file, you If for whatever reason you cannot generate a `compile_commands.json` file, you
can add the flags to the `cquery.index.extraClangArguments` configuration can add the flags to the `cquery.index.extraClangArguments` configuration
option. option.
### clang_args ### `.cquery`
If for whatever reason you cannot generate a `compile_commands.json` file, you 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. workspace directory.
Each argument in that file is separated by a newline. Lines starting with `#` 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 # 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 # Chromium tips

View File

@ -3250,7 +3250,7 @@ int main(int argc, char** argv) {
When opening up a directory, cquery will look for a compile_commands.json 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 file emitted by your preferred build system. If not present, cquery will
use a recursive directory listing instead. Command line flags can be 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. line in that file is a separate argument.
There are also a number of configuration options available when There are also a number of configuration options available when

View File

@ -203,7 +203,7 @@ std::vector<Project::Entry> LoadFromDirectoryListing(ProjectConfig* config) {
std::vector<std::string> args; std::vector<std::string> args;
std::cerr << "Using arguments: "; std::cerr << "Using arguments: ";
for (const std::string& line : for (const std::string& line :
ReadLines(config->project_dir + "/clang_args")) { ReadLines(config->project_dir + "/.cquery")) {
if (line.empty() || StartsWith(line, "#")) if (line.empty() || StartsWith(line, "#"))
continue; continue;
if (!args.empty()) if (!args.empty())

View File

@ -36,7 +36,7 @@ struct Project {
// |root_directory| contains a compile_commands.json file, that one will be used // |root_directory| contains a compile_commands.json file, that one will be used
// instead. Otherwise, a recursive directory listing of all *.cpp, *.cc, *.h, // instead. Otherwise, a recursive directory listing of all *.cpp, *.cc, *.h,
// and *.hpp files will be used. clang arguments can be specified in a // 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<std::string>& extra_flags, void Load(const std::vector<std::string>& extra_flags,
const std::string& opt_compilation_db_dir, const std::string& opt_compilation_db_dir,
const std::string& root_directory, const std::string& root_directory,