@@ -45,8 +45,6 @@ struct newInstantiation;
4545
4646/* * @brief Simplify templates from the preprocessed and partially simplified code. */
4747class CPPCHECKLIB TemplateSimplifier {
48- friend class TestSimplifyTemplate ;
49-
5048public:
5149 explicit TemplateSimplifier (Tokenizer &tokenizer);
5250
@@ -267,6 +265,7 @@ class CPPCHECKLIB TemplateSimplifier {
267265 static Token *findTemplateDeclarationEnd (Token *tok);
268266 static const Token *findTemplateDeclarationEnd (const Token *tok);
269267
268+ protected:
270269 /* *
271270 * Match template declaration/instantiation
272271 * @param instance template instantiation
@@ -277,6 +276,7 @@ class CPPCHECKLIB TemplateSimplifier {
277276 */
278277 static bool instantiateMatch (const Token *instance, std::size_t numberOfArguments, bool variadic, const char patternAfter[]);
279278
279+ public: // TODO: only needs to be public for tests
280280 /* *
281281 * Match template declaration/instantiation
282282 * @param tok The ">" token e.g. before "class"
@@ -285,6 +285,7 @@ class CPPCHECKLIB TemplateSimplifier {
285285 */
286286 int getTemplateNamePosition (const Token *tok);
287287
288+ private:
288289 /* *
289290 * Get class template name position
290291 * @param tok The ">" token e.g. before "class"
@@ -309,6 +310,7 @@ class CPPCHECKLIB TemplateSimplifier {
309310 * */
310311 static bool getTemplateNamePositionTemplateVariable (const Token *tok, int &namepos);
311312
313+ public:
312314 /* *
313315 * Simplify templates
314316 * @param maxtime time when the simplification should be stopped
@@ -324,6 +326,7 @@ class CPPCHECKLIB TemplateSimplifier {
324326 */
325327 static bool simplifyNumericCalculations (Token *tok, bool isTemplate = true );
326328
329+ private:
327330 /* *
328331 * Simplify constant calculations such as "1+2" => "3".
329332 * This also performs simple cleanup of parentheses etc.
@@ -338,7 +341,6 @@ class CPPCHECKLIB TemplateSimplifier {
338341 */
339342 void simplifyTemplateArgs (Token *start, const Token *end, std::vector<newInstantiation>* newInst = nullptr );
340343
341- private:
342344 /* *
343345 * Get template declarations
344346 * @return true if code has templates.
@@ -445,6 +447,7 @@ class CPPCHECKLIB TemplateSimplifier {
445447 const std::list<std::string> &typeStringsUsedInTemplateInstantiation,
446448 const std::string &newName);
447449
450+ protected:
448451 /* *
449452 * @brief TemplateParametersInDeclaration
450453 * @param tok template < typename T, typename S >
@@ -456,6 +459,7 @@ class CPPCHECKLIB TemplateSimplifier {
456459 const Token * tok,
457460 std::vector<const Token *> & typeParametersInDeclaration);
458461
462+ private:
459463 /* *
460464 * Remove a specific "template < ..." template class/function
461465 */
0 commit comments