| 3892 | } |
| 3893 | |
| 3894 | bool Type::hasCircularDependencies(std::set<BaseInfo>* ancestors) const |
| 3895 | { |
| 3896 | std::set<BaseInfo> knownAncestors; |
| 3897 | if (!ancestors) { |
| 3898 | ancestors=&knownAncestors; |
| 3899 | } |
| 3900 | for (auto parent=derivedFrom.cbegin(); parent!=derivedFrom.cend(); ++parent) { |
| 3901 | if (!parent->type) |
| 3902 | continue; |
| 3903 | if (this==parent->type) |
| 3904 | return true; |
| 3905 | if (ancestors->find(*parent)!=ancestors->end()) |
| 3906 | return true; |
| 3907 | |
| 3908 | ancestors->insert(*parent); |
| 3909 | if (parent->type->hasCircularDependencies(ancestors)) |
| 3910 | return true; |
| 3911 | } |
| 3912 | return false; |
| 3913 | } |
| 3914 | |
| 3915 | bool Type::findDependency(const Type* ancestor) const |
| 3916 | { |
no test coverage detected