@@ -40,7 +40,7 @@ namespace {
4040 Check64BitPortability instance;
4141}
4242
43- void Check64BitPortability ::pointerassignment ()
43+ void Check64BitPortabilityImpl ::pointerassignment ()
4444{
4545 if (!mSettings ->severity .isEnabled (Severity::portability))
4646 return ;
@@ -118,7 +118,7 @@ void Check64BitPortability::pointerassignment()
118118 }
119119}
120120
121- void Check64BitPortability ::assignmentAddressToIntegerError (const Token *tok)
121+ void Check64BitPortabilityImpl ::assignmentAddressToIntegerError (const Token *tok)
122122{
123123 reportError (tok, Severity::portability,
124124 " AssignmentAddressToInteger" ,
@@ -129,7 +129,7 @@ void Check64BitPortability::assignmentAddressToIntegerError(const Token *tok)
129129 " way is to store addresses only in pointer types (or typedefs like uintptr_t)." , CWE758, Certainty::normal);
130130}
131131
132- void Check64BitPortability ::assignmentIntegerToAddressError (const Token *tok)
132+ void Check64BitPortabilityImpl ::assignmentIntegerToAddressError (const Token *tok)
133133{
134134 reportError (tok, Severity::portability,
135135 " AssignmentIntegerToAddress" ,
@@ -140,7 +140,7 @@ void Check64BitPortability::assignmentIntegerToAddressError(const Token *tok)
140140 " way is to store addresses only in pointer types (or typedefs like uintptr_t)." , CWE758, Certainty::normal);
141141}
142142
143- void Check64BitPortability ::returnPointerError (const Token *tok)
143+ void Check64BitPortabilityImpl ::returnPointerError (const Token *tok)
144144{
145145 reportError (tok, Severity::portability,
146146 " CastAddressToIntegerAtReturn" ,
@@ -151,7 +151,7 @@ void Check64BitPortability::returnPointerError(const Token *tok)
151151 " to 32-bit integer. The safe way is to always return an integer." , CWE758, Certainty::normal);
152152}
153153
154- void Check64BitPortability ::returnIntegerError (const Token *tok)
154+ void Check64BitPortabilityImpl ::returnIntegerError (const Token *tok)
155155{
156156 reportError (tok, Severity::portability,
157157 " CastIntegerToAddressAtReturn" ,
@@ -161,3 +161,20 @@ void Check64BitPortability::returnIntegerError(const Token *tok)
161161 " and Linux they are of different width. In worst case you end up casting 64-bit integer down to 32-bit pointer. "
162162 " The safe way is to always return a pointer." , CWE758, Certainty::normal);
163163}
164+
165+
166+ /* * @brief Run checks against the normal token list */
167+ void Check64BitPortability::runChecks (const Tokenizer &tokenizer, ErrorLogger *errorLogger)
168+ {
169+ Check64BitPortabilityImpl c (&tokenizer, tokenizer.getSettings (), errorLogger);
170+ c.pointerassignment ();
171+ }
172+
173+ void Check64BitPortability::getErrorMessages (ErrorLogger *errorLogger, const Settings *settings) const
174+ {
175+ Check64BitPortabilityImpl c (nullptr , settings, errorLogger);
176+ c.assignmentAddressToIntegerError (nullptr );
177+ c.assignmentIntegerToAddressError (nullptr );
178+ c.returnIntegerError (nullptr );
179+ c.returnPointerError (nullptr );
180+ }
0 commit comments