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

> John,
>
> On Wed, Aug 21, 2013 at 2:48 PM, Thompson, John
> <[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