| 947 | } |
| 948 | |
| 949 | boost::bimap<unsigned int, NodeInstance*> GraphModule::createLineNumberAssoc() const { |
| 950 | // create a sorted list of GraphFunctions |
| 951 | std::vector<NodeInstance*> nodes; |
| 952 | for (const auto& f : functions()) { |
| 953 | for (const auto& node : f->nodes()) { |
| 954 | assert(node.second != nullptr); |
| 955 | nodes.push_back(node.second.get()); |
| 956 | } |
| 957 | } |
| 958 | |
| 959 | std::sort(nodes.begin(), nodes.end(), [](const auto& lhs, const auto& rhs) { |
| 960 | return (lhs->function().name() + ":" + boost::uuids::to_string(lhs->id())) < |
| 961 | (rhs->function().name() + ":" + boost::uuids::to_string(rhs->id())); |
| 962 | }); |
| 963 | |
| 964 | boost::bimap<unsigned, NodeInstance*> ret; |
| 965 | for (unsigned i = 0; i < nodes.size(); ++i) { |
| 966 | ret.left.insert({i + 1, nodes[i]}); // + 1 because line numbers start at 1 |
| 967 | } |
| 968 | |
| 969 | return ret; |
| 970 | } |
| 971 | |
| 972 | GraphStruct* GraphModule::structFromName(boost::string_view name) const { |
| 973 | for (const auto& str : structs()) { |
no test coverage detected