| 199 | } |
| 200 | |
| 201 | std::shared_ptr<Type> |
| 202 | DefMapGenerator::generateType(ASTDefNode &Node, |
| 203 | const TypeAnalysisReport &Report) const { |
| 204 | const auto *AN = Node.getNodeForType(); |
| 205 | if (!AN) |
| 206 | return nullptr; |
| 207 | |
| 208 | const auto &T = AN->getType(); |
| 209 | assert((T.getTypePtrOrNull() != nullptr) && "Unexpected Program State"); |
| 210 | |
| 211 | auto &Ctx = AN->getASTUnit().getASTContext(); |
| 212 | if (T->isVoidPointerType()) { |
| 213 | if (const auto *E = AN->getNode().get<Expr>()) { |
| 214 | E = E->IgnoreCasts(); |
| 215 | if (isa<StringLiteral>(E)) |
| 216 | return Type::createCharPointerType(); |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | auto Result = Type::createType(T, Ctx, nullptr, &Report); |
| 221 | if (!Result) |
| 222 | return nullptr; |
| 223 | return Result; |
| 224 | } |
| 225 | |
| 226 | ASTValue |
| 227 | DefMapGenerator::generateValue(ASTDefNode &Node, |
nothing calls this directly
no test coverage detected