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 {
567
567
// TODO: improve evaluation
568
568
const Settings s;
569
569
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
572
571
// TODO: put in a helper
573
572
// generate links
574
573
{
Original file line number Diff line number Diff line change @@ -78,8 +78,7 @@ class SimpleTokenizer : public Tokenizer {
78
78
bool cpp = true,
79
79
const std::string &configuration = emptyString)
80
80
{
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" ))
83
82
return false ;
84
83
85
84
return simplifyTokens1 (configuration);
@@ -90,8 +89,7 @@ class SimpleTokenizer : public Tokenizer {
90
89
bool cpp = true ,
91
90
const std::string &configuration = emptyString)
92
91
{
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" ))
95
93
return false ;
96
94
97
95
return simplifyTokens1 (configuration);
Original file line number Diff line number Diff line change 27
27
28
28
#include < cstddef>
29
29
#include < list>
30
- #include < sstream>
31
30
#include < string>
32
31
#include < vector>
33
32
@@ -8904,9 +8903,8 @@ class TestClass : public TestFixture {
8904
8903
std::list<Check::FileInfo*> fileInfo;
8905
8904
for (const std::string& c: code) {
8906
8905
Tokenizer tokenizer (settingsDefault, *this );
8907
- std::istringstream istr (c);
8908
8906
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));
8910
8908
ASSERT (tokenizer.simplifyTokens1 (" " ));
8911
8909
fileInfo.push_back (check.getFileInfo (tokenizer, settingsDefault));
8912
8910
}
Original file line number Diff line number Diff line change @@ -834,8 +834,7 @@ class TestTokenizer : public TestFixture {
834
834
{
835
835
Tokenizer tokenizer (settings1, *this );
836
836
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" ));
839
838
ASSERT_THROW_INTERNAL (tokenizer.simplifyTokens1 (" " ), SYNTAX);
840
839
}
841
840
}
Original file line number Diff line number Diff line change @@ -164,11 +164,10 @@ class TestTokenList : public TestFixture {
164
164
}
165
165
166
166
void ast1 () const {
167
- const std::string s = " ('Release|x64' == 'Release|x64');" ;
167
+ const char code[] = " ('Release|x64' == 'Release|x64');" ;
168
168
169
169
TokenList tokenlist (&settings);
170
- std::istringstream istr (s);
171
- tokenlist.createTokens (istr, Standards::Language::C);
170
+ tokenlist.createTokens (code, Standards::Language::C);
172
171
// TODO: put this logic in TokenList
173
172
// generate links
174
173
{
Original file line number Diff line number Diff line change 26
26
#include " tokenlist.h"
27
27
28
28
#include < cstddef>
29
- #include < sstream>
30
29
#include < string>
31
30
32
31
class TestUnusedFunctions : public TestFixture {
@@ -560,8 +559,7 @@ class TestUnusedFunctions : public TestFixture {
560
559
const std::string fname = " test" + std::to_string (i) + " .cpp" ;
561
560
562
561
Tokenizer tokenizer (settings, *this );
563
- std::istringstream istr (code);
564
- ASSERT (tokenizer.list .createTokens (istr, fname));
562
+ ASSERT (tokenizer.list .createTokens (code, fname));
565
563
ASSERT (tokenizer.simplifyTokens1 (" " ));
566
564
567
565
c.parseTokens (tokenizer, settings);
You can’t perform that action at this time.
0 commit comments