| 6 | namespace ftg { |
| 7 | |
| 8 | void RDCache::cache(const RDNode &Key, std::set<RDNode> Value) { |
| 9 | RDNode CopiedKey = Key; |
| 10 | CopiedKey.clearVisit(); |
| 11 | if (Cache.find(CopiedKey) != Cache.end()) { |
| 12 | outs() << "Error Key: " << CopiedKey << "\n"; |
| 13 | assert(false && "Unexpected Program State"); |
| 14 | } |
| 15 | |
| 16 | for (auto &V : Value) { |
| 17 | auto &Node = *const_cast<RDNode *>(&V); |
| 18 | Node.clearVisit(); |
| 19 | } |
| 20 | Cache.insert(std::make_pair(CopiedKey, Value)); |
| 21 | } |
| 22 | |
| 23 | bool RDCache::has(const RDNode &Key) const { |
| 24 | return Cache.find(Key) != Cache.end(); |
no test coverage detected