File tree Expand file tree Collapse file tree 6 files changed +8
-17
lines changed Expand file tree Collapse file tree 6 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -567,8 +567,7 @@ namespace {
567567 // TODO: improve evaluation
568568 const Settings s;
569569 TokenList tokenlist (&s);
570- std::istringstream istr (c);
571- tokenlist.createTokens (istr, Standards::Language::C); // TODO: check result
570+ tokenlist.createTokens (c.data (), c.size (), Standards::Language::C); // TODO: check result
572571 // TODO: put in a helper
573572 // generate links
574573 {
Original file line number Diff line number Diff line change @@ -78,8 +78,7 @@ class SimpleTokenizer : public Tokenizer {
7878 bool cpp = true,
7979 const std::string &configuration = emptyString)
8080 {
81- std::istringstream istr (code);
82- if (!list.createTokens (istr, cpp ? " test.cpp" : " test.c" ))
81+ if (!list.createTokens (code, size-1 , cpp ? " test.cpp" : " test.c" ))
8382 return false ;
8483
8584 return simplifyTokens1 (configuration);
@@ -90,8 +89,7 @@ class SimpleTokenizer : public Tokenizer {
9089 bool cpp = true ,
9190 const std::string &configuration = emptyString)
9291 {
93- std::istringstream istr (code);
94- if (!list.createTokens (istr, cpp ? " test.cpp" : " test.c" ))
92+ if (!list.createTokens (code.c_str (), code.size (), cpp ? " test.cpp" : " test.c" ))
9593 return false ;
9694
9795 return simplifyTokens1 (configuration);
Original file line number Diff line number Diff line change 2727
2828#include < cstddef>
2929#include < list>
30- #include < sstream>
3130#include < string>
3231#include < vector>
3332
@@ -8904,9 +8903,8 @@ class TestClass : public TestFixture {
89048903 std::list<Check::FileInfo*> fileInfo;
89058904 for (const std::string& c: code) {
89068905 Tokenizer tokenizer (settingsDefault, *this );
8907- std::istringstream istr (c);
89088906 const std::string filename = std::to_string (fileInfo.size ()) + " .cpp" ;
8909- ASSERT (tokenizer.list .createTokens (istr , filename));
8907+ ASSERT (tokenizer.list .createTokens (c. data (), c. size () , filename));
89108908 ASSERT (tokenizer.simplifyTokens1 (" " ));
89118909 fileInfo.push_back (check.getFileInfo (tokenizer, settingsDefault));
89128910 }
Original file line number Diff line number Diff line change @@ -834,8 +834,7 @@ class TestTokenizer : public TestFixture {
834834 {
835835 Tokenizer tokenizer (settings1, *this );
836836 const char code[] = " void foo(int i) { reinterpret_cast<char>(i) };" ;
837- std::istringstream istr (code);
838- ASSERT (tokenizer.list .createTokens (istr, " test.h" ));
837+ ASSERT (tokenizer.list .createTokens (code, " test.h" ));
839838 ASSERT_THROW_INTERNAL (tokenizer.simplifyTokens1 (" " ), SYNTAX);
840839 }
841840 }
Original file line number Diff line number Diff line change @@ -164,11 +164,10 @@ class TestTokenList : public TestFixture {
164164 }
165165
166166 void ast1 () const {
167- const std::string s = " ('Release|x64' == 'Release|x64');" ;
167+ const char code[] = " ('Release|x64' == 'Release|x64');" ;
168168
169169 TokenList tokenlist (&settings);
170- std::istringstream istr (s);
171- tokenlist.createTokens (istr, Standards::Language::C);
170+ tokenlist.createTokens (code, Standards::Language::C);
172171 // TODO: put this logic in TokenList
173172 // generate links
174173 {
Original file line number Diff line number Diff line change 2626#include " tokenlist.h"
2727
2828#include < cstddef>
29- #include < sstream>
3029#include < string>
3130
3231class TestUnusedFunctions : public TestFixture {
@@ -560,8 +559,7 @@ class TestUnusedFunctions : public TestFixture {
560559 const std::string fname = " test" + std::to_string (i) + " .cpp" ;
561560
562561 Tokenizer tokenizer (settings, *this );
563- std::istringstream istr (code);
564- ASSERT (tokenizer.list .createTokens (istr, fname));
562+ ASSERT (tokenizer.list .createTokens (code, fname));
565563 ASSERT (tokenizer.simplifyTokens1 (" " ));
566564
567565 c.parseTokens (tokenizer, settings);
You can’t perform that action at this time.
0 commit comments