@@ -5904,9 +5904,9 @@ class TestTokenizer : public TestFixture {
59045904 Z3
59055905 };
59065906
5907- std::string testAst (const char code[], AstStyle style = AstStyle::Simple) const {
5907+ std::string testAst (const char code[], AstStyle style = AstStyle::Simple) {
59085908 // tokenize given code..
5909- Tokenizer tokenList (&settings0, nullptr );
5909+ Tokenizer tokenList (&settings0, this );
59105910 std::istringstream istr (code);
59115911 if (!tokenList.list .createTokens (istr," test.cpp" ))
59125912 return " ERROR" ;
@@ -5953,7 +5953,7 @@ class TestTokenizer : public TestFixture {
59535953 return ret;
59545954 }
59555955
5956- void astexpr () const { // simple expressions with arithmetical ops
5956+ void astexpr () { // simple expressions with arithmetical ops
59575957 ASSERT_EQUALS (" 12+3+" , testAst (" 1+2+3" ));
59585958 ASSERT_EQUALS (" 12*3+" , testAst (" 1*2+3" ));
59595959 ASSERT_EQUALS (" 123*+" , testAst (" 1+2*3" ));
@@ -6214,7 +6214,7 @@ class TestTokenizer : public TestFixture {
62146214 ASSERT_NO_THROW (tokenizeAndStringify (code));
62156215 }
62166216
6217- void astnewdelete () const {
6217+ void astnewdelete () {
62186218 ASSERT_EQUALS (" aintnew=" , testAst (" a = new int;" ));
62196219 ASSERT_EQUALS (" aint4[new=" , testAst (" a = new int[4];" ));
62206220 ASSERT_EQUALS (" aFoobar(new=" , testAst (" a = new Foo(bar);" ));
@@ -6438,15 +6438,15 @@ class TestTokenizer : public TestFixture {
64386438 " }\n " ));
64396439 }
64406440
6441- void astbrackets () const { // []
6441+ void astbrackets () { // []
64426442 ASSERT_EQUALS (" a23+[4+" , testAst (" a[2+3]+4" ));
64436443 ASSERT_EQUALS (" a1[0[" , testAst (" a[1][0]" ));
64446444 ASSERT_EQUALS (" ab0[=" , testAst (" a=(b)[0];" ));
64456445 ASSERT_EQUALS (" abc.0[=" , testAst (" a=b.c[0];" ));
64466446 ASSERT_EQUALS (" ab0[1[=" , testAst (" a=b[0][1];" ));
64476447 }
64486448
6449- void astvardecl () const {
6449+ void astvardecl () {
64506450 // Variable declaration
64516451 ASSERT_EQUALS (" a1[\"\" =" , testAst (" char a[1]=\"\" ;" ));
64526452 ASSERT_EQUALS (" charp*(3[char5[3[new=" , testAst (" char (*p)[3] = new char[5][3];" ));
@@ -6480,7 +6480,7 @@ class TestTokenizer : public TestFixture {
64806480 ASSERT_EQUALS (" i(j=" , testAst (" (int&)(i) = j;" ));
64816481 }
64826482
6483- void astunaryop () const { // unary operators
6483+ void astunaryop () { // unary operators
64846484 ASSERT_EQUALS (" 1a--+" , testAst (" 1 + --a" ));
64856485 ASSERT_EQUALS (" 1a--+" , testAst (" 1 + a--" ));
64866486 ASSERT_EQUALS (" ab+!" , testAst (" !(a+b)" ));
@@ -6506,7 +6506,7 @@ class TestTokenizer : public TestFixture {
65066506 ASSERT_EQUALS (" int0{1&return" , testAst (" int g() { return int{ 0 } & 1; }" ));
65076507 }
65086508
6509- void astfunction () const { // function calls
6509+ void astfunction () { // function calls
65106510 ASSERT_EQUALS (" 1f(+2+" , testAst (" 1+f()+2" ));
65116511 ASSERT_EQUALS (" 1f2(+3+" , testAst (" 1+f(2)+3" ));
65126512 ASSERT_EQUALS (" 1f23,(+4+" , testAst (" 1+f(2,3)+4" ));
@@ -6569,7 +6569,7 @@ class TestTokenizer : public TestFixture {
65696569 " }\n " ));
65706570 }
65716571
6572- void astcast () const {
6572+ void astcast () {
65736573 ASSERT_EQUALS (" ac&(=" , testAst (" a = (long)&c;" ));
65746574 ASSERT_EQUALS (" ac*(=" , testAst (" a = (Foo*)*c;" ));
65756575 ASSERT_EQUALS (" ac-(=" , testAst (" a = (long)-c;" ));
@@ -6742,14 +6742,14 @@ class TestTokenizer : public TestFixture {
67426742 ASSERT_EQUALS (" sf.{(i[{={" , testAst (" void g(int i) { S s{ .f = { [i]() {} } }; }" ));
67436743 }
67446744
6745- void astcase () const {
6745+ void astcase () {
67466746 ASSERT_EQUALS (" 0case" , testAst (" case 0:" ));
67476747 ASSERT_EQUALS (" 12+case" , testAst (" case 1+2:" ));
67486748 ASSERT_EQUALS (" xyz:?case" , testAst (" case (x?y:z):" ));
67496749 ASSERT_EQUALS (" switchx( 1case y++ 2case" , testAst (" switch(x){case 1:{++y;break;case 2:break;}}" ));
67506750 }
67516751
6752- void astrefqualifier () const {
6752+ void astrefqualifier () {
67536753 ASSERT_EQUALS (" b(int." , testAst (" class a { auto b() -> int&; };" ));
67546754 ASSERT_EQUALS (" b(int." , testAst (" class a { auto b() -> int&&; };" ));
67556755 ASSERT_EQUALS (" b(" , testAst (" class a { void b() &&; };" ));
@@ -6760,7 +6760,7 @@ class TestTokenizer : public TestFixture {
67606760
67616761 // Verify that returning a newly constructed object generates the correct AST even when the class name is scoped
67626762 // Addresses https://trac.cppcheck.net/ticket/9700
6763- void astnewscoped () const {
6763+ void astnewscoped () {
67646764 ASSERT_EQUALS (" (return (new A))" , testAst (" return new A;" , AstStyle::Z3));
67656765 ASSERT_EQUALS (" (return (new (( A)))" , testAst (" return new A();" , AstStyle::Z3));
67666766 ASSERT_EQUALS (" (return (new (( A true)))" , testAst (" return new A(true);" , AstStyle::Z3));
0 commit comments