svf-lib 1.0.1367 → 1.0.1369

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.
@@ -60,9 +60,8 @@ private:
60
60
 
61
61
  public:
62
62
  /// Constructor
63
- GenericEdge(NodeTy* s, NodeTy* d, GEdgeFlag k): src(s),dst(d), edgeFlag(k)
63
+ GenericEdge(NodeTy* s, NodeTy* d, GEdgeFlag k) : src(s), dst(d), edgeFlag(k)
64
64
  {
65
-
66
65
  }
67
66
 
68
67
  /// Destructor
@@ -116,8 +115,9 @@ public:
116
115
 
117
116
  virtual inline bool operator==(const GenericEdge<NodeType>* rhs) const
118
117
  {
119
- return (rhs->edgeFlag == this->edgeFlag && rhs->getSrcID() == this->getSrcID()
120
- && rhs->getDstID() == this->getDstID());
118
+ return (rhs->edgeFlag == this->edgeFlag &&
119
+ rhs->getSrcID() == this->getSrcID() &&
120
+ rhs->getDstID() == this->getDstID());
121
121
  }
122
122
  //@}
123
123
 
@@ -36,7 +36,6 @@
36
36
 
37
37
  #include <set>
38
38
  #include <vector>
39
- #include "SVF-LLVM/BasicTypes.h"
40
39
  #include "SVFIR/SVFValue.h"
41
40
 
42
41
  namespace SVF
@@ -77,7 +76,8 @@ public:
77
76
  /// Perform detection
78
77
  virtual void detect(SVFModule* module);
79
78
 
80
- void dump(Module &module, MHP *mhp, LockAnalysis *lsa);
79
+ // Not implemented for now
80
+ // void dump(Module &module, MHP *mhp, LockAnalysis *lsa);
81
81
 
82
82
  MHP* getMHP()
