From c802bab36428b6f3f22148736770ef87104f9692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sun, 7 Apr 2024 00:37:21 +0200 Subject: [PATCH] small `tokenize.h` cleanup (#6250) --- lib/tokenize.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/tokenize.h b/lib/tokenize.h index 5ec2a10571b..a8249024215 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -45,14 +45,13 @@ enum class Severity; /** @brief The main purpose is to tokenize the source code. It also has functions that simplify the token list */ class CPPCHECKLIB Tokenizer { - friend class TestSimplifyTokens; - friend class TestSimplifyTypedef; - friend class TestSimplifyUsing; - friend class TestTokenizer; friend class SymbolDatabase; - friend class TestSimplifyTemplate; friend class TemplateSimplifier; + friend class TestSimplifyTemplate; + friend class TestSimplifyTypedef; + friend class TestTokenizer; + public: explicit Tokenizer(const Settings & settings, ErrorLogger *errorLogger, const Preprocessor *preprocessor = nullptr); ~Tokenizer(); @@ -105,6 +104,7 @@ class CPPCHECKLIB Tokenizer { const char FileName[], const std::string &configuration = emptyString); +private: /** Set variable id */ void setVarId(); void setVarIdPass1(); @@ -139,7 +139,7 @@ class CPPCHECKLIB Tokenizer { */ void splitTemplateRightAngleBrackets(bool check); - +public: /** * Calculates sizeof value for given type. * @param type Token which will contain e.g. "int", "*", or string. @@ -148,6 +148,7 @@ class CPPCHECKLIB Tokenizer { nonneg int sizeOfType(const Token* type) const; nonneg int sizeOfType(const std::string& type) const; +private: void simplifyDebug(); /** Simplify assignment where rhs is a block : "x=({123;});" => "{x=123;}" */ @@ -351,6 +352,7 @@ class CPPCHECKLIB Tokenizer { */ static std::string simplifyString(const std::string &source); +public: /** * is token pointing at function head? * @param tok A '(' or ')' token in a possible function head