| 2834 | } |
| 2835 | |
| 2836 | void getConstFunctions(const SymbolDatabase *symbolDatabase, std::list<const Function*> &constFunctions) |
| 2837 | { |
| 2838 | for (const Scope &scope : symbolDatabase->scopeList) { |
| 2839 | // only add const functions that do not have a non-const overloaded version |
| 2840 | // since it is pretty much impossible to tell which is being called. |
| 2841 | using StringFunctionMap = std::map<std::string, std::list<const Function*>>; |
| 2842 | StringFunctionMap functionsByName; |
| 2843 | for (const Function &func : scope.functionList) { |
| 2844 | functionsByName[func.tokenDef->str()].push_back(&func); |
| 2845 | } |
| 2846 | for (std::pair<const std::string, std::list<const Function*>>& it : functionsByName) { |
| 2847 | const auto nc = std::find_if(it.second.cbegin(), it.second.cend(), notconst); |
| 2848 | if (nc == it.second.cend()) { |
| 2849 | // ok to add all of them |
| 2850 | constFunctions.splice(constFunctions.end(), it.second); |
| 2851 | } |
| 2852 | } |
| 2853 | } |
| 2854 | } |
| 2855 | } |
| 2856 | |
| 2857 | static bool |
no test coverage detected