File tree Expand file tree Collapse file tree 6 files changed +8
-15
lines changed Expand file tree Collapse file tree 6 files changed +8
-15
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 @@ -77,8 +77,7 @@ class SimpleTokenizer : public Tokenizer {
7777 bool cpp = true,
7878 const std::string &configuration = emptyString)
7979 {
80- std::istringstream istr (code);
81- if (!list.createTokens (istr, cpp ? " test.cpp" : " test.c" ))
80+ if (!list.createTokens (code, size-1 , cpp ? " test.cpp" : " test.c" ))
8281 return false ;
8382
8483 return simplifyTokens1 (configuration);
@@ -89,8 +88,7 @@ class SimpleTokenizer : public Tokenizer {
8988 bool cpp = true ,
9089 const std::string &configuration = emptyString)
9190 {
92- std::istringstream istr (code);
93- if (!list.createTokens (istr, cpp ? " test.cpp" : " test.c" ))
91+ if (!list.createTokens (code.c_str (), code.size (), cpp ? " test.cpp" : " test.c" ))
9492 return false ;
9593
9694 return simplifyTokens1 (configuration);
Original file line number Diff line number Diff line change 2626#include " tokenlist.h"
2727
2828#include < list>
29- #include < sstream>
3029#include < string>
3130#include < vector>
3231
@@ -8903,9 +8902,8 @@ class TestClass : public TestFixture {
89038902 std::list<Check::FileInfo*> fileInfo;
89048903 for (const std::string& c: code) {
89058904 Tokenizer tokenizer (settingsDefault, *this );
8906- std::istringstream istr (c);
89078905 const std::string filename = std::to_string (fileInfo.size ()) + " .cpp" ;
8908- ASSERT (tokenizer.list .createTokens (istr , filename));
8906+ ASSERT (tokenizer.list .createTokens (c. data (), c. size () , filename));
89098907 ASSERT (tokenizer.simplifyTokens1 (" " ));
89108908 fileInfo.push_back (check.getFileInfo (tokenizer, settingsDefault));
89118909 }
Original file line number Diff line number Diff line change @@ -831,8 +831,7 @@ class TestTokenizer : public TestFixture {
831831 {
832832 Tokenizer tokenizer (settings1, *this );
833833 const char code[] = " void foo(int i) { reinterpret_cast<char>(i) };" ;
834- std::istringstream istr (code);
835- ASSERT (tokenizer.list .createTokens (istr, " test.h" ));
834+ ASSERT (tokenizer.list .createTokens (code, " test.h" ));
836835 ASSERT_THROW_INTERNAL (tokenizer.simplifyTokens1 (" " ), SYNTAX);
837836 }
838837 }
Original file line number Diff line number Diff line change @@ -162,11 +162,10 @@ class TestTokenList : public TestFixture {
162162 }
163163
164164 void ast1 () const {
165- const std::string s = " ('Release|x64' == 'Release|x64');" ;
165+ const char code[] = " ('Release|x64' == 'Release|x64');" ;
166166
167167 TokenList tokenlist (&settings);
168- std::istringstream istr (s);
169- tokenlist.createTokens (istr, Standards::Language::C);
168+ tokenlist.createTokens (code, Standards::Language::C);
170169 // TODO: put this logic in TokenList
171170 // generate links
172171 {
Original file line number Diff line number Diff line change @@ -550,7 +550,7 @@ class TestUnusedFunctions : public TestFixture {
550550
551551 Tokenizer tokenizer (settings, *this );
552552 std::istringstream istr (code);
553- ASSERT (tokenizer.list .createTokens (istr , fname));
553+ ASSERT (tokenizer.list .createTokens (code , fname));
554554 ASSERT (tokenizer.simplifyTokens1 (" " ));
555555
556556 c.parseTokens (tokenizer, settings);
You can’t perform that action at this time.
0 commit comments