From 43e9b3ba66a759264b99ee196f83618e02e922f1 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 6 Apr 2024 21:54:03 +0200 Subject: [PATCH 1/2] Tokenizer: made more functions private --- lib/tokenize.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tokenize.h b/lib/tokenize.h index 5ec2a10571b..8541417147b 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -105,6 +105,7 @@ class CPPCHECKLIB Tokenizer { const char FileName[], const std::string &configuration = emptyString); +private: /** Set variable id */ void setVarId(); void setVarIdPass1(); @@ -139,7 +140,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 +149,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 +353,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 From 645c8e116e89190230690a71ec3953689c0dedb4 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 6 Apr 2024 21:54:17 +0200 Subject: [PATCH 2/2] Tokenizer: cleaned up friend declarations --- lib/tokenize.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/tokenize.h b/lib/tokenize.h index 8541417147b..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();