@@ -352,17 +352,6 @@ void Preprocessor::inlineSuppressions(const simplecpp::TokenList &tokens, Suppre
352352 }
353353}
354354
355- // cppcheck-suppress unusedFunction - only used in tests
356- std::vector<RemarkComment> Preprocessor::getRemarkComments () const
357- {
358- std::vector<RemarkComment> ret;
359- addRemarkComments (mTokens , ret);
360- for (const auto &filedata : mFileCache ) {
361- addRemarkComments (filedata->tokens , ret);
362- }
363- return ret;
364- }
365-
366355void Preprocessor::createDirectives (std::list<Directive> &directives) const
367356{
368357 createDirectives (mTokens , directives);
@@ -1173,13 +1162,15 @@ void Preprocessor::simplifyPragmaAsm(simplecpp::TokenList &tokenList)
11731162 }
11741163}
11751164
1176- void Preprocessor::addRemarkComments ( std::vector<RemarkComment>& remarkComments ) const
1165+ std::vector<RemarkComment> Preprocessor::getRemarkComments ( ) const
11771166{
1178- addRemarkComments (mTokens , remarkComments );
1167+ return getRemarkComments (mTokens );
11791168}
11801169
1181- void Preprocessor::addRemarkComments (const simplecpp::TokenList &tokens, std::vector<RemarkComment> &remarkComments ) const
1170+ std::vector<RemarkComment> Preprocessor::getRemarkComments (const simplecpp::TokenList &tokens) const
11821171{
1172+ std::vector<RemarkComment> remarkComments;
1173+
11831174 for (const simplecpp::Token *tok = tokens.cfront (); tok; tok = tok->next ) {
11841175 if (!tok->comment )
11851176 continue ;
@@ -1226,4 +1217,6 @@ void Preprocessor::addRemarkComments(const simplecpp::TokenList &tokens, std::ve
12261217 // Add the suppressions.
12271218 remarkComments.emplace_back (relativeFilename, remarkedToken->location .line , remarkText);
12281219 }
1220+
1221+ return remarkComments;
12291222}
0 commit comments