You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactoring: separate the cppcheck-specific &= handling from TokenList::combineOperators() #737
TokenList::combineOperators() joins single-character tokens into operators (&= → &=). It also contains a heuristic for
cppcheck: in a function declaration with an unnamed reference parameter that has a default value, &= is not joined.
voidf(x&=2); // simplecpp: void f ( x & = 2 ) ;f(x&=2); // simplecpp: f ( x &= 2 ) ;
This is not part of preprocessing. Compilers tokenize &= as one operator here (g++: expected ',' or '...' before '&=' token). To
decide, the heuristic tracks whether the code is inside a function body (executableScope) and looks back for a function
declaration. That is C++ parsing.
Before combineOperators() is replaced by a longest-match tokenizer (step 2 of #708), move this code into separate functions with
clear names, so that it can be kept as its own step:
tracking of { / } to know if the current code is in a function body
detection of "&= in the parameter list of a function declaration"
This is a pure refactoring, so behaviour does not change. The existing tests in combineOperators_andequal keep passing unchanged.
Activity
Fix cppcheck-opensource#737 (Refactoring: separate the cppcheck-speci…