[cfe-commits] r160132 - /cfe/trunk/tools/clang-check/ClangCheck.cpp

David Blaikie dblaikie at gmail.com
Thu Jul 12 10:35:20 PDT 2012


On Thu, Jul 12, 2012 at 7:34 AM, Alexander Kornienko <alexfh at google.com> wrote:
> Author: alexfh
> Date: Thu Jul 12 09:34:23 2012
> New Revision: 160132
>
> URL: http://llvm.org/viewvc/llvm-project?rev=160132&view=rev
> Log:
> Updated -help message in clang-check.
>
> Summary: Provide more information on usage in -help

The summary seems a bit redundant with the initial piece of the log
(perhaps the CR system could just use the first sentence from the
commit log for the subject of the code review - which would avoid
people having to rewrite a "summary" and then this bit could be
dropped from the commit message as well)

> Test Plan: ran once

Moderately interesting, but I hope this is optional & only specified
when there's something interesting (something beyond "I added a
regression test for this bug/feature and all regression tests pass" -
like "I did this perf analysis" or "I ran the nightly suite"). The
basic "hey, you checked in something without a test case" is something
we seem to be sufficiently good at - not sure adding a field like that
to every commit message would necessarily change people's habits or
help much in that regard. (perhaps I'm wrong, though - maybe it'd at
least make people think enough about it to document why a test case
wasn't included so we don't have to ask)

> Reviewers: klimek, chandlerc, djasper
> Reviewed By: klimek

Could we just include one of these? (probably the latter, assuming the
former is just who the code was "assigned to" - if it's not that
("Reviewers" are who's commented and "Reviewed By" is who signed off)
perhaps we could rename them to be a bit more specific - still not
sure we need both, but open to suggestions/ideas there)

> CC: cfe-commits

Could we drop this entirely?

>
> Differential Revision: http://llvm-reviews.chandlerc.com/D5
>
> Modified:
>     cfe/trunk/tools/clang-check/ClangCheck.cpp
>
> Modified: cfe/trunk/tools/clang-check/ClangCheck.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-check/ClangCheck.cpp?rev=160132&r1=160131&r2=160132&view=diff
> ==============================================================================
> --- cfe/trunk/tools/clang-check/ClangCheck.cpp (original)
> +++ cfe/trunk/tools/clang-check/ClangCheck.cpp Thu Jul 12 09:34:23 2012
> @@ -10,28 +10,6 @@
>  //  This file implements a clang-check tool that runs the
>  //  clang::SyntaxOnlyAction over a number of translation units.
>  //
> -//  Usage:
> -//  clang-check [-p <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). If not provided, clang-check will search for this
> -//  file in all of <file1>'s parent directories.
> -//
> -//  <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
> -//
>  //===----------------------------------------------------------------------===//
>
>  #include "llvm/Support/CommandLine.h"
> @@ -52,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));
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list