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

Function getTypeStr

lib/propanalysis/ArgFlow.cpp:15–71  ·  view source on GitHub ↗

ref: http://llvm.org/doxygen/AsmWriter_8cpp_source.html#l00446 Write the specified type to the specified raw_ostream, making use of type names or up references to shorten the type name where possible.

Source from the content-addressed store, hash-verified

13/// Write the specified type to the specified raw_ostream, making use of type
14/// names or up references to shorten the type name where possible.
15llvm::StringRef getTypeStr(llvm::Type *Ty) {
16 if (!Ty)
17 return "";
18
19 switch (Ty->getTypeID()) {
20 case llvm::Type::VoidTyID:
21 return "void";
22 case llvm::Type::HalfTyID:
23 return "half";
24 case llvm::Type::FloatTyID:
25 return "float";
26 case llvm::Type::DoubleTyID:
27 return "double";
28 case llvm::Type::X86_FP80TyID:
29 return "x86_fp80";
30 case llvm::Type::FP128TyID:
31 return "fp128";
32 case llvm::Type::PPC_FP128TyID:
33 return "ppc_fp128";
34 case llvm::Type::LabelTyID:
35 return "label";
36 case llvm::Type::MetadataTyID:
37 return "metadata";
38 case llvm::Type::X86_MMXTyID:
39 return "x86_mmx";
40 case llvm::Type::TokenTyID:
41 return "token";
42 case llvm::Type::IntegerTyID:
43 return "int";
44 case llvm::Type::FunctionTyID:
45 return "function";
46 case llvm::Type::StructTyID: {
47 llvm::StructType *STy = llvm::cast<llvm::StructType>(Ty);
48 if (!STy->getName().empty()) {
49 return STy->getName();
50 }
51 return "struct";
52 }
53 case llvm::Type::ArrayTyID:
54 return "array";
55#if LLVM_VERSION_MAJOR >= 12
56 case llvm::Type::FixedVectorTyID:
57 case llvm::Type::ScalableVectorTyID:
58#else
59 case llvm::Type::VectorTyID:
60#endif
61 {
62 return "vector";
63 }
64 case llvm::Type::PointerTyID: {
65 llvm::PointerType *PTy = llvm::cast<llvm::PointerType>(Ty);
66 return getTypeStr(PTy->getElementType());
67 }
68 default:
69 return "";
70 }
71}
72

Callers 1

isUnionFieldAccessFunction · 0.85

Calls 2

emptyMethod · 0.80
getNameMethod · 0.45

Tested by

no test coverage detected