Use 'Stringification => Tokenizer' until some issues have been fixed

This commit is contained in:
Daniel Marjamäki 2017-05-18 09:33:41 +02:00
parent 7bd0bc7534
commit c2727691a4
1 changed files with 8 additions and 6 deletions

View File

@ -284,11 +284,13 @@ unsigned int CppCheck::processFile(const std::string& filename, const std::strin
cfg = _settings.userDefines + cfg; cfg = _settings.userDefines + cfg;
} }
if (_settings.preprocessOnly) { std::string codeWithoutCfg;
{
Timer t("Preprocessor::getcode", _settings.showtime, &S_timerResults); Timer t("Preprocessor::getcode", _settings.showtime, &S_timerResults);
std::string codeWithoutCfg = preprocessor.getcode(tokens1, cfg, files, true); codeWithoutCfg = preprocessor.getcode(tokens1, cfg, files, true);
t.Stop(); }
if (_settings.preprocessOnly) {
if (codeWithoutCfg.compare(0,5,"#file") == 0) if (codeWithoutCfg.compare(0,5,"#file") == 0)
codeWithoutCfg.insert(0U, "//"); codeWithoutCfg.insert(0U, "//");
std::string::size_type pos = 0; std::string::size_type pos = 0;
@ -312,11 +314,11 @@ unsigned int CppCheck::processFile(const std::string& filename, const std::strin
bool result; bool result;
// Create tokens, skip rest of iteration if failed // Create tokens, skip rest of iteration if failed
std::istringstream istr(codeWithoutCfg);
Timer timer("Tokenizer::createTokens", _settings.showtime, &S_timerResults); Timer timer("Tokenizer::createTokens", _settings.showtime, &S_timerResults);
const simplecpp::TokenList &tokensP = preprocessor.preprocess(tokens1, cfg, files); result = _tokenizer.createTokens(istr, filename);
_tokenizer.createTokens(&tokensP);
timer.Stop(); timer.Stop();
if (tokensP.empty()) if (!result)
continue; continue;
// skip rest of iteration if just checking configuration // skip rest of iteration if just checking configuration