svf-lib 1.0.1047 → 1.0.1050

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,6 +58,7 @@ typedef llvm::ConstantExpr ConstantExpr;
58
58
  typedef llvm::ConstantDataArray ConstantDataArray;
59
59
  typedef llvm::ConstantData ConstantData;
60
60
  typedef llvm::ConstantArray ConstantArray;
61
+ typedef llvm::Constant Constant;
61
62
 
62
63
  // LLVM Instructions
63
64
  typedef llvm::AllocaInst AllocaInst;
@@ -91,7 +91,6 @@ typedef llvm::FunctionType FunctionType;
91
91
 
92
92
  /// LLVM Aliases and constants
93
93
  typedef llvm::Argument Argument;
94
- typedef llvm::Constant Constant;
95
94
  typedef llvm::ConstantInt ConstantInt;
96
95
  typedef llvm::ConstantPointerNull ConstantPointerNull;
97
96
  typedef llvm::GlobalAlias GlobalAlias;
@@ -0,0 +1,118 @@
1
+ //===- SymState.h -- Symbolic State----------------------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-2017> <Yulei Sui>
6
+ //
7
+
8
+ // This program is free software: you can redistribute it and/or modify
9
+ // it under the terms of the GNU General Public License as published by
10
+ // the Free Software Foundation, either version 3 of the License, or
11
+ // (at your option) any later version.
12
+
13
+ // This program is distributed in the hope that it will be useful,
14
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ // GNU General Public License for more details.
17
+
18
+ // You should have received a copy of the GNU General Public License
19
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ //
21
+ //===----------------------------------------------------------------------===//
22
+
23
+ /*
24
+ * SymState.h
25
+ *
26
+ * Created on: 2022/6/21
27
+ * Author: Xiao Cheng
28
+ */
29
+
30
+ #ifndef SVF_SYMSTATE_H
31
+ #define SVF_SYMSTATE_H
32
+
33
+ #include "ExeState.h"
34
+
35
+ namespace SVF
36
+ {
37
+ class SymState
38
+ {
39
+ public:
40
+ typedef std::string AbstractState;
41
+
42
+ SymState(const ExeState &_es, const AbstractState &_as) : exeState(_es), absState(_as)
43
+ {
44
+
45
+ }
46
+
47
+ virtual ~SymState()
48
+ {
49
+
50
+ }
51
+
52
+ SymState(const SymState &symState) : absState(symState.getAbstractState()),
53
+ exeState(symState.getExecutionState())
54
+ {
55
+ }
56
+
57
+
58
+ const AbstractState& getAbstractState() const
59
+ {
60
+ return absState;
61
+ }
62
+
63
+ const ExeState& getExecutionState() const
64
+ {
65
+ return exeState;
66
+ }
67
+
68
+ SymState &operator=(const SymState &rhs)
69
+ {
70
+ if (*this != rhs)
71
+ {
72
+ exeState = rhs.getExecutionState();
73
+ absState = rhs.getAbstractState();
74
+ }
75
+ return *this;
76
+ }
77
+
78
+ /// Overloading Operator==
79
+ inline bool operator==(const SymState &rhs) const
80
+ {
81
+ return absState == rhs.getAbstractState() && exeState = rhs.getExecutionState();
82
+ }
83
+
84
+ /// Overloading Operator!=
85
+ inline bool operator!=(const SymState &rhs) const
86
+ {
87
+ return !(*this == rhs);
88
+ }
89
+
90
+ /// Overloading Operator==
91
+ inline bool operator<(const SymState &rhs) const
92
+ {
93
+ if (absState != rhs.getAbstractState())
94
+ return absState < rhs.getAbstractState();
95
+ if (exeState != rhs.getExecutionState())
96
+ return exeState < rhs.getExecutionState();
97
+ return false;
98
+ }
99
+
100
+ private:
101
+ ExeState exeState;
102
+ AbstractState absState;
103
+ };
104
+ }
105
+
106
+ template<>
107
+ struct std::hash<SVF::SymState>
108
+ {
109
+ size_t operator()(const SVF::SymState &symState) const
110
+ {
111
+
112
+ SVF::Hash<std::pair<SVF::AbstractState, SVF::ExeState>> pairH;
113
+
114
+ return pairH(make_pair(symState.getAbstractState(), symState.getExecutionState()));
115
+ }
116
+ };
117
+
118
+ #endif //SVF_SYMSTATE_H
Binary file
@@ -341,7 +341,7 @@ public:
341
341
  NodeID parentTid = tct->getParentThread(tid);
