TODO: also update mOrigFiles?
| 92 | |
| 93 | // TODO: also update mOrigFiles? |
| 94 | int 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 | |
| 113 | void TokenList::clangSetOrigFiles() |
| 114 | { |