Skip to content

Commit

Permalink
Ci fix
Browse files Browse the repository at this point in the history
  • Loading branch information
olabetskyi committed Jun 18, 2024
1 parent c631a84 commit aa585cb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
8 changes: 7 additions & 1 deletion lib/preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -339,7 +345,7 @@ std::list<Directive> 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));
}
Expand Down
9 changes: 8 additions & 1 deletion lib/preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ struct CPPCHECKLIB Directive {
/** the actual directive text */
std::string str;

std::vector<std::pair<std::string, const int>> strTokens;
struct DirectiveToken {
explicit DirectiveToken(std::string _str, int _line, int _column);
int line;
int column;
std::string tokStr;
};

std::vector<DirectiveToken> strTokens;

/** record a directive (possibly filtering src) */
Directive(std::string _file, const int _linenr, const std::string &_str);
Expand Down
7 changes: 5 additions & 2 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5961,11 +5961,14 @@ void Tokenizer::dump(std::ostream &out) const
outs += '\n';
for (const auto & strToken : dir.strTokens) {
outs += " <token ";
outs += "line=\"";
outs += std::to_string(strToken.line);
outs += "\" ";
outs += "column=\"";
outs += std::to_string(strToken.second);
outs += std::to_string(strToken.column);
outs += "\" ";
outs += "str=\"";
outs += ErrorLogger::toxml(strToken.first);
outs += ErrorLogger::toxml(strToken.tokStr);
outs +="\"/>";
outs += '\n';
}
Expand Down

0 comments on commit aa585cb

Please sign in to comment.