83
83
  {
@@ -9,7 +9,6 @@
9
9
  #define MTARESULTVALIDATOR_H_
10
10
 
11
11
  #include "MTA/MHP.h"
12
- #include "SVF-LLVM/LLVMUtil.h"
13
12
 
14
13
  /*!
15
14
  * Validate the result of context-sensitive analysis, including context-sensitive
@@ -31,11 +31,11 @@
31
31
  #define MTASTAT_H_
32
32
 
33
33
  #include "Util/PTAStat.h"
34
- #include "SVF-LLVM/BasicTypes.h"
35
34
 
36
35
  namespace SVF
37
36
  {
38
37
 
38
+ class Instruction;
39
39
  class ThreadCallGraph;
40
40
  class TCT;
41
41
  class MHP;
@@ -33,12 +33,16 @@
33
33
 
34
34
  #include "Graphs/GenericGraph.h"
35
35
  #include "MemoryModel/LocationSet.h"
36
- #include "Graphs/ICFGNode.h"
37
36
 
38
37
  namespace SVF
39
38
  {
40
39
 
41
40
  class SVFVar;
41
+ class ICFGNode;
42
+ class IntraICFGNode;
43
+ class CallICFGNode;
44
+ class FunEntryICFGNode;
45
+ class FunExitICFGNode;
42
46
 
43
47
  /*
44
48
  * SVFIR program statements (PAGEdges)
@@ -106,12 +110,9 @@ public:
106
110
  //@{
107
111
  inline const SVFInstruction* getInst() const
108
112
  {
109
- if(const SVFInstruction* i = SVFUtil::dyn_cast<SVFInstruction>(value))
110
- {
113
+ if (const SVFInstruction* i = SVFUtil::dyn_cast<SVFInstruction>(value))
111
114
  return i;
112
- }
113
- else
114
- return nullptr;
115
+ return nullptr;
115
116
  }
116
117
  inline void setValue(const SVFValue* val)
117
118
  {
@@ -172,7 +173,7 @@ public:
172
173
  //@}
173
174
  /// Overloading operator << for dumping SVFVar value
174
175
  //@{
175
- friend OutStream& operator<< (OutStream &o, const SVFStmt &edge)
176
+ friend OutStream& operator<<(OutStream& o, const SVFStmt& edge)
176
177
  {
177
178
  o << edge.toString();
178
179
  return o;
@@ -368,10 +369,7 @@ public:
368
369
  //@}
369
370
 
370
371
  /// constructor
371
- StoreStmt(SVFVar* s, SVFVar* d, const IntraICFGNode* st) :
372
- AssignStmt(s, d, makeEdgeFlagWithStoreInst(SVFStmt::Store, st))
373
- {
374
- }
372
+ StoreStmt(SVFVar* s, SVFVar* d, const IntraICFGNode* st);
375
373
 
376
374
  virtual const std::string toString() const override;
377
375
  };
@@ -514,10 +512,8 @@ public:
514
512
  //@}
515
513
 
516
514
  /// constructor
517
- CallPE(SVFVar* s, SVFVar* d, const CallICFGNode* i, const FunEntryICFGNode* e, GEdgeKind k = SVFStmt::Call) :
518
- AssignStmt(s,d,makeEdgeFlagWithCallInst(k,i)), call(i), entry(e)
519
- {
520
- }
515
+ CallPE(SVFVar* s, SVFVar* d, const CallICFGNode* i,
516
+ const FunEntryICFGNode* e, GEdgeKind k = SVFStmt::Call);
521
517
 
522
518
  /// Get method for the call instruction
523
519
  //@{
@@ -571,10 +567,8 @@ public:
571
567
  //@}
572
568
 
573
569
  /// constructor
574
- RetPE(SVFVar* s, SVFVar* d, const CallICFGNode* i, const FunExitICFGNode* e, GEdgeKind k = SVFStmt::Ret) :
575
- AssignStmt(s,d,makeEdgeFlagWithCallInst(k,i)), call(i), exit(e)
576
- {
577
- }
570
+ RetPE(SVFVar* s, SVFVar* d, const CallICFGNode* i, const FunExitICFGNode* e,
571
+ GEdgeKind k = SVFStmt::Ret);
578
572
 
579
573
  /// Get method for call instruction at caller
580
574
  //@{
@@ -614,9 +608,7 @@ private:
614
608
  protected:
615
609
  OPVars opVars;
616
610
  /// Constructor, only used by subclassess but not external users
617
- MultiOpndStmt(SVFVar* r, const OPVars& opnds, GEdgeFlag k): SVFStmt(opnds.at(0), r, k), opVars(opnds)
618
- {
619
- }
611
+ MultiOpndStmt(SVFVar* r, const OPVars& opnds, GEdgeFlag k);
620
612
  public:
621
613
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
622
614
  //@{
@@ -768,10 +760,7 @@ public:
768
760
  //@}
769
761
 
770
762
  /// constructor
771
- SelectStmt(SVFVar* s, const OPVars& opnds, const SVFVar* cond) : MultiOpndStmt(s,opnds,makeEdgeFlagWithAddionalOpnd(SVFStmt::Select,opnds.at(1))), condition(cond)
772
- {
773
- assert(opnds.size()==2 && "SelectStmt can only have two operands!");
774
- }
763
+ SelectStmt(SVFVar* s, const OPVars& opnds, const SVFVar* cond);
775
764
  virtual const std::string toString() const override;
776
765
 
777
766
  inline const SVFVar* getCondition() const
@@ -860,10 +849,7 @@ public:
860
849
  //@}
861
850
 
862
851
  /// constructor
863
- CmpStmt(SVFVar* s, const OPVars& opnds, u32_t pre) : MultiOpndStmt(s,opnds,makeEdgeFlagWithAddionalOpnd(SVFStmt::Cmp,opnds.at(1))), predicate(pre)
864
- {
865
- assert(opnds.size()==2 && "CmpStmt can only have two operands!");
866
- }
852
+ CmpStmt(SVFVar* s, const OPVars& opnds, u32_t pre);
867
853
 
868
854
  u32_t getPredicate() const
869
855
  {
@@ -914,10 +900,7 @@ public:
914
900
  //@}
915
901
 
916
902
  /// constructor
917
- BinaryOPStmt(SVFVar* s, const OPVars& opnds, u32_t oc) : MultiOpndStmt(s,opnds,makeEdgeFlagWithAddionalOpnd(SVFStmt::BinaryOp,opnds.at(1))), opcode(oc)
918
- {
919
- assert(opnds.size()==2 && "BinaryOPStmt can only have two operands!");
920
- }
903
+ BinaryOPStmt(SVFVar* s, const OPVars& opnds, u32_t oc);
921
904
 
922
905
  u32_t getOpcode() const
923
906
  {
@@ -943,6 +926,12 @@ private:
943
926
 
944
927
  u32_t opcode;
945
928
  public:
929
+ /// OpCode for UnaryOPStmt, enum value is same to llvm::UnaryOperator
930
+ enum OpCode : unsigned
931
+ {
932
+ FNeg = 12
933
+ };
934
+
946
935
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
947
936
  //@{
948
937
  static inline bool classof(const UnaryOPStmt *)
@@ -256,7 +256,7 @@ public:
256
256
  std::vector<std::string> operandStr;
257
257
  std::vector<NodeID> operands;
258
258
  };
259
- static ExtAPI *getExtAPI(const std::string & = "");
259
+ static ExtAPI *getExtAPI(const std::string& = "");
260
260
 
261
261
  static void destory();
262
262
 
@@ -264,7 +264,7 @@ public:
264
264
  void add_entry(const char* funName, extType type, bool overwrite_app_function);
265
265
 
266
266
  // Get numeric index of the argument in external function
267
- u32_t getArgPos(std::string s);
267
+ u32_t getArgPos(const std::string& s);
268
268
 
269
269
  // return value >= 0 is an argument node
270
270
  // return value = -1 is an inst node
@@ -272,7 +272,7 @@ public:
272
272
  // return value = -3 is an object node
273
273
  // return value = -4 is an offset
274
274
  // return value = -5 is an illegal operand format
275
- s32_t getNodeIDType(std::string s);
275
+ s32_t getNodeIDType(const std::string& s);
276
276
 
277
277
  // Get the corresponding name in ext_t, e.g. "EXT_ADDR" in {"addr", EXT_ADDR},
278
278
  std::string get_opName(const std::string& s);
Binary file
@@ -387,10 +387,8 @@ public:
387
387
  bool operator<(const IntervalExeState &rhs) const
388
388
  {
389
389
  // judge from path constraint
390
- if (lessThanVarToValMap(_varToItvVal, rhs.getVarToVal()) ||
391
- lessThanVarToValMap(_locToItvVal, rhs.getLocToVal()))
392
- return true;
393
- return false;
390
+ return (lessThanVarToValMap(_varToItvVal, rhs.getVarToVal()) ||
391
+ lessThanVarToValMap(_locToItvVal, rhs.getLocToVal()));
394
392
  }
395
393
 
396
394
 
@@ -480,9 +480,7 @@ protected:
480
480
  /// If the points-to contain the object obj, we could move forward along indirect value-flow edge
481
481
  virtual inline bool propagateViaObj(const CVar& storeObj, const CVar& loadObj)
482
482
  {
483
- if(getPtrNodeID(storeObj) == getPtrNodeID(loadObj))
484
- return true;
485
- return false;
483
+ return getPtrNodeID(storeObj) == getPtrNodeID(loadObj);
486
484
  }
487
485
  /// resolve function pointer
488
486
  void resolveFunPtr(const DPIm& dpm)
@@ -384,9 +384,7 @@ private:
384
384
  {
385
385
  tgrlockset.erase(*it);
386
386
  }
387
- if(!toBeDeleted.empty())
388
- return true;
389
- return false;
387
+ return !toBeDeleted.empty();
390
388
  }
391
389
 
392
390
  /// Clear flags
@@ -342,18 +342,14 @@ public:
342
342
  {
343
343
  bool nonhp = HBPair.find(std::make_pair(tid1,tid2))!=HBPair.end();
344
344
  bool hp = HPPair.find(std::make_pair(tid1,tid2))!=HPPair.end();
345
- if(nonhp && !hp)
346
- return true;
347
- return false;
345
+ return nonhp && !hp;
348
346
  }
349
347
  /// Whether t1 fully joins t2
350
348
  inline bool isFullJoin(NodeID tid1, NodeID tid2)
351
349
  {
352
350
  bool full = fullJoin.find(std::make_pair(tid1,tid2))!=fullJoin.end();
353
351
  bool partial = partialJoin.find(std::make_pair(tid1,tid2))!=partialJoin.end();
354
- if(full && !partial)
355
- return true;
356
- return false;
352
+ return full && !partial;
357
353
  }
358
354
 
359
355
  /// Get exit instruction of the start routine function of tid's parent thread
@@ -360,11 +360,14 @@ public:
360
360
 
361
361
  private:
362
362
  // Convert string to boolean, returning whether we succeeded.
363
- static bool fromString(const std::string s, bool &value)
363
+ static bool fromString(const std::string& s, bool& value)
364
364
  {
365
- if (s == "true") value = true;
366
- else if (s == "false") value = false;
367
- else return false;
365
+ if (s == "true")
366
+ value = true;
367
+ else if (s == "false")
368
+ value = false;
369
+ else
370
+ return false;
368
371
  return true;
369
372
  }
370
373
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1367",
3
+ "version": "1.0.1369",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {