update_cc_test_checks.py and function declarations

Hi Alex and all,

Did something change with update_cc_test_checks.py when moving from
c-index-test to the JSON AST for getting function line numbers? Before
this change, a test like this had the checks put on the function
definitions:

void foo();

int main() {
  foo();
  return 0;
}

void foo() {
  ...
}

The checks for foo were put in front of the definition of foo. Now I am
seeing the checks put in front of the declaration of foo, which messes
up the CHECK-LABEL ordering.

I don't see anything in the JSON parsing code that distinguishes a
function declaration from a function definition. I don't know how the
old c-index-test code worked though. The only thing I know is that I
used to get checks on the function definition and now I get them on the
function declaration.

I can't say for sure it is the use of the JSON AST that caused the
change in behavior I'm seeing as I have made some of my own
soon-to-be-upstreamed changes but it seems most likely since those other
changes shouldn't have affected the line2spell_and_mangled_list.

Thanks for your help!

                    -David

David Greene <dag@cray.com> writes:

void foo();

int main() {
  foo();
  return 0;
}

void foo() {
  ...
}

The checks for foo were put in front of the definition of foo. Now I am
seeing the checks put in front of the declaration of foo, which messes
up the CHECK-LABEL ordering.

Actually, I see the checks place *both* before the declaration *and*
before the definition.

                      -David

Hi David,

This looks like a regression from when I added the JSON AST dump parsing code.
I never tried using it on a file with both definition and declaration for the same function. I’ve posted https://reviews.llvm.org/D73708 which should fix this issue.

Alex

Alexander Richardson via cfe-dev <cfe-dev@lists.llvm.org> writes:

Hi David,

This looks like a regression from when I added the JSON AST dump parsing
code.
I never tried using it on a file with both definition and declaration for
the same function. I've posted https://reviews.llvm.org/D73708 which should
fix this issue.

Looks great, thank you!

                 -David