@@ -19,159 +19,180 @@ 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
112+ setMemLocationSeq (const std::vector<const llvm::Value *> &MemLocationSeq) {
113+ this ->MemLocationSeq = MemLocationSeq;
97114 }
98115
99- const std::string getEndOfTaintedBlockLabel () const {
100- return endOfTaintedBlockLabel ;
116+ [[nodiscard]] std::string getEndOfTaintedBlockLabel () const {
117+ return EndOfTaintedBlockLabel ;
101118 }
102- void setEndOfTaintedBlockLabel (std::string _endOfTaintedBlockLabel ) {
103- endOfTaintedBlockLabel = _endOfTaintedBlockLabel ;
119+ void setEndOfTaintedBlockLabel (const std::string &EndOfTaintedBlockLabel ) {
120+ this -> EndOfTaintedBlockLabel = EndOfTaintedBlockLabel ;
104121 }
105122
106- const std::vector<const llvm::Value *> getVaListMemLocationSeq () const {
107- return vaListMemLocationSeq;
123+ [[nodiscard]] std::vector<const llvm::Value *>
124+ getVaListMemLocationSeq () const {
125+ return VaListMemLocationSeq;
108126 }
109127 void setVaListMemLocationSeq (
110- std::vector<const llvm::Value *> _vaListMemLocationSeq ) {
111- vaListMemLocationSeq = _vaListMemLocationSeq ;
128+ const std::vector<const llvm::Value *> &VaListMemLocationSeq ) {
129+ this -> VaListMemLocationSeq = VaListMemLocationSeq ;
112130 }
113131
114- long getVarArgIndex () const { return varArgIndex ; }
115- void setVarArgIndex (long _varArgIndex ) { varArgIndex = _varArgIndex ; }
132+ [[nodiscard]] long getVarArgIndex () const { return VarArgIndex ; }
133+ void setVarArgIndex (long VarArgIndex ) { this -> VarArgIndex = VarArgIndex ; }
116134
117135 void resetVarArgIndex () {
118- if (!isVarArgTemplate ())
119- varArgIndex = -1L ;
136+ if (!isVarArgTemplate ()) {
137+ VarArgIndex = -1L ;
138+ }
120139 }
121140
122- long getCurrentVarArgIndex () const { return currentVarArgIndex; }
141+ [[nodiscard]] long getCurrentVarArgIndex () const {
142+ return CurrentVarArgIndex;
143+ }
123144 void incrementCurrentVarArgIndex () {
124- if (!isVarArgTemplate ())
125- ++currentVarArgIndex;
145+ if (!isVarArgTemplate ()) {
146+ ++CurrentVarArgIndex;
147+ }
126148 }
127149
128- bool isVarArgTemplate () const {
129- return vaListMemLocationSeq.empty () && isVarArg ();
150+ [[nodiscard]] bool isVarArg () const { return VarArgIndex > -1L ; }
151+ [[nodiscard]] bool isVarArgTemplate () const {
152+ return VaListMemLocationSeq.empty () && isVarArg ();
130153 }
131154
132- [[nodiscard]] bool isVarArg () const { return varArgIndex > -1L ; }
133-
134155private:
135- const llvm::Value *value = nullptr ;
136- std::vector<const llvm::Value *> memLocationSeq ;
137- std::string endOfTaintedBlockLabel ;
156+ const llvm::Value *Val = nullptr ;
157+ std::vector<const llvm::Value *> MemLocationSeq ;
158+ std::string EndOfTaintedBlockLabel ;
138159
139- std::vector<const llvm::Value *> vaListMemLocationSeq ;
140- long varArgIndex = -1L ;
141- long currentVarArgIndex = -1L ;
160+ std::vector<const llvm::Value *> VaListMemLocationSeq ;
161+ long VarArgIndex = -1L ;
162+ long CurrentVarArgIndex = -1L ;
142163};
143164
144165} // namespace psr
145166
146167namespace std {
147168
148169template <> struct hash <psr::ExtendedValue> {
149- std::size_t operator ()(const psr::ExtendedValue &ev ) const {
150- std::size_t seed = 0x4711 ;
170+ std::size_t operator ()(const psr::ExtendedValue &Ev ) const {
171+ std::size_t Seed = 0x4711 ;
151172
152- seed ^= hash<const llvm::Value *>{}(ev .getValue ()) + 0x9e3779b9 +
153- (seed << 6 ) + (seed >> 2 );
173+ Seed ^= hash<const llvm::Value *>{}(Ev .getValue ()) + 0x9e3779b9 +
174+ (Seed << 6 ) + (Seed >> 2 );
154175
155- for (const auto &memLocationPart : ev .getMemLocationSeq ()) {
156- seed ^= hash<const llvm::Value *>{}(memLocationPart ) + 0x9e3779b9 +
157- (seed << 6 ) + (seed >> 2 );
176+ for (const auto &MemLocationPart : Ev .getMemLocationSeq ()) {
177+ Seed ^= hash<const llvm::Value *>{}(MemLocationPart ) + 0x9e3779b9 +
178+ (Seed << 6 ) + (Seed >> 2 );
158179 }
159180
160- seed ^= hash<string>{}(ev .getEndOfTaintedBlockLabel ()) + 0x9e3779b9 +
161- (seed << 6 ) + (seed >> 2 );
181+ Seed ^= hash<string>{}(Ev .getEndOfTaintedBlockLabel ()) + 0x9e3779b9 +
182+ (Seed << 6 ) + (Seed >> 2 );
162183
163- for (const auto &vaListMemLocationPart : ev .getVaListMemLocationSeq ()) {
164- seed ^= hash<const llvm::Value *>{}(vaListMemLocationPart ) + 0x9e3779b9 +
165- (seed << 6 ) + (seed >> 2 );
184+ for (const auto &VaListMemLocationPart : Ev .getVaListMemLocationSeq ()) {
185+ Seed ^= hash<const llvm::Value *>{}(VaListMemLocationPart ) + 0x9e3779b9 +
186+ (Seed << 6 ) + (Seed >> 2 );
166187 }
167188
168- seed ^= hash<long >{}(ev .getVarArgIndex ()) + 0x9e3779b9 + (seed << 6 ) +
169- (seed >> 2 );
189+ Seed ^= hash<long >{}(Ev .getVarArgIndex ()) + 0x9e3779b9 + (Seed << 6 ) +
190+ (Seed >> 2 );
170191
171- seed ^= hash<long >{}(ev .getCurrentVarArgIndex ()) + 0x9e3779b9 +
172- (seed << 6 ) + (seed >> 2 );
192+ Seed ^= hash<long >{}(Ev .getCurrentVarArgIndex ()) + 0x9e3779b9 +
193+ (Seed << 6 ) + (Seed >> 2 );
173194
174- return seed ;
195+ return Seed ;
175196 }
176197};
177198
0 commit comments