[cfe-commits] [PATCH] D5: Updated -help message in clang-check.

alexfh (Alexander Kornienko) reviews at llvm-reviews.chandlerc.com
Thu Jul 12 07:11:59 PDT 2012


alexfh updated the revision "Updated -help message in clang-check.".

  Minor wording change

Reviewers: klimek, chandlerc, djasper

REVISION DETAIL
  http://llvm-reviews.chandlerc.com/D5

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D5?vs=22&id=23#differential-review-toc

AFFECTED FILES
  ClangCheck.cpp

CHANGE DETAILS
Index: ClangCheck.cpp
===================================================================
--- ClangCheck.cpp
+++ ClangCheck.cpp
@@ -10,27 +10,6 @@
 //  This file implements a clang-check tool that runs the
 //  clang::SyntaxOnlyAction over a number of translation units.
 //
-//  Usage:
-//  clang-check <cmake-output-dir> <file1> <file2> ...
-//
-//  Where <cmake-output-dir> is a CMake build directory in which a file named
-//  compile_commands.json exists (enable -DCMAKE_EXPORT_COMPILE_COMMANDS in
-//  CMake to get this output).
-//
-//  <file1> ... specify the paths of files in the CMake source tree. This  path
-//  is looked up in the compile command database. If the path of a file is
-//  absolute, it needs to point into CMake's source tree. If the path is
-//  relative, the current working directory needs to be in the CMake source
-//  tree and the file must be in a subdirectory of the current working
-//  directory. "./" prefixes in the relative files will be automatically
-//  removed, but the rest of a relative path must be a suffix of a path in
-//  the compile command line database.
-//
-//  For example, to use clang-check on all files in a subtree of the source
-//  tree, use:
-//
-//    /path/in/subtree $ find . -name '*.cpp'| xargs clang-check /path/to/source
-//
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/CommandLine.h"
@@ -51,6 +30,39 @@
   cl::desc("<source0> [... <sourceN>]"),
   cl::OneOrMore);
 
+static cl::extrahelp MoreHelp(
+    "\n"
+    "<build-path> is used to read a compile command database.\n"
+    "\n"
+    "For example, it can be a CMake build directory in which a file named\n"
+    "compile_commands.json exists (use -DCMAKE_EXPORT_COMPILE_COMMANDS=ON\n"
+    "CMake option to get this output). When no build path is specified,\n"
+    "clang-check will attempt to locate it automatically using all parent\n"
+    "paths of the first input file.\n"
+    "\n"
+    "<source0> ... specify the paths of source files. These paths are looked\n"
+    "up in the compile command database. If the path of a file is absolute,\n"
+    "it needs to point into CMake's source tree. If the path is relative,\n"
+    "the current working directory needs to be in the CMake source tree and\n"
+    "the file must be in a subdirectory of the current working directory.\n"
+    "\"./\" prefixes in the relative files will be automatically removed,\n"
+    "but the rest of a relative path must be a suffix of a path in the\n"
+    "compile command database.\n"
+    "\n"
+    "For example, to use clang-check on all files in a subtree of the source\n"
+    "tree, use:\n"
+    "\n"
+    "  find path/in/subtree -name '*.cpp'|xargs clang-check\n"
+    "\n"
+    "or using a specific build path:\n"
+    "\n"
+    "  find path/in/subtree -name '*.cpp'|xargs clang-check -p build/path\n"
+    "\n"
+    "Note, that path/in/subtree and current directory should follow the\n"
+    "rules described above.\n"
+    "\n"
+);
+
 int main(int argc, const char **argv) {
   llvm::OwningPtr<CompilationDatabase> Compilations(
     FixedCompilationDatabase::loadFromCommandLine(argc, argv));

REPLY HANDLER ACTIONS
  Reply to comment, or !reject, !abandon, !reclaim, !resign, !rethink, !unsubscribe, !accept.

To: klimek, chandlerc, djasper, alexfh
Cc: cfe-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5.3.patch
Type: text/x-patch
Size: 3182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120712/ab5fe42d/attachment.bin>


More information about the cfe-commits mailing list