line number of matching curly

I'm using clang 2.7.
I've been enjoying clang's great diagnostics.
So I was surprised by this one below.
Can you please add the line number of the matching open curly
for the expected close curly (in this case line 2)?
Thanks,
Glenn

gkasten$ cat test.c
int test(void)
{
int i;
$ clang test.c
test.c:3:7: error: expected '}'
int i;
     ^
1 diagnostic generated.
$

I'm using clang 2.7.
I've been enjoying clang's great diagnostics.
So I was surprised by this one below.
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,

-Chris

"Chris Lattner" 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.

Regards

Niklas Angare

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

Could you have it detect where the closing brace should be based on the
indentation?

That sounds like a reasonable heuristic.

"Chris Lattner" wrote: