cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

Token: cache `isCpp()` and `isC()` values

Open firewave opened this issue 1 year ago • 5 comments

firewave avatar Oct 18 '24 13:10 firewave

To clean up the mess with the inconsistent language I have local changes that prevents the creation of a TokenList without a language.

firewave avatar Oct 18 '24 15:10 firewave

@danmar

lib/token.h:1440:10: style: Bit-fields should not be declared [premium-misra-cpp-2023-12.2.1]
    bool mIsC : 1;
         ^

This is not really a bitfield but ensuring that these bools do not blow up the side of the object. This is commonly used in e.g. LLVM code base.

Also there is another (mIsCpp) just below so it seems the check has false negatives.

firewave avatar Oct 18 '24 15:10 firewave

Also - is there handling that suppressions for premium-* are not being reported as unused with an open-source version (I have not checked the code)?

firewave avatar Oct 18 '24 15:10 firewave

callgrind step in CI: 64,041,451,567 -> 63,581,639,801

firewave avatar Oct 18 '24 15:10 firewave

excerpts from selfcheck.

before

Check time: cli/cmdlineparser.cpp: 1056.33s
[...]
Check time: lib/checkio.cpp: 221.528s
[...]
lib/symboldatabase.cpp: 247.606s
Check time: lib/tokenize.cpp: 286.758s

after

Check time: cli/cmdlineparser.cpp: 1027.11s
[...]
Check time: lib/checkio.cpp: 213.18s
[...]
Check time: lib/symboldatabase.cpp: 238.817s
Check time: lib/tokenize.cpp: 276.817s

firewave avatar Oct 18 '24 15:10 firewave

No feedback in over two weeks - merging.

firewave avatar Nov 13 '24 12:11 firewave