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

Method createPrimitiveType

lib/type/Type.cpp:50–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50std::shared_ptr<Type> Type::createPrimitiveType(const clang::QualType &T,
51 const clang::ASTContext &Ctx) {
52 // Only TypeSize of PrimitiveTypes is used when generating fuzzers.
53 // Sometimes segfault occurs when getting size of unknown types.
54 if (T->isIntegerType()) {
55 auto Result = std::make_shared<Type>(Type::TypeID_Integer);
56 Result->setUnsigned(T->isUnsignedIntegerType());
57 Result->setBoolean(T->isBooleanType());
58 Result->setAnyCharacter(T->isAnyCharacterType());
59 Result->setTypeSize(Ctx.getTypeSizeInChars(T).getQuantity());
60 return Result;
61 } else if (T->isFloatingType()) {
62 auto Result = std::make_shared<Type>(Type::TypeID_Float);
63 Result->setTypeSize(Ctx.getTypeSizeInChars(T).getQuantity());
64 return Result;
65 }
66 return nullptr;
67}
68
69std::shared_ptr<Type> Type::createEnumType(const clang::QualType &T,
70 const clang::ASTContext &Ctx,

Callers

nothing calls this directly

Calls 5

isIntegerTypeMethod · 0.80
setUnsignedMethod · 0.80
setBooleanMethod · 0.80
setAnyCharacterMethod · 0.80
setTypeSizeMethod · 0.80

Tested by

no test coverage detected