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

Method appendFileIfNew

lib/tokenlist.cpp:94–111  ·  view source on GitHub ↗

TODO: also update mOrigFiles?

Source from the content-addressed store, hash-verified

92
93// TODO: also update mOrigFiles?
94int TokenList::appendFileIfNew(std::string fileName)
95{
96 assert(!fileName.empty());
97
98 // Has this file been tokenized already?
99 auto it = std::find_if(mFiles.cbegin(), mFiles.cend(), [&](const std::string& f) {
100 return Path::sameFileName(f, fileName);
101 });
102 if (it != mFiles.cend())
103 return static_cast<int>(std::distance(mFiles.cbegin(), it));
104
105 assert(mTokensFrontBack->front == nullptr); // has no effect if tokens have already been created
106
107 // The "mFiles" vector remembers what files have been tokenized..
108 mFiles.push_back(std::move(fileName));
109
110 return mFiles.size() - 1;
111}
112
113void TokenList::clangSetOrigFiles()
114{

Callers 14

setLocationsMethod · 0.80
checkClangMethod · 0.80
validateMethod · 0.80
testAstMethod · 0.80
SimpleTokenizerMethod · 0.80
tokenizeMethod · 0.80
SimpleTokenListMethod · 0.80
isKeywordMethod · 0.80
templateParametersMethod · 0.80
toBigNumberMethod · 0.80

Calls 3

emptyMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by 8

validateMethod · 0.64
testAstMethod · 0.64
isKeywordMethod · 0.64
templateParametersMethod · 0.64
toBigNumberMethod · 0.64
toBigUNumberMethod · 0.64
toDoubleNumberMethod · 0.64