| 67 | } |
| 68 | |
| 69 | std::shared_ptr<Type> Type::createEnumType(const clang::QualType &T, |
| 70 | const clang::ASTContext &Ctx, |
| 71 | const TypeAnalysisReport *Report) { |
| 72 | if (!T->isEnumeralType()) |
| 73 | return nullptr; |
| 74 | |
| 75 | auto *D = T->getAsTagDecl(); |
| 76 | if (!D) |
| 77 | return nullptr; |
| 78 | |
| 79 | auto Result = std::make_shared<Type>(Type::TypeID_Enum); |
| 80 | Result->setUnsigned(T->isUnsignedIntegerType()); |
| 81 | Result->setBoolean(T->isBooleanType()); |
| 82 | auto EnumName = D->getQualifiedNameAsString(); |
| 83 | if (auto *TD = D->getTypedefNameForAnonDecl()) |
| 84 | EnumName = TD->getQualifiedNameAsString(); |
| 85 | Result->setTypeName(EnumName); |
| 86 | if (Report) { |
| 87 | const auto &Enums = Report->getEnums(); |
| 88 | auto Iter = Enums.find(EnumName); |
| 89 | if (Iter != Enums.end()) |
| 90 | Result->setGlobalDef(Iter->second); |
| 91 | } |
| 92 | return Result; |
| 93 | } |
| 94 | |
| 95 | std::shared_ptr<Type> |
| 96 | Type::createPointerType(const clang::QualType &T, |
nothing calls this directly
no test coverage detected