Skip to content

Commit a3e4688

Browse files
committed
TemplateSimplifier: cleaned up member access
1 parent 9bc72eb commit a3e4688

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/templatesimplifier.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ class CPPCHECKLIB TemplateSimplifier {
265265
static Token *findTemplateDeclarationEnd(Token *tok);
266266
static const Token *findTemplateDeclarationEnd(const Token *tok);
267267

268+
protected:
268269
/**
269270
* Match template declaration/instantiation
270271
* @param instance template instantiation
@@ -275,6 +276,7 @@ class CPPCHECKLIB TemplateSimplifier {
275276
*/
276277
static bool instantiateMatch(const Token *instance, std::size_t numberOfArguments, bool variadic, const char patternAfter[]);
277278

279+
public: // TODO: only needs to be public for tests
278280
/**
279281
* Match template declaration/instantiation
280282
* @param tok The ">" token e.g. before "class"
@@ -283,6 +285,7 @@ class CPPCHECKLIB TemplateSimplifier {
283285
*/
284286
int getTemplateNamePosition(const Token *tok);
285287

288+
private:
286289
/**
287290
* Get class template name position
288291
* @param tok The ">" token e.g. before "class"
@@ -307,6 +310,7 @@ class CPPCHECKLIB TemplateSimplifier {
307310
* */
308311
static bool getTemplateNamePositionTemplateVariable(const Token *tok, int &namepos);
309312

313+
public:
310314
/**
311315
* Simplify templates
312316
* @param maxtime time when the simplification should be stopped
@@ -322,6 +326,7 @@ class CPPCHECKLIB TemplateSimplifier {
322326
*/
323327
static bool simplifyNumericCalculations(Token *tok, bool isTemplate = true);
324328

329+
private:
325330
/**
326331
* Simplify constant calculations such as "1+2" => "3".
327332
* This also performs simple cleanup of parentheses etc.
@@ -336,7 +341,6 @@ class CPPCHECKLIB TemplateSimplifier {
336341
*/
337342
void simplifyTemplateArgs(Token *start, const Token *end, std::vector<newInstantiation>* newInst = nullptr);
338343

339-
private:
340344
/**
341345
* Get template declarations
342346
* @return true if code has templates.

test/testsimplifytemplate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5956,7 +5956,7 @@ class TestSimplifyTemplate : public TestFixture {
59565956

59575957
ASSERT_LOC(tokenizer.tokenize(code), file, line);
59585958

5959-
return (TemplateSimplifier::instantiateMatch)(tokenizer.tokens(), numberOfArguments, false, patternAfter);
5959+
return (TemplateSimplifierTest::instantiateMatch)(tokenizer.tokens(), numberOfArguments, false, patternAfter);
59605960
}
59615961

59625962
void instantiateMatchTest() {

0 commit comments

Comments
 (0)