<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 24, 2014 at 6:26 AM, Milian Wolff <span dir="ltr"><<a href="mailto:mail@milianw.de" target="_blank">mail@milianw.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey there,<br>
<br>
integrating clang into KDevelop we noticed that some diagnostics are lacking<br>
ranges which are in our opinion useful to have. Take this example:<br>
<br>
~~~~~~~<br>
class foobar {};<br>
class foobar {};<br>
<br>
void foo(double);<br>
void foo(float);<br>
<br>
int main()<br>
{<br>
foo(0);<br>
<br>
"123" + 1;<br>
return 0;<br>
}<br>
~~~~~~~<br>
<br>
If you compile this with clang++ you'll get:<br>
<br>
~~~~~~~<br>
test.cpp:2:7: error: redefinition of 'foobar'<br>
class foobar {};<br>
^<br>
test.cpp:1:7: note: previous definition is here<br>
class foobar {};<br>
^<br>
test.cpp:9:3: error: call to 'foo' is ambiguous<br>
foo(0);<br>
^~~<br>
test.cpp:4:6: note: candidate function<br>
void foo(double);<br>
^<br>
test.cpp:5:6: note: candidate function<br>
void foo(float);<br>
^<br>
test.cpp:11:9: warning: expression result unused [-Wunused-value]<br>
"123" + 1;<br>
~~~~~ ^ ~<br>
1 warning and 2 errors generated.<br>
~~~~~~~<br>
<br>
Is there a reason why some diagnostics only have a cursor pointing to the<br>
beginning of a token, while others are underlined properly?<br></blockquote><div><br></div><div>This isn't a question of "properly" or not - you'll notice that the things underlined could actually, in other contexts, be more than one token (eg: (1 + 2) + "foo" the LHS is (1 + 2) is underlined, and in "foo(0)" it's possible that 'foo' could be a more complex expression involving a fully qualified function name, decltype, etc). I suppose arguably the 'foobar' example could involve a fully qualified (nested) name too.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
For the child diagnostics pointing to the candidate function it's fine to only<br>
get a cursor. But for the redefinition of 'foobar' I'd expect a range. Similar<br>
for diagnostics related to not-found #include statements.<br>
<br>
Would patches be accepted to add ranges to these diagnostics? Where would I<br>
have to look in the codebase?<br></blockquote><div><br></div><div>If we decide that's the right direction (that all diagnostic locations should highlight the entire token, rather than just use a caret to point to the start) we should probably just fix the diagnostic printer, rather than fixing every diagnostic call site.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks<br>
<span class="HOEnZb"><font color="#888888">--<br>
Milian Wolff<br>
<a href="mailto:mail@milianw.de">mail@milianw.de</a><br>
<a href="http://milianw.de" target="_blank">http://milianw.de</a><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</font></span></blockquote></div><br></div></div>