Skip to content

cmCommandArgumentParserHelper: rework input handling

Oleksandr Koval requested to merge OleksandrKvl/cmake:optimize-old-expand into master
  1. Remove usage of YY_INPUT macro because it results in 16 KB being allocated for each variable parsing. Also old LexInput() routine provides input to Flex byte-by-byte which is far from the good. Replacing all the above with yy_scan_string() call eliminates both problems, no more huge heap allocations and byte-by-byte scanning.
  2. Fix error position tracking. Currently it reports the 0-based position after the erroneous token, not always correct one. With this fix it reports much common 1-based column position of erroneous token.

Details and benchmarks are here.

Merge request reports