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

Alexander Kornienko alexfh at google.com
Wed Jul 11 11:10:07 PDT 2012


alexfh requested code review of "Updated -help message in clang-check.".

Reviewers: klimek, chandlerc, djasper

Provide more information on usage in -help

TEST PLAN
  ran once

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

AFFECTED FILES
  clang-check/ClangCheck.cpp

CHANGE DETAILS
Index: clang-check/ClangCheck.cpp
===================================================================
--- clang-check/ClangCheck.cpp
+++ clang-check/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"
@@ -43,14 +22,42 @@

 cl::opt<std::string> BuildPath(
   "p",
-  cl::desc("<build-path>"),
+  cl::desc("<cmake-output-dir>"),
   cl::Optional);

 cl::list<std::string> SourcePaths(
   cl::Positional,
   cl::desc("<source0> [... <sourceN>]"),
   cl::OneOrMore);

+static cl::extrahelp MoreHelp(
+    "\n"
+    "<cmake-output-dir> is a CMake build directory in which a file named\n"
+    "compile_commands.json exists (enable -DCMAKE_EXPORT_COMPILE_COMMANDS
in\n"
+    "CMake to get this output). When a CMake output directory is not\n"
+    "specified, clang-check will attempt to locate compile_commands.json\n"
+    "automatically in all parent paths of the first input file.\n"
+    "\n"
+    "<source0> ... specify the paths of files in the CMake source tree.
This\n"
+    "path is looked up in the compile command database. If the path of a
file\n"
+    "is absolute, it needs to point into CMake's source tree. If the path
is\n"
+    "relative, the current working directory needs to be in the CMake
source\n"
+    "tree and the file must be in a subdirectory of the current working\n"
+    "directory. \"./\" prefixes in the relative files will be
automatically\n"
+    "removed, but the rest of a relative path must be a suffix of a path
in\n"
+    "the compile command line 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 -p
path/to/source\n"
+    "\n"
+    "or using auto-location of compile_commands.json:\n"
+    "\n"
+    "  find path/in/subtree -name '*.cpp'|xargs clang-check\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.

MANAGE HERALD DIFFERENTIAL RULES
  http://llvm-reviews.chandlerc.com/herald/view/differential/

WHY DID I GET THIS EMAIL?
  http://llvm-reviews.chandlerc.com/herald/transcript/14/

To: klimek, chandlerc, djasper, alexfh



-- 
Alexander Kornienko | Software Engineer | alexfh at google.com | +49 151 221
77 957
Google Germany GmbH | Dienerstr. 12 | 80331 M√ľnchen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120711/a57b0ce5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5.1.patch
Type: text/x-patch
Size: 3274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120711/a57b0ce5/attachment.bin>


More information about the cfe-commits mailing list