Manuel,

One option would be to let my previous ArgumentsAdjuster patch through.  If you 
look at my modularize patch, you'll see that it's not a pretty solution having 
to know all the clang options that take arguments, as I have to know which 
options take arguments in order not to mistake an option argument for a file 
name.  I can't use the file name extension because the input could be a C++ 
header with no extension.  It seems this might be useful to others as well.

Or, you could just approve my modularize patch.

-John

From: Manuel Klimek [mailto:[email protected]]
Sent: Wednesday, August 21, 2013 6:16 AM
To: Kim Gräsman
Cc: Thompson, John; Sean Silva; [email protected]
Subject: Re: [PATCH] Header dependencies support for modularize

On Wed, Aug 21, 2013 at 3:06 PM, Kim Gräsman 
<[email protected]<mailto:[email protected]>> wrote:
John,

On Wed, Aug 21, 2013 at 2:48 PM, Thompson, John
<[email protected]<mailto:[email protected]>> 
wrote:
>
> This would seem to have a prerequisite that ClangTooling have a OptTable
> somewhere, but there doesn't seem to be a connection.
>
> Now let's suppose I get past that hurdle, either by creating one myself and
> somehow coercing it to parse the arguments given to ArgumentsAdjuster, how
> do I use libOption to walk the arguments and figure out which command-line
> argument is the source file?
>
> Ideally, tooling should have a mechanism to tell me what the source file or
> files are for each command line in the compilation database.  I had a much
> simpler version, but it required I modify ArgumentsAdjuster to be given the
> source file, which the caller had handy, but I couldn't get that change
> through.
>
> Could someone associated with tooling lend a hand and tell me how to get the
> input file from the command lines in the compilation database?
I can't help, but I'm struggling with the same thing right now.

Our tool is originally designed to act as a replacement for clang in
Make build systems, so it accepts the same command-line (plus some
additional, escaped options)

I've wanted to add compilation database support, but the way tooling
is wired it seems I need to extract compilation db and source paths
from the command-line and pass them to ClangTool::ClangTool. The
compilation db is (sort of) handled by FixedCompilationDatabase, but
it seems the source paths are assumed to be tool arguments, not Clang
arguments.

Use a clang plugin if you want to run as part of a build. The code that has 
your main logic is basically the same, and you can use ASTMatchers and other 
stuff from tooling in your clang plugin just fine.

See: http://clang.llvm.org/docs/Tooling.html

Cheers,
/Manuel

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to