[cfe-dev] clang tool rejects compilation arguments from compilation database (incorrectly?)

Smith, Kevin B kevin.b.smith at intel.com
Fri Oct 24 09:54:37 PDT 2014


Ø  I believe we have some flag that prints the full clang command line
during the compile, but I've forgotten what it is.

If anyone could provide that information that would be useful to provide some understanding of how the clang driver (in various modes) remaps from gcc (or other style) options into the
internal options that the compiler really wants.

Thank you,
Kevin Smith

From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Manuel Klimek
Sent: Friday, October 24, 2014 9:37 AM
To: Reid Kleckner; Péter Ésik
Cc: Clang Developers List
Subject: Re: [cfe-dev] clang tool rejects compilation arguments from compilation database (incorrectly?)

To get a compilation database from a project:
https://github.com/rizsotto/Bear
might help.

Cheers,
/Manuel


On Fri Oct 24 2014 at 9:11:54 AM Reid Kleckner <rnk at google.com<mailto:rnk at google.com>> wrote:
Clang has basically three command line flag parsing modes:
- the gcc-compatible clang driver, which is the standard command line interface
- the -cc1 command line interface, which is accessible via "clang -cc1
..." and is printed by -###
- the clang-cl command line interface, which is not relevant here

The tooling infrastructure expects your compilation database to
contain flags for the main gcc-style frontend, not the -cc1 subprocess
invocation. So -### won't help you here.

I believe we have some flag that prints the full clang command line
during the compile, but I've forgotten what it is.

On Fri, Oct 24, 2014 at 4:06 AM, Péter Ésik <peter.esik at gmail.com<mailto:peter.esik at gmail.com>> wrote:
> Hello
>
> I would like to introduce clang tooling to a fairly large code base with a
> custom build system. The first step i wanted to take is to manually create a
> compilation database file for one translation unit, and do some testing on
> that.
>
> First, i added -### to the compilation flags, so i could get the actual
> compiler invocation. I took the ouput, and put it into a
> compile_command.json file. At this point, everything should have worked just
> fine, but it did not. My clang tool for testing is really simple, all it
> does is, it tries to run a clang::SyntaxOnlyAction on the given inputs.
>
> If i try to run my tool on the TU that's in my compilation database, i get
> errors. Here's my compilation database: http://pastebin.com/6gsRHBEN and
> here is my output the tool gives me: http://pastebin.com/4AXfdF0r I also
> tried without the inner-quotes (http://pastebin.com/sWwyvbp8), the result's
> the same.
>
> What really bugs me is that if i open a terminal, switch to the 'directory',
> and copy-paste the content of the 'command' part (without JSON-escaping of
> course), clang compiles the file (and generates the object file) without any
> errors. Also, don't know if relevant, but the project is built using an
> older xcode toolchain (based on clang 3.2), and i built my tool based on
> clang 3.5. Why does my tool reject totally valid arguments, what do i do
> wrong?
>
> Thanks,
> Peter
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>

_______________________________________________
cfe-dev mailing list
cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141024/fc425f41/attachment.html>


More information about the cfe-dev mailing list