Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tokenizer: removed some wrapper functions #6054

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
{
Timer timer("Tokenizer::createTokens", mSettings.showtime, &s_timerResults);
simplecpp::TokenList tokensP = preprocessor.preprocess(tokens1, mCurrentConfig, files, true);
tokenizer.createTokens(std::move(tokensP));
tokenizer.list.createTokens(std::move(tokensP));
}
hasValidConfig = true;

Expand Down
13 changes: 1 addition & 12 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3345,17 +3345,6 @@ void Tokenizer::simplifyUsingError(const Token* usingStart, const Token* usingEn
}
}

bool Tokenizer::createTokens(std::istream &code,
const std::string& FileName)
{
return list.createTokens(code, FileName);
}

void Tokenizer::createTokens(simplecpp::TokenList&& tokenList)
{
list.createTokens(std::move(tokenList));
}

bool Tokenizer::simplifyTokens1(const std::string &configuration)
{
// Fill the map mTypeSize..
Expand Down Expand Up @@ -3441,7 +3430,7 @@ bool Tokenizer::tokenize(std::istream &code,
const char FileName[],
const std::string &configuration)
{
if (!createTokens(code, FileName))
if (!list.createTokens(code, FileName))
return false;

return simplifyTokens1(configuration);
Expand Down
7 changes: 0 additions & 7 deletions lib/tokenize.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ class ErrorLogger;
class Preprocessor;
enum class Severity;

namespace simplecpp {
class TokenList;
}

/// @addtogroup Core
/// @{

Expand Down Expand Up @@ -83,9 +79,6 @@ class CPPCHECKLIB Tokenizer {
*/
bool isScopeNoReturn(const Token *endScopeToken, bool *unknown = nullptr) const;

bool createTokens(std::istream &code, const std::string& FileName);
void createTokens(simplecpp::TokenList&& tokenList);

bool simplifyTokens1(const std::string &configuration);
/**
* Tokenize code
Expand Down
4 changes: 2 additions & 2 deletions test/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void PreprocessorHelper::preprocess(const char code[], std::vector<std::string>
simplecpp::preprocess(tokens2, tokens1, files, filedata, simplecpp::DUI());

// Tokenizer..
tokenizer.createTokens(std::move(tokens2));
tokenizer.list.createTokens(std::move(tokens2));
}

void PreprocessorHelper::preprocess(Preprocessor &preprocessor, const char code[], std::vector<std::string> &files, Tokenizer& tokenizer)
Expand All @@ -174,7 +174,7 @@ void PreprocessorHelper::preprocess(Preprocessor &preprocessor, const char code[
simplecpp::preprocess(tokens2, tokens1, files, filedata, dui);

// Tokenizer..
tokenizer.createTokens(std::move(tokens2));
tokenizer.list.createTokens(std::move(tokens2));

preprocessor.setDirectives(tokens1);
}
8 changes: 4 additions & 4 deletions test/testsimplifytemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5290,7 +5290,7 @@ class TestSimplifyTemplate : public TestFixture {
Tokenizer tokenizer(settings, this);

std::istringstream istr(code);
tokenizer.createTokens(istr, "test.cpp");
tokenizer.list.createTokens(istr, "test.cpp");
tokenizer.createLinks();
tokenizer.splitTemplateRightAngleBrackets(false);

Expand Down Expand Up @@ -5357,7 +5357,7 @@ class TestSimplifyTemplate : public TestFixture {
Tokenizer tokenizer(settings, this);

std::istringstream istr(code);
tokenizer.createTokens(istr, "test.cpp");
tokenizer.list.createTokens(istr, "test.cpp");
tokenizer.createLinks();
tokenizer.splitTemplateRightAngleBrackets(false);

Expand Down Expand Up @@ -5427,7 +5427,7 @@ class TestSimplifyTemplate : public TestFixture {
Tokenizer tokenizer(settings, this);

std::istringstream istr(code);
tokenizer.createTokens(istr, "test.cpp");
tokenizer.list.createTokens(istr, "test.cpp");
tokenizer.createLinks();
tokenizer.splitTemplateRightAngleBrackets(false);

Expand Down Expand Up @@ -5456,7 +5456,7 @@ class TestSimplifyTemplate : public TestFixture {
Tokenizer tokenizer(settings, this);

std::istringstream istr(code);
tokenizer.createTokens(istr, "test.cpp");
tokenizer.list.createTokens(istr, "test.cpp");
tokenizer.createLinks();
tokenizer.splitTemplateRightAngleBrackets(false);

Expand Down
Loading