[docs] Clarify compile_flags.txt subtleties
authorSam McCall <sam.mccall@gmail.com>
Sun, 31 Jan 2021 10:16:52 +0000 (11:16 +0100)
committerSam McCall <sam.mccall@gmail.com>
Sun, 31 Jan 2021 10:16:59 +0000 (11:16 +0100)
See confusion e.g. in https://github.com/clangd/clangd/issues/637

clang/docs/JSONCompilationDatabase.rst

index b576640..bd91db2 100644 (file)
@@ -94,6 +94,18 @@ to parse C++ code in the source tree.
 
 Alternatives
 ============
-For simple projects, Clang tools also recognize a compile_flags.txt file.
-This should contain one flag per line. The same flags will be used to compile
-any file.
+For simple projects, Clang tools also recognize a ``compile_flags.txt`` file.
+This should contain one argument per line. The same flags will be used to
+compile any file.
+
+Example:
+
+::
+
+    -xc++
+    -I
+    libwidget/include/
+
+Here ``-I libwidget/include`` is two arguments, and so becomes two lines.
+Paths are relative to the directory containing ``compile_flags.txt``.
+