[cfe-dev] LibTooling in the absence of a compilation database
Russell Wallace via cfe-dev
cfe-dev at lists.llvm.org
Wed Dec 2 08:07:11 PST 2015
Okay, I'm looking through the code to see if I can put together a patch. In
this project, is it considered preferable to minimize the number of lines
changed in the patch, or minimize the size of the code after the patch?
On Wed, Dec 2, 2015 at 9:55 AM, Manuel Klimek <klimek at google.com> wrote:
> On Wed, Dec 2, 2015 at 10:47 AM Russell Wallace <russell.wallace at gmail.com>
> wrote:
>
>> Then, if the database is not found, the tool can print a note like
>> 'compilation database not found, using default options'.
>>
>
> Ok, with that diagnostic I'd approve a change to that end.
>
>
>>
>> On Wed, Dec 2, 2015 at 9:45 AM, Manuel Klimek <klimek at google.com> wrote:
>>
>>> On Wed, Dec 2, 2015 at 10:43 AM Russell Wallace <
>>> russell.wallace at gmail.com> wrote:
>>>
>>>> There are none that are guaranteed to work in all cases; nonetheless,
>>>> if Clang, GCC or Microsoft C++ is presented with a 'hello world' test
>>>> program with no other options, it will successfully compile it with its
>>>> built-in defaults, so the defaults for a tool should be those that Clang
>>>> would use in the same circumstances. (I do have some ideas for automated
>>>> search for the correct options if the defaults fail, but in the meantime
>>>> 'do what the actual compiler would do' would be a good baseline.)
>>>>
>>>
>>> The problem is that if this happens, it's hard to tell the user what
>>> they need to do to get the tool to work (set up a compilation database).
>>> How about we add to the error if there is not compilation database how
>>> to run it in default mode (by adding -- at the end)?
>>>
>>>
>>>>
>>>> On Wed, Dec 2, 2015 at 9:39 AM, Manuel Klimek <klimek at google.com>
>>>> wrote:
>>>>
>>>>> On Wed, Dec 2, 2015 at 10:35 AM Russell Wallace via cfe-dev <
>>>>> cfe-dev at lists.llvm.org> wrote:
>>>>>
>>>>>> Tools built with LibTooling default to using a compilation database
>>>>>> if one is available, which is good.
>>>>>>
>>>>>> In the case where a compilation database is not available, there is a
>>>>>> problem: the default behavior is to exit with an error message, whereas in
>>>>>> some cases the tool would be required to do the best it can anyway. This
>>>>>> can be achieved by adding -- to the end of the command line, but this
>>>>>> wouldn't be obvious to someone unfamiliar with Clang tools.
>>>>>>
>>>>>> One solution would be for the program to append -- to argv if it's
>>>>>> not already present, but would this disable the default useful behavior of
>>>>>> reading the compilation database if it is available?
>>>>>>
>>>>>> If so, is there a way for the program to say 'okay, check for a
>>>>>> compilation database as normal, but if it's not present, let me know and
>>>>>> I'll fill in some best-guess default options'?
>>>>>>
>>>>>
>>>>> The problem is that for C++ there really are no best guess default
>>>>> options. If you have ideas for what they should be, please make a proposal.
>>>>>
>>>>>
>>>>>> _______________________________________________
>>>>>> cfe-dev mailing list
>>>>>> cfe-dev at lists.llvm.org
>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>>>
>>>>>
>>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151202/80d9d260/attachment.html>
More information about the cfe-dev
mailing list