From aa585cb2b1aad6b97c0ffeeaba62610c8fdb94c3 Mon Sep 17 00:00:00 2001 From: Oleksandr Labetskyi Date: Tue, 18 Jun 2024 16:35:39 +0300 Subject: [PATCH] Ci fix --- lib/preprocessor.cpp | 8 +++++++- lib/preprocessor.h | 9 ++++++++- lib/tokenize.cpp | 7 +++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index c5b4ef685c5..d09c81c4654 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -49,6 +49,12 @@ Directive::Directive(std::string _file, const int _linenr, const std::string &_s str(trim(_str)) {} +Directive::DirectiveToken::DirectiveToken(std::string _str, int _line, int _column) : + line(_line), + column(_column), + tokStr(_str) +{} + char Preprocessor::macroChar = char(1); Preprocessor::Preprocessor(const Settings& settings, ErrorLogger &errorLogger) : mSettings(settings), mErrorLogger(errorLogger) @@ -339,7 +345,7 @@ std::list Preprocessor::createDirectives(const simplecpp::TokenList & else directive.str += tok2->str(); - directive.strTokens.push_back(std::make_pair(tok2->str(), tok2->location.col)); + directive.strTokens.emplace_back(tok2->str(), tok2->location.line, tok2->location.col); } directives.push_back(std::move(directive)); } diff --git a/lib/preprocessor.h b/lib/preprocessor.h index 28c2bfb96d0..bd05d0fcf65 100644 --- a/lib/preprocessor.h +++ b/lib/preprocessor.h @@ -56,7 +56,14 @@ struct CPPCHECKLIB Directive { /** the actual directive text */ std::string str; - std::vector> strTokens; + struct DirectiveToken { + explicit DirectiveToken(std::string _str, int _line, int _column); + int line; + int column; + std::string tokStr; + }; + + std::vector strTokens; /** record a directive (possibly filtering src) */ Directive(std::string _file, const int _linenr, const std::string &_str); diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 7fb3dd72376..0efe8a49db4 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5961,11 +5961,14 @@ void Tokenizer::dump(std::ostream &out) const outs += '\n'; for (const auto & strToken : dir.strTokens) { outs += " "; outs += '\n'; }