Repository navigation
Commit 24f6e64
committed
Read a name with a macro row as a macro where an item of a file starts
A translation unit and a namespace body hold declarations and no statement
([basic.link] p1, [namespace.def] p1, GCC cp_parser_toplevel_declaration,
Clang ParseExternalDeclaration), so `name(args);` there is no call. 00e3c7a
reads such an item as a macro when the name has no lowercase letter, and the
shape of the name is its evidence. `PyDoc_STRVAR(doc, "text");`,
`TF_CALL_half(REGISTER);` and `DEFINE_int32(flag, 1, "help");` hold a
lowercase letter, and that commit named them as the rows it does not reach.
THIS COMMIT TAKES THE ROW OF THE SEED AS THE EVIDENCE IN PLACE OF THE SHAPE.
A name with a function-macro row of the seed of its own project reads as a
macro where an item starts. The row must be the function-like one, because an
object-like macro takes no arguments ([cpp.replace] p10): `printf("good");`
in 7 files of the Clang interpreter tests has an object row, and a statement
at file scope is the reading of Clang itself there. The two lookups of
00e3c7a stay: a name that a class head of the file or a type row of the seed
declares keeps its reading, and a group with the shape of a parenthesized
declarator keeps its declaration.
THE POPULATION AT 7c0d954. A census of the class walks the tree, as the
census of the gate does: an expression_statement whose first named child is a
call_expression, whose nearest ancestor that is no preprocessor node is the
translation_unit or a declaration_list. It holds 13,895 clean sites with a
callee that has a lowercase letter. 7,714 of them have a field_expression as
the callee, the `BENCHMARK(BM_Run)->Arg(0)->Unit(...);` chains that 00e3c7a
named, and 5,977 have a plain name. Of those 5,977 sites, in 764 files with
585 names, the seed of the project holds a function-macro row for 2,646.
THE HEAD CENSUS HOLDS 0 OF THE 2,646, so each one is a macro invocation now.
The treediff gives 2,660 regions of a new macro_invocation in 364 clean
files: the 2,646 sites, 2 sites of hpx swapcontext32.ipp, which the census
counts as an include fragment, and 12 sites in 5 files that the base read as
a declaration with a parenthesized declarator, because the argument is a type
keyword. Those 12 are `__usdt_def_signed(short);` and two more lines of hhvm
usdt.h, `BOOST_dynamic_bitset_is_numeric(bool);` and two more lines of the
mongo copy of boost dynamic_bitset.hpp, `REGISTER_MatMulNBits(float);` of
onnxruntime matmul_nbits.cc, `TestInitializerDataFieldSpecialized(float);`
and one more line of onnxruntime initializer_test.cc, and
`REGISTER_GPU_int32(int32_t);` and one more line of tensorflow split_v_op.cc.
A declaration of that text declares nothing, because it has no name.
THE ROWS THIS COMMIT DOES NOT REACH, BY TASK. 1,699 sites hold a name that
only another project of the corpus declares as a macro: `DEFINE_bool` 433,
`DEFINE_int32` 378, `DECLARE_bool` 157 of gflags. A seed is a fact about one
project, and a name of a dependency reaches a file through its include graph,
so those sites wait for the per-file seed deltas of tree-sitter#372 and the dependency
map of item 6 of tree-sitter#360. 1,623 sites hold a name with no row anywhere,
`PyDoc_STRVAR` 1,129 of them, whose macro is in a Python header that the
corpus does not hold, and the same include work reaches them. 38 sites of
`common();` and 38 of `specific();` in the boost type-traits tests are calls
in a function body that `TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME)` opens in its
expansion, where the tree of today is right, and no row declines them.
THE BRANCH OF A CALL BEFORE A DIRECTIVE KEEPS ITS READ NOW. A first form of
this rule repaired 1,652 of the 2,646 sites, and every site that it missed
stood in a conditional group: `TF_CALL_half(DECLARE_GPU_SPECS);` in a `#if`
group of tensorflow kept its call, and the same line outside the group became
a macro invocation. `scan_macro_start` reads a call of a name with a
lowercase letter before the directive that ends a branch of a structured
group. That branch read the group, found a `;` and not a directive, and
returned false, which gave up the whole scan before the item form ran. The
branch now keeps its read of the group and lets the scan go on.
MEASURED AGAINST 7c0d954. The rule reads a seed, so every plain step measures
zero: 0 tree changes over the corpus and over the test files, and 0 changes
of the treediff. The seeded steps change 364 clean files and 64 files with an
error, of which one loses its error. No file gets a new error or more error
bytes. The ties population keeps 3,110 rows and the dedupe population 2,818,
with none risen and none fallen. The census of the clean files gives no
detector that rose. The pins do not change, 624 corpus examples pass, and the
fuzz gives no failure over 5,037 inputs.
THE CO-VALIDITY TABLE LOSES ONE ROW WITH NO TOKEN CHANGE. The table holds one
row for each stop site of the scanner, keyed by the function and the line,
and a row whose condition names no token prints that fact. `scan_macro_start`
had three such rows: the branch of a call before a directive, the read of the
group, and `if (call)`. This commit makes the first two one `if` and one
`else if`, so that function has two. The key of the comparison holds no line
number, so the count falls from 13 to 12. No parse state and no token moves,
and the co-validity of every other row is the row of the base.1 parent 7c0d954 commit 24f6e64
2 files changed
Lines changed: 109 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2479 | 2479 | | |
2480 | 2480 | | |
2481 | 2481 | | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
2482 | 2491 | | |
2483 | 2492 | | |
2484 | 2493 | | |
| |||
3840 | 3849 | | |
3841 | 3850 | | |
3842 | 3851 | | |
3843 | | - | |
| 3852 | + | |
| 3853 | + | |
3844 | 3854 | | |
| 3855 | + | |
| 3856 | + | |
| 3857 | + | |
| 3858 | + | |
| 3859 | + | |
| 3860 | + | |
| 3861 | + | |
3845 | 3862 | | |
3846 | 3863 | | |
3847 | 3864 | | |
| |||
3901 | 3918 | | |
3902 | 3919 | | |
3903 | 3920 | | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
3904 | 3924 | | |
3905 | 3925 | | |
3906 | 3926 | | |
| |||
4179 | 4199 | | |
4180 | 4200 | | |
4181 | 4201 | | |
4182 | | - | |
| 4202 | + | |
| 4203 | + | |
| 4204 | + | |
| 4205 | + | |
| 4206 | + | |
| 4207 | + | |
| 4208 | + | |
| 4209 | + | |
| 4210 | + | |
4183 | 4211 | | |
4184 | 4212 | | |
4185 | 4213 | | |
| |||
4230 | 4258 | | |
4231 | 4259 | | |
4232 | 4260 | | |
| 4261 | + | |
| 4262 | + | |
4233 | 4263 | | |
4234 | | - | |
4235 | | - | |
| 4264 | + | |
4236 | 4265 | | |
4237 | 4266 | | |
4238 | | - | |
4239 | | - | |
4240 | | - | |
| 4267 | + | |
| 4268 | + | |
| 4269 | + | |
| 4270 | + | |
| 4271 | + | |
| 4272 | + | |
| 4273 | + | |
| 4274 | + | |
| 4275 | + | |
| 4276 | + | |
| 4277 | + | |
4241 | 4278 | | |
4242 | 4279 | | |
4243 | | - | |
4244 | | - | |
4245 | | - | |
4246 | | - | |
4247 | | - | |
4248 | | - | |
4249 | | - | |
| 4280 | + | |
| 4281 | + | |
4250 | 4282 | | |
4251 | 4283 | | |
4252 | 4284 | | |
| |||
4312 | 4344 | | |
4313 | 4345 | | |
4314 | 4346 | | |
4315 | | - | |
| 4347 | + | |
4316 | 4348 | | |
4317 | 4349 | | |
4318 | 4350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
462 | 524 | | |
463 | 525 | | |
464 | 526 | | |
| |||
0 commit comments