| 144 | } |
| 145 | |
| 146 | optional<StructurePtr> try_find_struct(const string &name) { |
| 147 | if (state.program != nullptr) { |
| 148 | const auto library = state.program->library; |
| 149 | auto structs = state.program->findStructure(name); |
| 150 | auto aliases = state.program->findAlias(name); |
| 151 | if (!structs.empty()) { |
| 152 | assert(structs.size() == 1); |
| 153 | assert(aliases.empty()); |
| 154 | return structs.front(); |
| 155 | } else if (!aliases.empty()) { |
| 156 | assert(aliases.size() == 1); |
| 157 | } |
| 158 | } |
| 159 | return std::nullopt; |
| 160 | } |
| 161 | |
| 162 | bool can_default_init(const string &name) { |
| 163 | auto maybe_struct = try_find_struct(name); |
no test coverage detected