Try to fix windows build. Reduce header dependencies

This commit is contained in:
Daniel Marjamäki 2017-05-17 15:38:31 +02:00
parent 90a952d8c2
commit 59335f80d2
5 changed files with 18 additions and 10 deletions

View File

@ -312,7 +312,8 @@ unsigned int CppCheck::processFile(const std::string& filename, const std::strin
// Create tokens, skip rest of iteration if failed
Timer timer("Tokenizer::createTokens", _settings.showtime, &S_timerResults);
_tokenizer.createTokens(preprocessor.preprocess(tokens1, cfg, files));
const simplecpp::TokenList &tokensP = preprocessor.preprocess(tokens1, cfg, files);
_tokenizer.createTokens(&tokensP);
timer.Stop();
// skip rest of iteration if just checking configuration

View File

@ -1709,7 +1709,7 @@ bool Tokenizer::createTokens(std::istream &code,
return list.createTokens(code, Path::getRelativePath(Path::simplifyPath(FileName), _settings->basePaths));
}
void Tokenizer::createTokens(const simplecpp::TokenList &tokenList)
void Tokenizer::createTokens(const simplecpp::TokenList *tokenList)
{
// make sure settings specified
assert(_settings);

View File

@ -24,7 +24,6 @@
#include "errorlogger.h"
#include "tokenlist.h"
#include "config.h"
#include "simplecpp.h"
#include <string>
#include <map>
@ -36,6 +35,10 @@ class Settings;
class SymbolDatabase;
class TimerResults;
namespace simplecpp {
class TokenList;
}
/// @addtogroup Core
/// @{
@ -74,7 +77,7 @@ public:
bool IsScopeNoReturn(const Token *endScopeToken, bool *unknown = nullptr) const;
bool createTokens(std::istream &code, const std::string& FileName);
void createTokens(const simplecpp::TokenList &tokenList);
void createTokens(const simplecpp::TokenList *tokenList);
bool simplifyTokens1(const std::string &configuration);
/**

View File

@ -25,6 +25,7 @@
#include "settings.h"
#include "errorlogger.h"
#include "utils.h"
#include "simplecpp.h"
#include <cstring>
#include <sstream>
@ -409,10 +410,10 @@ bool TokenList::createTokens(std::istream &code, const std::string& file0)
//---------------------------------------------------------------------------
void TokenList::createTokens(const simplecpp::TokenList &tokenList)
void TokenList::createTokens(const simplecpp::TokenList *tokenList)
{
if (tokenList.cfront())
_files = tokenList.cfront()->location.files;
if (tokenList->cfront())
_files = tokenList->cfront()->location.files;
else
_files.clear();
@ -426,7 +427,7 @@ void TokenList::createTokens(const simplecpp::TokenList &tokenList)
_isCPP = (_settings->enforcedLang == Settings::CPP);
}
for (const simplecpp::Token *tok = tokenList.cfront(); tok; tok = tok->next) {
for (const simplecpp::Token *tok = tokenList->cfront(); tok; tok = tok->next) {
if (_back) {
_back->insertToken(tok->str);
} else {

View File

@ -24,11 +24,14 @@
#include <string>
#include <vector>
#include "config.h"
#include "simplecpp.h"
class Token;
class Settings;
namespace simplecpp {
class TokenList;
}
/// @addtogroup Core
/// @{
@ -80,7 +83,7 @@ public:
*/
bool createTokens(std::istream &code, const std::string& file0 = emptyString);
void createTokens(const simplecpp::TokenList &tokenList);
void createTokens(const simplecpp::TokenList *tokenList);
/** Deallocate list */
void deallocateTokens();