[cfe-dev] Help regarding clang
Swaresh Sankpal via cfe-dev
cfe-dev at lists.llvm.org
Tue Feb 16 02:31:19 PST 2016
Thanks for that.
How can we create mutations of a given source code using clang?.Input to my
tool will be c++ code and output will be some n mutations of that c++ code.
On 16-Feb-2016 3:54 pm, "mats petersson" <mats at planetcatfish.com> wrote:
> Curtesy says that you should copy the list when you reply (in other words,
> use "reply to all").
>
>
>
> On 16 February 2016 at 10:05, Swaresh Sankpal <swaresh123 at gmail.com>
> wrote:
>
>> I actually want to catch such errors and give feedback in simple language
>> so that new programmers can correct the error or I could give a link to
>> that may help in correcting errors.
>>
>> So, you want to translate error messages to a more verbose form?
>
> I'm reasonably sure thats a pretty hard thing to do in the more general
> case. Sure, some very trivial errors may be possible, but in the general
> situation with mistakes that novices and more experienced programmers end
> up making, I'd say giving a more "user friendly" error message is going to
> be quite difficult.
>
> By the way, the example you gave is an interesting one, because it would
> appear that clang does a bit of implicit casting, before deciding that
> types are incorrect.
>
> ptr.c:6:12: error: invalid operands to binary expression ('float' and
> 'float')
> int y = f % x;
> ~ ^ ~
> This can be confusing, but I would argue that this is best fixed by
> undoing the type-casts before issuing the error message (or the types
> related to it).
>
> As to catching logical errors [in a second email to me privately], it's
> even harder - whilst SOME logical errors are relatively easy to spot, most
> are not - this is called "the halting problem".
>
> double x = 0.0;
> while(sin(x) <= 1.0) { x+= 0.01; }
>
> will run forever, if sin doesn't have an errror that results in > 1.0
> answers - but how do you know that from a programmatic standpoint?
>
> --
> Mats
>
> On 16-Feb-2016 3:18 pm, "mats petersson" <mats at planetcatfish.com> wrote:
>>
>>> Can you give an example that actually compiles, and the expected
>>> output? (using % on a float value doesn't compile, because both sides need
>>> to be integer).
>>>
>>> --
>>> Mats
>>>
>>> On 16 February 2016 at 09:27, Swaresh Sankpal via cfe-dev <
>>> cfe-dev at lists.llvm.org> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am very new to clang and llvm.I want to build a clang tool to give
>>>> automated feedback by analyzing c++ source code.Input to the tool is a c++
>>>> code and output should be feedback related to small problems that i
>>>> implement(like say modulus operation on floating point number).Feedback
>>>> will be given input as a string.How to proceed with such a problem.Please
>>>> help.Any example doing similar kind of thing will be very helpful.
>>>>
>>>> Swaresh
>>>> IIT Bombay.
>>>>
>>>> _______________________________________________
>>>> 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/20160216/344bc83e/attachment.html>
More information about the cfe-dev
mailing list