Static Value-Flow Analysis
SVFType.cpp
Go to the documentation of this file.
1 #include "SVFIR/SVFType.h"
2 #include <sstream>
3 
4 namespace SVF
5 {
6 
7 SVFType* SVFType::svfI8Ty = nullptr;
8 SVFType* SVFType::svfPtrTy = nullptr;
9 
12 {
13  std::ostringstream os;
14  print(os);
15  return os.str();
16 }
17 
18 std::ostream& operator<<(std::ostream& os, const SVFType& type)
19 {
20  type.print(os);
21  return os;
22 }
23 
24 void SVFPointerType::print(std::ostream& os) const
25 {
26  os << "ptr";
27 }
28 
29 void SVFIntegerType::print(std::ostream& os) const
30 {
31  if (signAndWidth < 0)
32  os << 'i' << -signAndWidth;
33  else
34  os << 'u' << signAndWidth;
35 }
36 
37 void SVFFunctionType::print(std::ostream& os) const
38 {
39  os << *getReturnType() << "()";
40 }
41 
42 void SVFStructType::print(std::ostream& os) const
43 {
44  os << "S." << name;
45 }
46 
47 void SVFArrayType::print(std::ostream& os) const
48 {
49  os << '[' << numOfElement << 'x' << *typeOfElement << ']';
50 }
51 
52 void SVFOtherType::print(std::ostream& os) const
53 {
54  os << repr;
55 }
56 
57 } // namespace SVF
newitem type
Definition: cJSON.cpp:2739
const char *const string
Definition: cJSON.h:172
const SVFType * typeOfElement
For printing & debugging.
Definition: SVFType.h:384
unsigned numOfElement
Definition: SVFType.h:383
void print(std::ostream &os) const override
Definition: SVFType.cpp:47
const SVFType * getReturnType() const
Definition: SVFType.h:336
void print(std::ostream &os) const override
Definition: SVFType.cpp:37
short signAndWidth
For printing.
Definition: SVFType.h:297
void print(std::ostream &os) const override
Definition: SVFType.cpp:29
void print(std::ostream &os) const override
Definition: SVFType.cpp:52
std::string repr
Definition: SVFType.h:423
void print(std::ostream &os) const override
Definition: SVFType.cpp:24
std::string name
Field for printing & debugging.
Definition: SVFType.h:351
void print(std::ostream &os) const override
Definition: SVFType.cpp:42
static SVFType * svfPtrTy
ptr type
Definition: SVFType.h:192
std::string toString() const
static SVFType * svfI8Ty
8-bit int type
Definition: SVFType.h:193
virtual void print(std::ostream &os) const =0
for isBitcode
Definition: BasicTypes.h:68
__attribute__((weak)) std
Definition: SVFType.cpp:10
IntervalValue operator<<(const IntervalValue &lhs, const IntervalValue &rhs)
Left binary shift of IntervalValues.