@@ -19,159 +19,179 @@ namespace psr {
1919
2020class ExtendedValue {
2121public:
22- ExtendedValue () {}
23- explicit ExtendedValue (const llvm::Value *_value ) : value(_value ) {
24- assert (value && " ExtendedValue requires an llvm::Value* object" );
22+ ExtendedValue () = default ;
23+ explicit ExtendedValue (const llvm::Value *Val ) : Val(Val ) {
24+ assert (Val && " ExtendedValue requires an llvm::Value* object" );
2525 }
2626 ~ExtendedValue () = default ;
2727
28- bool operator ==(const ExtendedValue &rhs ) const {
29- bool isValueEqual = value == rhs. value ;
30- if (!isValueEqual)
28+ bool operator ==(const ExtendedValue &Rhs ) const {
29+ bool IsValueEqual = Val == Rhs. Val ;
30+ if (!IsValueEqual) {
3131 return false ;
32+ }
3233
33- bool isMemLocationSeqEqual = memLocationSeq == rhs. memLocationSeq ;
34- if (!isMemLocationSeqEqual)
34+ bool IsMemLocationSeqEqual = MemLocationSeq == Rhs. MemLocationSeq ;
35+ if (!IsMemLocationSeqEqual) {
3536 return false ;
37+ }
3638
37- bool isEndOfTaintedBlockLabelEqual =
38- endOfTaintedBlockLabel == rhs. endOfTaintedBlockLabel ;
39- if (!isEndOfTaintedBlockLabelEqual)
39+ bool IsEndOfTaintedBlockLabelEqual =
40+ EndOfTaintedBlockLabel == Rhs. EndOfTaintedBlockLabel ;
41+ if (!IsEndOfTaintedBlockLabelEqual) {
4042 return false ;
43+ }
4144
42- bool isVaListMemLocationSeqEqual =
43- vaListMemLocationSeq == rhs. vaListMemLocationSeq ;
44- if (!isVaListMemLocationSeqEqual)
45+ bool IsVaListMemLocationSeqEqual =
46+ VaListMemLocationSeq == Rhs. VaListMemLocationSeq ;
47+ if (!IsVaListMemLocationSeqEqual) {
4548 return false ;
49+ }
4650
47- bool isVarArgIndexEqual = varArgIndex == rhs. varArgIndex ;
48- if (!isVarArgIndexEqual)
51+ bool IsVarArgIndexEqual = VarArgIndex == Rhs. VarArgIndex ;
52+ if (!IsVarArgIndexEqual) {
4953 return false ;
54+ }
5055
51- bool isCurrentVarArgIndexEqual =
52- currentVarArgIndex == rhs. currentVarArgIndex ;
53- if (!isCurrentVarArgIndexEqual)
56+ bool IsCurrentVarArgIndexEqual =
57+ CurrentVarArgIndex == Rhs. CurrentVarArgIndex ;
58+ if (!IsCurrentVarArgIndexEqual) {
5459 return false ;
60+ }
5561
5662 return true ;
5763 }
5864
59- bool operator <(const ExtendedValue &rhs ) const {
60- if (std::less<const llvm::Value *>{}(value, rhs. value ))
65+ bool operator <(const ExtendedValue &Rhs ) const {
66+ if (std::less<const llvm::Value *>{}(Val, Rhs. Val )) {
6167 return true ;
62- if (std::less<const llvm::Value *>{}(rhs.value , value))
68+ }
69+ if (std::less<const llvm::Value *>{}(Rhs.Val , Val)) {
6370 return false ;
71+ }
6472
65- if (memLocationSeq < rhs. memLocationSeq )
73+ if (MemLocationSeq < Rhs. MemLocationSeq ) {
6674 return true ;
67- if (rhs.memLocationSeq < memLocationSeq)
75+ }
76+ if (Rhs.MemLocationSeq < MemLocationSeq) {
6877 return false ;
78+ }
6979
70- if (std::less<std::string>{}(endOfTaintedBlockLabel ,
71- rhs. endOfTaintedBlockLabel ))
80+ if (std::less<std::string>{}(EndOfTaintedBlockLabel ,
81+ Rhs. EndOfTaintedBlockLabel )) {
7282 return true ;
73- if (std::less<std::string>{}(rhs.endOfTaintedBlockLabel ,
74- endOfTaintedBlockLabel))
83+ }
84+ if (std::less<std::string>{}(Rhs.EndOfTaintedBlockLabel ,
85+ EndOfTaintedBlockLabel)) {
7586 return false ;
87+ }
7688
77- if (vaListMemLocationSeq < rhs. vaListMemLocationSeq )
89+ if (VaListMemLocationSeq < Rhs. VaListMemLocationSeq ) {
7890 return true ;
79- if (rhs.vaListMemLocationSeq < vaListMemLocationSeq)
91+ }
92+ if (Rhs.VaListMemLocationSeq < VaListMemLocationSeq) {
8093 return false ;
94+ }
8195
82- if (std::less<long >{}(varArgIndex, rhs. varArgIndex ))
96+ if (std::less<long >{}(VarArgIndex, Rhs. VarArgIndex )) {
8397 return true ;
84- if (std::less<long >{}(rhs.varArgIndex , varArgIndex))
98+ }
99+ if (std::less<long >{}(Rhs.VarArgIndex , VarArgIndex)) {
85100 return false ;
101+ }
86102
87- return std::less<long >{}(currentVarArgIndex, rhs. currentVarArgIndex );
103+ return std::less<long >{}(CurrentVarArgIndex, Rhs. CurrentVarArgIndex );
88104 }
89105
90- const llvm::Value *getValue () const { return value ; }
106+ [[nodiscard]] const llvm::Value *getValue () const { return Val ; }
91107
92- const std::vector<const llvm::Value *> getMemLocationSeq () const {
93- return memLocationSeq ;
108+ [[nodiscard]] std::vector<const llvm::Value *> getMemLocationSeq () const {
109+ return MemLocationSeq ;
94110 }
95- void setMemLocationSeq (std::vector<const llvm::Value *> _memLocationSeq ) {
96- memLocationSeq = _memLocationSeq ;
111+ void setMemLocationSeq (const std::vector<const llvm::Value *> &MemLocationSeq ) {
112+ this -> MemLocationSeq = MemLocationSeq ;
97113 }
98114
99- const std::string getEndOfTaintedBlockLabel () const {
100- return endOfTaintedBlockLabel ;
115+ [[nodiscard]] std::string getEndOfTaintedBlockLabel () const {
116+ return EndOfTaintedBlockLabel ;
101117 }
102- void setEndOfTaintedBlockLabel (std::string _endOfTaintedBlockLabel ) {
103- endOfTaintedBlockLabel = _endOfTaintedBlockLabel ;
118+ void setEndOfTaintedBlockLabel (const std::string &EndOfTaintedBlockLabel ) {
119+ this -> EndOfTaintedBlockLabel = EndOfTaintedBlockLabel ;
104120 }
105121
106- const std::vector<const llvm::Value *> getVaListMemLocationSeq () const {
107- return vaListMemLocationSeq;
122+ [[nodiscard]] std::vector<const llvm::Value *>
123+ getVaListMemLocationSeq () const {
124+ return VaListMemLocationSeq;
108125 }
109126 void setVaListMemLocationSeq (
110- std::vector<const llvm::Value *> _vaListMemLocationSeq ) {
111- vaListMemLocationSeq = _vaListMemLocationSeq ;
127+ const std::vector<const llvm::Value *> &VaListMemLocationSeq ) {
128+ this -> VaListMemLocationSeq = VaListMemLocationSeq ;
112129 }
113130
114- long getVarArgIndex () const { return varArgIndex ; }
115- void setVarArgIndex (long _varArgIndex ) { varArgIndex = _varArgIndex ; }
131+ [[nodiscard]] long getVarArgIndex () const { return VarArgIndex ; }
132+ void setVarArgIndex (long VarArgIndex ) { this -> VarArgIndex = VarArgIndex ; }
116133
117134 void resetVarArgIndex () {
118- if (!isVarArgTemplate ())
119- varArgIndex = -1L ;
135+ if (!isVarArgTemplate ()) {
136+ VarArgIndex = -1L ;
137+ }
120138 }
121139
122- long getCurrentVarArgIndex () const { return currentVarArgIndex; }
140+ [[nodiscard]] long getCurrentVarArgIndex () const {
141+ return CurrentVarArgIndex;
142+ }
123143 void incrementCurrentVarArgIndex () {
124- if (!isVarArgTemplate ())
125- ++currentVarArgIndex;
144+ if (!isVarArgTemplate ()) {
145+ ++CurrentVarArgIndex;
146+ }
126147 }
127148
128- bool isVarArgTemplate () const {
129- return vaListMemLocationSeq.empty () && isVarArg ();
149+ [[nodiscard]] bool isVarArg () const { return VarArgIndex > -1L ; }
150+ [[nodiscard]] bool isVarArgTemplate () const {
151+ return VaListMemLocationSeq.empty () && isVarArg ();
130152 }
131153
132- [[nodiscard]] bool isVarArg () const { return varArgIndex > -1L ; }
133-
134154private:
135- const llvm::Value *value = nullptr ;
136- std::vector<const llvm::Value *> memLocationSeq ;
137- std::string endOfTaintedBlockLabel ;
155+ const llvm::Value *Val = nullptr ;
156+ std::vector<const llvm::Value *> MemLocationSeq ;
157+ std::string EndOfTaintedBlockLabel ;
138158
139- std::vector<const llvm::Value *> vaListMemLocationSeq ;
140- long varArgIndex = -1L ;
141- long currentVarArgIndex = -1L ;
159+ std::vector<const llvm::Value *> VaListMemLocationSeq ;
160+ long VarArgIndex = -1L ;
161+ long CurrentVarArgIndex = -1L ;
142162};
143163
144164} // namespace psr
145165
146166namespace std {
147167
148168template <> struct hash <psr::ExtendedValue> {
149- std::size_t operator ()(const psr::ExtendedValue &ev ) const {
150- std::size_t seed = 0x4711 ;
169+ std::size_t operator ()(const psr::ExtendedValue &Ev ) const {
170+ std::size_t Seed = 0x4711 ;
151171
152- seed ^= hash<const llvm::Value *>{}(ev .getValue ()) + 0x9e3779b9 +
153- (seed << 6 ) + (seed >> 2 );
172+ Seed ^= hash<const llvm::Value *>{}(Ev .getValue ()) + 0x9e3779b9 +
173+ (Seed << 6 ) + (Seed >> 2 );
154174
155- for (const auto &memLocationPart : ev .getMemLocationSeq ()) {
156- seed ^= hash<const llvm::Value *>{}(memLocationPart ) + 0x9e3779b9 +
157- (seed << 6 ) + (seed >> 2 );
175+ for (const auto &MemLocationPart : Ev .getMemLocationSeq ()) {
176+ Seed ^= hash<const llvm::Value *>{}(MemLocationPart ) + 0x9e3779b9 +
177+ (Seed << 6 ) + (Seed >> 2 );
158178 }
159179
160- seed ^= hash<string>{}(ev .getEndOfTaintedBlockLabel ()) + 0x9e3779b9 +
161- (seed << 6 ) + (seed >> 2 );
180+ Seed ^= hash<string>{}(Ev .getEndOfTaintedBlockLabel ()) + 0x9e3779b9 +
181+ (Seed << 6 ) + (Seed >> 2 );
162182
163- for (const auto &vaListMemLocationPart : ev .getVaListMemLocationSeq ()) {
164- seed ^= hash<const llvm::Value *>{}(vaListMemLocationPart ) + 0x9e3779b9 +
165- (seed << 6 ) + (seed >> 2 );
183+ for (const auto &VaListMemLocationPart : Ev .getVaListMemLocationSeq ()) {
184+ Seed ^= hash<const llvm::Value *>{}(VaListMemLocationPart ) + 0x9e3779b9 +
185+ (Seed << 6 ) + (Seed >> 2 );
166186 }
167187
168- seed ^= hash<long >{}(ev .getVarArgIndex ()) + 0x9e3779b9 + (seed << 6 ) +
169- (seed >> 2 );
188+ Seed ^= hash<long >{}(Ev .getVarArgIndex ()) + 0x9e3779b9 + (Seed << 6 ) +
189+ (Seed >> 2 );
170190
171- seed ^= hash<long >{}(ev .getCurrentVarArgIndex ()) + 0x9e3779b9 +
172- (seed << 6 ) + (seed >> 2 );
191+ Seed ^= hash<long >{}(Ev .getCurrentVarArgIndex ()) + 0x9e3779b9 +
192+ (Seed << 6 ) + (Seed >> 2 );
173193
174- return seed ;
194+ return Seed ;
175195 }
176196};
177197
0 commit comments