MCPcopy Create free account
hub / github.com/Samsung/UTopia / createType

Method createType

lib/type/Type.cpp:24–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24std::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
50std::shared_ptr<Type> Type::createPrimitiveType(const clang::QualType &T,
51 const clang::ASTContext &Ctx) {

Callers

nothing calls this directly

Calls 5

isPointerTypeFunction · 0.85
isPrimitiveTypeFunction · 0.85
setASTTypeNameMethod · 0.80
getAsStringMethod · 0.45
setNameSpaceMethod · 0.45

Tested by

no test coverage detected