<div class="gmail_quote">alexfh requested code review of "Updated -help message in clang-check.".<br>
<br>
Reviewers: klimek, chandlerc, djasper<br>
<br>
Provide more information on usage in -help<br>
<br>
TEST PLAN<br>
  ran once<br>
<br>
REVISION DETAIL<br>
  <a href="http://llvm-reviews.chandlerc.com/D5" target="_blank">http://llvm-reviews.chandlerc.com/D5</a><br>
<br>
AFFECTED FILES<br>
  clang-check/ClangCheck.cpp<br>
<br>
CHANGE DETAILS<br>
Index: clang-check/ClangCheck.cpp<br>
===================================================================<br>
--- clang-check/ClangCheck.cpp<br>
+++ clang-check/ClangCheck.cpp<br>
@@ -10,27 +10,6 @@<br>
 //  This file implements a clang-check tool that runs the<br>
 //  clang::SyntaxOnlyAction over a number of translation units.<br>
 //<br>
-//  Usage:<br>
-//  clang-check <cmake-output-dir> <file1> <file2> ...<br>
-//<br>
-//  Where <cmake-output-dir> is a CMake build directory in which a file named<br>
-//  compile_commands.json exists (enable -DCMAKE_EXPORT_COMPILE_COMMANDS in<br>
-//  CMake to get this output).<br>
-//<br>
-//  <file1> ... specify the paths of files in the CMake source tree. This  path<br>
-//  is looked up in the compile command database. If the path of a file is<br>
-//  absolute, it needs to point into CMake's source tree. If the path is<br>
-//  relative, the current working directory needs to be in the CMake source<br>
-//  tree and the file must be in a subdirectory of the current working<br>
-//  directory. "./" prefixes in the relative files will be automatically<br>
-//  removed, but the rest of a relative path must be a suffix of a path in<br>
-//  the compile command line database.<br>
-//<br>
-//  For example, to use clang-check on all files in a subtree of the source<br>
-//  tree, use:<br>
-//<br>
-//    /path/in/subtree $ find . -name '*.cpp'| xargs clang-check /path/to/source<br>
-//<br>
 //===----------------------------------------------------------------------===//<br>
<br>
 #include "llvm/Support/CommandLine.h"<br>
@@ -43,14 +22,42 @@<br>
<br>
 cl::opt<std::string> BuildPath(<br>
   "p",<br>
-  cl::desc("<build-path>"),<br>
+  cl::desc("<cmake-output-dir>"),<br>
   cl::Optional);<br>
<br>
 cl::list<std::string> SourcePaths(<br>
   cl::Positional,<br>
   cl::desc("<source0> [... <sourceN>]"),<br>
   cl::OneOrMore);<br>
<br>
+static cl::extrahelp MoreHelp(<br>
+    "\n"<br>
+    "<cmake-output-dir> is a CMake build directory in which a file named\n"<br>
+    "compile_commands.json exists (enable -DCMAKE_EXPORT_COMPILE_COMMANDS in\n"<br>
+    "CMake to get this output). When a CMake output directory is not\n"<br>
+    "specified, clang-check will attempt to locate compile_commands.json\n"<br>
+    "automatically in all parent paths of the first input file.\n"<br>
+    "\n"<br>
+    "<source0> ... specify the paths of files in the CMake source tree. This\n"<br>
+    "path is looked up in the compile command database. If the path of a file\n"<br>
+    "is absolute, it needs to point into CMake's source tree. If the path is\n"<br>
+    "relative, the current working directory needs to be in the CMake source\n"<br>
+    "tree and the file must be in a subdirectory of the current working\n"<br>
+    "directory. \"./\" prefixes in the relative files will be automatically\n"<br>
+    "removed, but the rest of a relative path must be a suffix of a path in\n"<br>
+    "the compile command line database.\n"<br>
+    "\n"<br>
+    "For example, to use clang-check on all files in a subtree of the source\n"<br>
+    "tree, use:\n"<br>
+    "\n"<br>
+    "  find path/in/subtree -name '*.cpp'|xargs clang-check -p path/to/source\n"<br>
+    "\n"<br>
+    "or using auto-location of compile_commands.json:\n"<br>
+    "\n"<br>
+    "  find path/in/subtree -name '*.cpp'|xargs clang-check\n"<br>
+    "\n"<br>
+);<br>
+<br>
 int main(int argc, const char **argv) {<br>
   llvm::OwningPtr<CompilationDatabase> Compilations(<br>
     FixedCompilationDatabase::loadFromCommandLine(argc, argv));<br>
<br>
REPLY HANDLER ACTIONS<br>
  Reply to comment, or !reject, !abandon, !reclaim, !resign, !rethink, !unsubscribe, !accept.<br>
<br>
MANAGE HERALD DIFFERENTIAL RULES<br>
  <a href="http://llvm-reviews.chandlerc.com/herald/view/differential/" target="_blank">http://llvm-reviews.chandlerc.com/herald/view/differential/</a><br>
<br>
WHY DID I GET THIS EMAIL?<br>
  <a href="http://llvm-reviews.chandlerc.com/herald/transcript/14/" target="_blank">http://llvm-reviews.chandlerc.com/herald/transcript/14/</a><br>
<br>
To: klimek, chandlerc, djasper, alexfh<br>
</div><br><br clear="all"><div><br></div>-- <br><div><div><font color="#666666"><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(213,15,37);border-right-color:rgb(213,15,37);border-bottom-color:rgb(213,15,37);border-left-color:rgb(213,15,37);padding-top:2px;margin-top:2px">Alexander Kornienko |</span><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(51,105,232);border-right-color:rgb(51,105,232);border-bottom-color:rgb(51,105,232);border-left-color:rgb(51,105,232);padding-top:2px;margin-top:2px"> Software Engineer |</span></font><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(0,153,57);border-right-color:rgb(0,153,57);border-bottom-color:rgb(0,153,57);border-left-color:rgb(0,153,57);padding-top:2px;margin-top:2px"><font color="#666666"> </font><a href="mailto:alexfh@google.com" style="color:rgb(17,85,204)" target="_blank">alexfh@google.com</a> |</span><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(238,178,17);border-right-color:rgb(238,178,17);border-bottom-color:rgb(238,178,17);border-left-color:rgb(238,178,17);padding-top:2px;margin-top:2px"> <a value="+35315435283" style="color:rgb(17,85,204)">+49 151 221 77 957</a></span></div>
</div><div><font color="#666666"><span style="background-color:rgb(255,255,255);font-family:Arial,Verdana,sans-serif">Google Germany GmbH | </span><span style="background-color:rgb(255,255,255);font-family:Arial,Verdana,sans-serif">Dienerstr. 12 | </span><span style="background-color:rgb(255,255,255);font-family:Arial,Verdana,sans-serif">80331 München</span></font></div>
<br>