@@ -688,16 +688,17 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
688688 continue ;
689689 }
690690
691- Tokenizer mTokenizer (&mSettings , this );
691+ Tokenizer tokenizer (&mSettings , this );
692+ tokenizer.setPreprocessor (&preprocessor);
692693 if (mSettings .showtime != SHOWTIME_MODES ::SHOWTIME_NONE )
693- mTokenizer .setTimerResults (&s_timerResults);
694+ tokenizer .setTimerResults (&s_timerResults);
694695
695696 try {
696697 // Create tokens, skip rest of iteration if failed
697698 {
698699 Timer timer (" Tokenizer::createTokens" , mSettings .showtime , &s_timerResults);
699700 simplecpp::TokenList tokensP = preprocessor.preprocess (tokens1, mCurrentConfig , files, true );
700- mTokenizer .createTokens (std::move (tokensP));
701+ tokenizer .createTokens (std::move (tokensP));
701702 }
702703 hasValidConfig = true ;
703704
@@ -708,19 +709,19 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
708709 mErrorLogger .reportOut (" Checking " + fixedpath + " : " + mCurrentConfig + " ..." );
709710 }
710711
711- if (!mTokenizer .tokens ())
712+ if (!tokenizer .tokens ())
712713 continue ;
713714
714715 // skip rest of iteration if just checking configuration
715716 if (mSettings .checkConfiguration )
716717 continue ;
717718
718719 // Check raw tokens
719- checkRawTokens (mTokenizer );
720+ checkRawTokens (tokenizer );
720721
721722 // Simplify tokens into normal form, skip rest of iteration if failed
722723 Timer timer2 (" Tokenizer::simplifyTokens1" , mSettings .showtime , &s_timerResults);
723- bool result = mTokenizer .simplifyTokens1 (mCurrentConfig );
724+ bool result = tokenizer .simplifyTokens1 (mCurrentConfig );
724725 timer2.stop ();
725726 if (!result)
726727 continue ;
@@ -733,13 +734,13 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
733734 fdump << " <cpp version=\" " << mSettings .standards .getCPP () << " \" />" << std::endl;
734735 fdump << " </standards>" << std::endl;
735736 preprocessor.dump (fdump);
736- mTokenizer .dump (fdump);
737+ tokenizer .dump (fdump);
737738 fdump << " </dump>" << std::endl;
738739 }
739740
740741 // Skip if we already met the same simplified token list
741742 if (mSettings .force || mSettings .maxConfigs > 1 ) {
742- const unsigned long long checksum = mTokenizer .list .calculateChecksum ();
743+ const unsigned long long checksum = tokenizer .list .calculateChecksum ();
743744 if (checksums.find (checksum) != checksums.end ()) {
744745 if (mSettings .debugwarnings )
745746 purgedConfigurationMessage (filename, mCurrentConfig );
@@ -749,25 +750,25 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
749750 }
750751
751752 // Check normal tokens
752- checkNormalTokens (mTokenizer );
753+ checkNormalTokens (tokenizer );
753754
754755 // Analyze info..
755756 if (!mSettings .buildDir .empty ())
756- checkUnusedFunctions.parseTokens (mTokenizer , filename.c_str (), &mSettings );
757+ checkUnusedFunctions.parseTokens (tokenizer , filename.c_str (), &mSettings );
757758
758759 // simplify more if required, skip rest of iteration if failed
759760 if (mSimplify && hasRule (" simple" )) {
760761 std::cout << " Handling of \" simple\" rules is deprecated and will be removed in Cppcheck 2.5." << std::endl;
761762
762763 // if further simplification fails then skip rest of iteration
763764 Timer timer3 (" Tokenizer::simplifyTokenList2" , mSettings .showtime , &s_timerResults);
764- result = mTokenizer .simplifyTokenList2 ();
765+ result = tokenizer .simplifyTokenList2 ();
765766 timer3.stop ();
766767 if (!result)
767768 continue ;
768769
769770 if (!Settings::terminated ())
770- executeRules (" simple" , mTokenizer );
771+ executeRules (" simple" , tokenizer );
771772 }
772773
773774 } catch (const simplecpp::Output &o) {
@@ -779,16 +780,16 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
779780 } catch (const InternalError &e) {
780781 std::list<ErrorMessage::FileLocation> locationList;
781782 if (e.token ) {
782- ErrorMessage::FileLocation loc (e.token , &mTokenizer .list );
783+ ErrorMessage::FileLocation loc (e.token , &tokenizer .list );
783784 locationList.push_back (loc);
784785 } else {
785- ErrorMessage::FileLocation loc (mTokenizer .list .getSourceFilePath (), 0 , 0 );
786+ ErrorMessage::FileLocation loc (tokenizer .list .getSourceFilePath (), 0 , 0 );
786787 ErrorMessage::FileLocation loc2 (filename, 0 , 0 );
787788 locationList.push_back (loc2);
788789 locationList.push_back (loc);
789790 }
790791 ErrorMessage errmsg (locationList,
791- mTokenizer .list .getSourceFilePath (),
792+ tokenizer .list .getSourceFilePath (),
792793 Severity::error,
793794 e.errorMessage ,
794795 e.id ,
0 commit comments