preprocessor: line-map cleanups
authorNathan Sidwell <nathan@acm.org>
Mon, 20 Jul 2020 12:07:08 +0000 (05:07 -0700)
committerNathan Sidwell <nathan@acm.org>
Mon, 20 Jul 2020 12:11:19 +0000 (05:11 -0700)
commita926eeedf43512b8576855c0afa51ec29662fd5a
treec331fe0c8bd9c20885686db3ac5da59b6e5202f1
parente4f1cbc35b1e823a0a6e58eeca61c8c6ca351875
preprocessor: line-map cleanups

I found the linemap logic dealing with running out of column numbers
confusing.  There's no need for completely separate code blocks there,
as we can rely on the masking operations working all the way down to
zero bits.  The two binary searches for linemap lookups could do with
modernization of placing the var decls at their initialization point.
(These two searches work in opposite directions, and while lower_bound
would work there, the caching got in the way and I decided to be
conservative.)

libcpp/
* line-map.c (linemap_add): Simplify column overflow calculation.
Add comment about range and column bit init.
(linemap_ordinary_map_lookup): Refactor for RAII
(linemap_macro_map_lookup): Likewise.
libcpp/line-map.c