@@ -48,11 +48,6 @@ enum class Severity : std::uint8_t;
4848class CPPCHECKLIB Tokenizer {
4949
5050 friend class SymbolDatabase ;
51- friend class TemplateSimplifier ;
52-
53- friend class TestSimplifyTemplate ;
54- friend class TestSimplifyTypedef ;
55- friend class TestTokenizer ;
5651
5752public:
5853 Tokenizer (TokenList tokenList, ErrorLogger &errorLogger);
@@ -116,6 +111,7 @@ class CPPCHECKLIB Tokenizer {
116111 void removeExtraTemplateKeywords ();
117112
118113
114+ protected:
119115 /* * Split up template right angle brackets.
120116 * foo < bar < >> => foo < bar < > >
121117 */
@@ -193,6 +189,7 @@ class CPPCHECKLIB Tokenizer {
193189 */
194190 void simplifyVariableMultipleAssign ();
195191
192+ protected:
196193 /* *
197194 * Simplify the 'C Alternative Tokens'
198195 * Examples:
@@ -202,6 +199,7 @@ class CPPCHECKLIB Tokenizer {
202199 */
203200 bool simplifyCAlternativeTokens ();
204201
202+ private:
205203 /* * Add braces to an if-block, for-block, etc.
206204 * @return true if no syntax errors
207205 */
@@ -231,7 +229,9 @@ class CPPCHECKLIB Tokenizer {
231229 * typedef A mytype;
232230 * A c;
233231 */
232+ protected:
234233 void simplifyTypedef ();
234+ private:
235235 void simplifyTypedefCpp ();
236236 /* *
237237 * Move typedef token to the left og the expression
@@ -244,7 +244,9 @@ class CPPCHECKLIB Tokenizer {
244244
245245 /* *
246246 */
247+ public:
247248 bool simplifyUsing ();
249+ private:
248250 void simplifyUsingError (const Token* usingStart, const Token* usingEnd);
249251
250252 /* * Simplify useless C++ empty namespaces, like: 'namespace %name% { }'*/
@@ -305,10 +307,12 @@ class CPPCHECKLIB Tokenizer {
305307
306308 void fillTypeSizes ();
307309
310+ protected:
308311 void combineOperators ();
309312
310313 void combineStringAndCharLiterals ();
311314
315+ private:
312316 void concatenateNegativeNumberAndAnyPositive ();
313317
314318 void simplifyExternC ();
@@ -325,6 +329,7 @@ class CPPCHECKLIB Tokenizer {
325329
326330 void findComplicatedSyntaxErrorsInTemplates ();
327331
332+ protected:
328333 /* *
329334 * Modify strings in the token list by replacing hex and oct
330335 * values. E.g. "\x61" -> "a" and "\000" -> "\0"
@@ -352,6 +357,7 @@ class CPPCHECKLIB Tokenizer {
352357 */
353358 NORETURN void cppcheckError (const Token *tok) const ;
354359
360+ protected:
355361 /* *
356362 * Setup links for tokens so that one can call Token::link().
357363 */
@@ -362,6 +368,7 @@ class CPPCHECKLIB Tokenizer {
362368 */
363369 void createLinks2 ();
364370
371+ private:
365372 /* *
366373 * Set isCast() for C++ casts
367374 */
@@ -375,6 +382,7 @@ class CPPCHECKLIB Tokenizer {
375382 /* * Syntax error. Unmatched character. */
376383 NORETURN void unmatchedToken (const Token *tok) const ;
377384
385+ private:
378386 /* * Syntax error. C++ code in C file. */
379387 NORETURN void syntaxErrorC (const Token *tok, const std::string &what) const ;
380388
@@ -383,8 +391,6 @@ class CPPCHECKLIB Tokenizer {
383391
384392 void unhandledCharLiteral (const Token *tok, const std::string& msg) const ;
385393
386- private:
387-
388394 /* * Report that there is an unhandled "class x y {" code */
389395 void unhandled_macro_class_x_y (const Token *tok, const std::string& type, const std::string& x, const std::string& y, const std::string& bracket) const ;
390396
@@ -395,12 +401,14 @@ class CPPCHECKLIB Tokenizer {
395401 */
396402 void validateC () const ;
397403
404+ protected:
398405 /* *
399406 * assert that tokens are ok - used during debugging for example
400407 * to catch problems in simplifyTokenList1/2.
401408 */
402409 void validate () const ;
403410
411+ private:
404412 /* * Detect unknown macros and throw unknownMacro */
405413 void reportUnknownMacros () const ;
406414
@@ -433,9 +441,11 @@ class CPPCHECKLIB Tokenizer {
433441 */
434442 void simplifyCppcheckAttribute ();
435443
444+ protected:
436445 /* * Simplify c++20 spaceship operator */
437446 void simplifySpaceshipOperator ();
438447
448+ private:
439449 /* *
440450 * Remove keywords "volatile", "inline", "register", and "restrict"
441451 */
@@ -522,11 +532,13 @@ class CPPCHECKLIB Tokenizer {
522532 */
523533 void simplifyCoroutines ();
524534
535+ protected:
525536 /* *
526537 * Prepare ternary operators with parentheses so that the AST can be created
527538 * */
528539 void prepareTernaryOpForAST ();
529540
541+ private:
530542 /* *
531543 * report error message
532544 */
@@ -561,8 +573,10 @@ class CPPCHECKLIB Tokenizer {
561573
562574 void dump (std::ostream &out) const ;
563575
576+ private:
564577 Token *deleteInvalidTypedef (Token *typeDef);
565578
579+ public:
566580 /* *
567581 * Get variable count.
568582 * @return number of variables
@@ -644,8 +658,10 @@ class CPPCHECKLIB Tokenizer {
644658 /* * Symbol database that all checks etc can use */
645659 SymbolDatabase* mSymbolDatabase {};
646660
661+ protected:
647662 TemplateSimplifier * const mTemplateSimplifier ;
648663
664+ private:
649665 std::set<nonneg int > mTemplateVarIdUsage ;
650666
651667 /* * E.g. "A" for code where "#ifdef A" is true. This is used to
0 commit comments