[cfe-dev] line number of matching curly
Clark Gaebel
cg.wowus.cg at gmail.com
Thu Sep 9 12:35:02 PDT 2010
Could you have it detect where the closing brace should be based on the
indentation?
On 09/09/10 14:30, Chris Lattner wrote:
> On Sep 8, 2010, at 5:49 PM, Niklas Angare wrote:
>
>> "Chris Lattner" wrote:
>>> On Aug 31, 2010, at 4:57 PM, Glenn Kasten wrote:
>>>
>>>> Can you please add the line number of the matching open curly
>>>> for the expected close curly (in this case line 2)?
>>> Makes sense, fixed in r112709. Thanks,
>> Sorry to barge in, but I'm wondering what the likelihood is of the compiler
>> actually pointing to the correct left brace.
>>
>> I'm pretty sure it will point to the wrong one in this case:
>>
>> void test(int i)
>> {
>> if(i > 3)
>> {
>> i *= 2;
>> //} <-- missing brace
>>
>> fudge(i);
>> }
>>
>> If it points to the incorrect one a lot of times I'd say it does more harm
>> than good.
> You're right that the compiler doesn't know what you meant... the idea of pointing out the opening braces is so that *you* know what the compiler is "thinking".
>
> In any case, it's the right thing to do for consistency with other diagnostics in clang.
>
> -Chris
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
--
Regards,
-- Clark
More information about the cfe-dev
mailing list