| 22 | } |
| 23 | |
| 24 | std::shared_ptr<Type> Type::createType(const clang::QualType &T, |
| 25 | const clang::ASTContext &ASTCtx, |
| 26 | llvm::Argument *A, |
| 27 | const TypeAnalysisReport *Report) { |
| 28 | std::shared_ptr<Type> Result = nullptr; |
| 29 | if (util::isPointerType(T)) { |
| 30 | Result = Type::createPointerType(T, ASTCtx, A, Report); |
| 31 | } else if (T->isEnumeralType()) { |
| 32 | Result = Type::createEnumType(T, ASTCtx, Report); |
| 33 | } else if (util::isPrimitiveType(T)) { |
| 34 | Result = Type::createPrimitiveType(T, ASTCtx); |
| 35 | } |
| 36 | if (!Result) |
| 37 | return nullptr; |
| 38 | |
| 39 | // Follow policy of target source but set Bool 1 to use 'bool' |
| 40 | auto PP = ASTCtx.getPrintingPolicy(); |
| 41 | PP.Bool = 1; |
| 42 | auto ASTTypeName = T.getAsString(PP); |
| 43 | if (const auto *ET = T->getAs<clang::ElaboratedType>()) |
| 44 | ASTTypeName = ET->desugar().getAsString(PP); |
| 45 | Result->setASTTypeName(ASTTypeName); |
| 46 | Result->setNameSpace(""); |
| 47 | return Result; |
| 48 | } |
| 49 | |
| 50 | std::shared_ptr<Type> Type::createPrimitiveType(const clang::QualType &T, |
| 51 | const clang::ASTContext &Ctx) { |
nothing calls this directly
no test coverage detected