MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / markUnmatchedInlineSuppressionsAsChecked

Method markUnmatchedInlineSuppressionsAsChecked

lib/suppressions.cpp:632–656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630}
631
632void SuppressionList::markUnmatchedInlineSuppressionsAsChecked(const TokenList &tokenlist) {
633 std::lock_guard<std::mutex> lg(mSuppressionsSync);
634
635 int currLineNr = -1;
636 int currFileIdx = -1;
637 for (const Token *tok = tokenlist.front(); tok; tok = tok->next()) {
638 if (currFileIdx != tok->fileIndex() || currLineNr != tok->linenr()) {
639 currLineNr = tok->linenr();
640 currFileIdx = tok->fileIndex();
641 for (auto &suppression : mSuppressions) {
642 if (suppression.type == SuppressionList::Type::unique) {
643 if (!suppression.checked && (suppression.lineNumber == currLineNr) && (suppression.fileName == tokenlist.file(tok))) {
644 suppression.checked = true;
645 }
646 } else if (suppression.type == SuppressionList::Type::block) {
647 if ((!suppression.checked && (suppression.lineBegin <= currLineNr) && (suppression.lineEnd >= currLineNr) && (suppression.fileName == tokenlist.file(tok)))) {
648 suppression.checked = true;
649 }
650 } else if (!suppression.checked && suppression.fileName == tokenlist.file(tok)) {
651 suppression.checked = true;
652 }
653 }
654 }
655 }
656}
657
658std::string SuppressionList::Suppression::toString() const
659{

Callers 1

checkInternalMethod · 0.80

Calls 3

frontMethod · 0.80
nextMethod · 0.80
fileIndexMethod · 0.80

Tested by

no test coverage detected