[docs] Updating documentation for compdb Update gn gen docs to include the --export-compile-commands flag Change-Id: Id3afbc6270ef593fb12ecbb22ca78dd516dc5150 Reviewed-on: https://gn-review.googlesource.com/2500 Commit-Queue: Brett Wilson <brettw@chromium.org> Reviewed-by: Brett Wilson <brettw@chromium.org>
diff --git a/docs/reference.md b/docs/reference.md index 0998620..98a3fdd 100644 --- a/docs/reference.md +++ b/docs/reference.md
@@ -745,6 +745,17 @@ --json-ide-script-args=<argument> Optional second argument that will passed to executed script. ``` + +#### **Compilation Database** + +``` + --export-compile-commands + Produces a compile_commands.json file in the root of the build directory + containing an array of “command objects”, where each command object + specifies one way a translation unit is compiled in the project. This is + used for various Clang-based tooling, allowing for the replay of individual + compilations independent of the build system. +``` ### <a name="help"></a>**gn help <anything>** ```
diff --git a/tools/gn/command_gen.cc b/tools/gn/command_gen.cc index d959fe4..82046d2 100644 --- a/tools/gn/command_gen.cc +++ b/tools/gn/command_gen.cc
@@ -412,6 +412,15 @@ --json-ide-script-args=<argument> Optional second argument that will passed to executed script. + +Compilation Database + + --export-compile-commands + Produces a compile_commands.json file in the root of the build directory + containing an array of “command objects”, where each command object + specifies one way a translation unit is compiled in the project. This is + used for various Clang-based tooling, allowing for the replay of individual + compilations independent of the build system. )"; int RunGen(const std::vector<std::string>& args) {