342
342
  const CxtThread& parentct = tct->getTCTNode(parentTid)->getCxtThread();
343
343
  const Function* parentRoutine = tct->getStartRoutineOfCxtThread(parentct);
344
- return &(SVFUtil::getFunExitBB(parentRoutine)->back());
344
+ return &(LLVMUtil::getFunExitBB(parentRoutine)->back());
345
345
  }
346
346
 
347
347
  /// Get loop for join site
@@ -40,7 +40,7 @@
40
40
  namespace SVF
41
41
  {
42
42
 
43
- namespace SVFUtil
43
+ namespace LLVMUtil
44
44
  {
45
45
 
46
46
 
@@ -86,9 +86,9 @@ inline const PointerType *getRefTypeOfHeapAllocOrStatic(const CallSite cs)
86
86
  {
87
87
  const PointerType *refType = nullptr;
88
88
  // Case 1: heap object held by *argument, we should get its element type.
89
- if (isHeapAllocExtCallViaArg(cs))
89
+ if (SVFUtil::isHeapAllocExtCallViaArg(cs))
90
90
  {
91
- int argPos = getHeapAllocHoldingArgPosition(cs);
91
+ int argPos = SVFUtil::getHeapAllocHoldingArgPosition(cs);
92
92
  const Value *arg = cs.getArgument(argPos);
93
93
  if (const PointerType *argType = SVFUtil::dyn_cast<PointerType>(arg->getType()))
94
94
  refType = SVFUtil::dyn_cast<PointerType>(getPtrElementType(argType));
@@ -96,7 +96,7 @@ inline const PointerType *getRefTypeOfHeapAllocOrStatic(const CallSite cs)
96
96
  // Case 2: heap/static object held by return value.
97
97
  else
98
98
  {
99
- assert((isStaticExtCall(cs) || isHeapAllocExtCallViaRet(cs))
99
+ assert((SVFUtil::isStaticExtCall(cs) || SVFUtil::isHeapAllocExtCallViaRet(cs))
100
100
  && "Must be heap alloc via ret, or static allocation site");
101
101
  refType = SVFUtil::dyn_cast<PointerType>(cs.getType());
102
102
  }
@@ -132,7 +132,7 @@ inline bool ArgInDeadFunction (const Value * val)
132
132
  inline bool ArgInProgEntryFunction (const Value * val)
133
133
  {
134
134
  return SVFUtil::isa<Argument>(val)
135
- && isProgEntryFunction(SVFUtil::cast<Argument>(val)->getParent());
135
+ && SVFUtil::isProgEntryFunction(SVFUtil::cast<Argument>(val)->getParent());
136
136
  }
137
137
  /// Return true if this is value in a dead function (function without any caller)
138
138
  bool isPtrInDeadFunction (const Value * value);
@@ -145,7 +145,7 @@ bool isPtrInDeadFunction (const Value * value);
145
145
  /// Return true if the function does not have a caller (either it is a main function or a dead function)
146
146
  inline bool isNoCallerFunction (const Function * fun)
147
147
  {
148
- return isDeadFunction(fun) || isProgEntryFunction(fun);
148
+ return isDeadFunction(fun) || SVFUtil::isProgEntryFunction(fun);
149
149
  }
150
150
 
151
151
  /// Return true if the argument in a function does not have a caller
@@ -315,7 +315,7 @@ u32_t getTypeSizeInBytes(const StructType *sty, u32_t field_index);
315
315
  //@}
316
316
 
317
317
 
318
- } // End namespace SVFUtil
318
+ } // End namespace LLVMUtil
319
319
 
320
320
  } // End namespace SVF
321
321
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1047",
3
+ "version": "1.0.1050",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {