[cfe-commits] r160265 - in /cfe/trunk: include/clang/Tooling/CommandLineClangTool.h lib/Tooling/CMakeLists.txt lib/Tooling/CommandLineClangTool.cpp test/CMakeLists.txt test/Tooling/clang-ast-dump.cpp tools/CMakeLists.txt tools/Makefile tools/clan

Jean-Daniel Dupas devlists at shadowlab.org
Tue Jul 17 15:47:46 PDT 2012


Le 17 juil. 2012 à 20:08, Manuel Klimek <klimek at google.com> a écrit :

> On Tue, Jul 17, 2012 at 7:55 PM, Douglas Gregor <dgregor at apple.com> wrote:
>> 
>> On Jul 16, 2012, at 11:56 PM, Manuel Klimek <klimek at google.com> wrote:
>> 
>>> On Tue, Jul 17, 2012 at 7:22 AM, Douglas Gregor <dgregor at apple.com> wrote:
>>>> 
>>>> On Jul 16, 2012, at 5:46 AM, Alexander Kornienko <alexfh at google.com> wrote:
>>>> 
>>>>> Author: alexfh
>>>>> Date: Mon Jul 16 07:46:48 2012
>>>>> New Revision: 160265
>>>>> 
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=160265&view=rev
>>>>> Log:
>>>>> The new clang-ast-dump tool for selective AST dumping. Moved common command-line tool stuff to CommandLineClangTool
>>>> 
>>>> I don't think this belongs in the Clang repository because:
>>>> 
>>>>       1) It's built on a *debugging* option, the XML dumper, which is neither actively maintained nor complete enough to build any tool upon
>>>>       2) It provides no value for users of Clang
>>>>       3) It provides very little value for developers of Clang tools, since it does little more than clang + grep
>>>>       4) It fails nearly all of the criteria for a Clang extension outlined in http://clang.llvm.org/get_involved.html
>>>> 
>>>> I'll be happy to hear opinions to the contrary (Manuel?), but barring some killer argument for this feature, I'd like it reverted.
>>> 
>>> I'll provide an argument for why I think this belongs in clang
>>> mainline, but it's also no sweat to pull it into the (hopefully soon
>>> available) tooling repo.
>> 
>> FWIW, I'd argue against putting this into the tooling repo as well, unless someone is actually going to turn the XML dumper into something that's complete enough, well-documented, well-structured, etc. and could actually form the basis of real tools. But it's currently just a small debugging aid.
>> 
>>> There are 2 killer features for this vs. clang -ast-dump-xml:
>>> - clang -ast-dump-xml + grep doesn't scale: outputting a whole AST in
>>> text often produces > 20GB of output and takes a long, long time -
>>> grepping just on the node names is really fast
>> 
>> Okay, that's fair; but this could trivially be added as a parameter to the existing XML dumper. We don't need a whole separate, single-purpose tool for this.
> 
> True. That still leaves the other points.
> 
>>> - clang -ast-dump-xml requires the user to first get a correct -cc1
>>> invocation, which is non-trivial for people who just write tools
>> 
>>        -fsyntax-only -Xclang -ast-dump-xml
>> 
>> should do the trick.
> 
> You still need to get the whole command line, don't you? The
> interesting part about a standalone tool is that you are just
> somewhere in the source tree and type:
> $ tool-name some_source.cpp <+ options>
> and get the output you need. Really easy to explore.
> 

FWIW, the same purpose can be achieve with a simple shell alias, or a simple script.

alias tool-name "clang -fsyntax-only -Xclang -ast-dump-xml"

-- Jean-Daniel








More information about the cfe-commits mailing list