@@ -338,7 +338,7 @@ static void addInlineSuppressions(const simplecpp::TokenList &tokens, const Sett
338338
339339void Preprocessor::inlineSuppressions (SuppressionList &suppressions)
340340{
341- if (!mSettings . inlineSuppressions )
341+ if (!mSettings -> inlineSuppressions )
342342 return ;
343343 std::list<BadInlineSuppression> err;
344344 ::addInlineSuppressions (mTokens , mSettings , suppressions, err);
@@ -367,7 +367,7 @@ std::list<Directive> Preprocessor::createDirectives() const
367367
368368 std::vector<const simplecpp::TokenList *> list;
369369 list.reserve (1U + mFileCache .size ());
370- list.push_back (& mTokens );
370+ list.push_back (mTokens . get () );
371371 std::transform (mFileCache .cbegin (), mFileCache .cend (), std::back_inserter (list),
372372 [](const std::unique_ptr<simplecpp::FileData> &filedata) {
373373 return &filedata->tokens ;
@@ -773,13 +773,13 @@ static void getConfigs(const simplecpp::TokenList &tokens, std::set<std::string>
773773std::set<std::string> Preprocessor::getConfigs () const
774774{
775775 std::set<std::string> ret = { " " };
776- if (!mTokens . cfront ())
776+ if (!mTokens -> cfront ())
777777 return ret;
778778
779779 std::set<std::string> defined = { " __cplusplus" };
780780
781781 // Insert library defines
782- for (const auto &define : mSettings . library .defines ()) {
782+ for (const auto &define : mSettings -> library .defines ()) {
783783
784784 const std::string::size_type paren = define.find (" (" );
785785 const std::string::size_type space = define.find (" " );
@@ -791,11 +791,11 @@ std::set<std::string> Preprocessor::getConfigs() const
791791 defined .insert (define.substr (0 , end));
792792 }
793793
794- ::getConfigs (mTokens , defined , mSettings . userDefines, mSettings . userUndefs, ret);
794+ ::getConfigs (mTokens , defined , mSettings -> userDefines, mSettings -> userUndefs, ret);
795795
796796 for (const auto &filedata : mFileCache ) {
797- if (!mSettings . configurationExcluded (filedata->filename ))
798- ::getConfigs (filedata->tokens, defined , mSettings . userDefines, mSettings . userUndefs, ret);
797+ if (!mSettings -> configurationExcluded (filedata->filename ))
798+ ::getConfigs (filedata->tokens, defined , mSettings -> userDefines, mSettings -> userUndefs, ret);
799799 }
800800
801801 return ret;
@@ -862,7 +862,7 @@ static simplecpp::DUI createDUI(const Settings &mSettings, const std::string &cf
862862
863863const simplecpp::Output* Preprocessor::handleErrors (const simplecpp::OutputList& outputList)
864864{
865- const bool showerror = (!mSettings . userDefines .empty () && !mSettings . force );
865+ const bool showerror = (!mSettings -> userDefines .empty () && !mSettings -> force );
866866 return reportOutput (outputList, showerror);
867867}
868868
@@ -877,30 +877,30 @@ bool Preprocessor::loadFiles(std::vector<std::string> &files)
877877
878878void Preprocessor::removeComments ()
879879{
880- mTokens . removeComments ();
880+ mTokens -> removeComments ();
881881 for (const auto &filedata : mFileCache ) {
882882 filedata->tokens .removeComments ();
883883 }
884884}
885885
886886void Preprocessor::setPlatformInfo ()
887887{
888- mTokens . sizeOfType [" bool" ] = mSettings . platform .sizeof_bool ;
889- mTokens . sizeOfType [" short" ] = mSettings . platform .sizeof_short ;
890- mTokens . sizeOfType [" int" ] = mSettings . platform .sizeof_int ;
891- mTokens . sizeOfType [" long" ] = mSettings . platform .sizeof_long ;
892- mTokens . sizeOfType [" long long" ] = mSettings . platform .sizeof_long_long ;
893- mTokens . sizeOfType [" float" ] = mSettings . platform .sizeof_float ;
894- mTokens . sizeOfType [" double" ] = mSettings . platform .sizeof_double ;
895- mTokens . sizeOfType [" long double" ] = mSettings . platform .sizeof_long_double ;
896- mTokens . sizeOfType [" bool *" ] = mSettings . platform .sizeof_pointer ;
897- mTokens . sizeOfType [" short *" ] = mSettings . platform .sizeof_pointer ;
898- mTokens . sizeOfType [" int *" ] = mSettings . platform .sizeof_pointer ;
899- mTokens . sizeOfType [" long *" ] = mSettings . platform .sizeof_pointer ;
900- mTokens . sizeOfType [" long long *" ] = mSettings . platform .sizeof_pointer ;
901- mTokens . sizeOfType [" float *" ] = mSettings . platform .sizeof_pointer ;
902- mTokens . sizeOfType [" double *" ] = mSettings . platform .sizeof_pointer ;
903- mTokens . sizeOfType [" long double *" ] = mSettings . platform .sizeof_pointer ;
888+ mTokens -> sizeOfType [" bool" ] = mSettings -> platform .sizeof_bool ;
889+ mTokens -> sizeOfType [" short" ] = mSettings -> platform .sizeof_short ;
890+ mTokens -> sizeOfType [" int" ] = mSettings -> platform .sizeof_int ;
891+ mTokens -> sizeOfType [" long" ] = mSettings -> platform .sizeof_long ;
892+ mTokens -> sizeOfType [" long long" ] = mSettings -> platform .sizeof_long_long ;
893+ mTokens -> sizeOfType [" float" ] = mSettings -> platform .sizeof_float ;
894+ mTokens -> sizeOfType [" double" ] = mSettings -> platform .sizeof_double ;
895+ mTokens -> sizeOfType [" long double" ] = mSettings -> platform .sizeof_long_double ;
896+ mTokens -> sizeOfType [" bool *" ] = mSettings -> platform .sizeof_pointer ;
897+ mTokens -> sizeOfType [" short *" ] = mSettings -> platform .sizeof_pointer ;
898+ mTokens -> sizeOfType [" int *" ] = mSettings -> platform .sizeof_pointer ;
899+ mTokens -> sizeOfType [" long *" ] = mSettings -> platform .sizeof_pointer ;
900+ mTokens -> sizeOfType [" long long *" ] = mSettings -> platform .sizeof_pointer ;
901+ mTokens -> sizeOfType [" float *" ] = mSettings -> platform .sizeof_pointer ;
902+ mTokens -> sizeOfType [" double *" ] = mSettings -> platform .sizeof_pointer ;
903+ mTokens -> sizeOfType [" long double *" ] = mSettings -> platform .sizeof_pointer ;
904904}
905905
906906simplecpp::TokenList Preprocessor::preprocess (const std::string &cfgStr, std::vector<std::string> &files, simplecpp::OutputList& outputList)
@@ -929,7 +929,7 @@ std::string Preprocessor::getcode(const std::string &cfgStr, std::vector<std::st
929929 std::ostringstream ret;
930930 for (const simplecpp::Token *tok = tokens2.cfront (); tok; tok = tok->next ) {
931931 if (writeLocations && tok->location .fileIndex != prevfile) {
932- ret << " \n #line " << tok->location .line << " \" " << mTokens . file (tok->location ) << " \"\n " ;
932+ ret << " \n #line " << tok->location .line << " \" " << mTokens -> file (tok->location ) << " \"\n " ;
933933 prevfile = tok->location .fileIndex ;
934934 line = tok->location .line ;
935935 }
@@ -1024,39 +1024,39 @@ void Preprocessor::error(const simplecpp::Location& loc, const std::string &msg,
10241024void Preprocessor::error (const simplecpp::Location& loc, const std::string &msg, const std::string& id)
10251025{
10261026 std::list<ErrorMessage::FileLocation> locationList;
1027- if (!mTokens . file (loc).empty ()) {
1028- std::string file = Path::fromNativeSeparators (mTokens . file (loc));
1029- if (mSettings . relativePaths )
1030- file = Path::getRelativePath (file, mSettings . basePaths );
1027+ if (!mTokens -> file (loc).empty ()) {
1028+ std::string file = Path::fromNativeSeparators (mTokens -> file (loc));
1029+ if (mSettings -> relativePaths )
1030+ file = Path::getRelativePath (file, mSettings -> basePaths );
10311031
10321032 locationList.emplace_back (file, loc.line , loc.col );
10331033 }
1034- mErrorLogger . reportErr (ErrorMessage (std::move (locationList),
1035- mFile0 ,
1036- Severity::error,
1037- msg,
1038- id,
1039- Certainty::normal));
1034+ mErrorLogger -> reportErr (ErrorMessage (std::move (locationList),
1035+ mFile0 ,
1036+ Severity::error,
1037+ msg,
1038+ id,
1039+ Certainty::normal));
10401040}
10411041
10421042// Report that include is missing
10431043void Preprocessor::missingInclude (const simplecpp::Location& loc, const std::string &header, HeaderTypes headerType)
10441044{
1045- if (!mSettings . checks .isEnabled (Checks::missingInclude))
1045+ if (!mSettings -> checks .isEnabled (Checks::missingInclude))
10461046 return ;
10471047
10481048 std::list<ErrorMessage::FileLocation> locationList;
1049- if (!mTokens . file (loc).empty ()) {
1049+ if (!mTokens -> file (loc).empty ()) {
10501050 // TODO: add relative path handling?
1051- locationList.emplace_back (mTokens . file (loc), loc.line , loc.col );
1051+ locationList.emplace_back (mTokens -> file (loc), loc.line , loc.col );
10521052 }
10531053 ErrorMessage errmsg (std::move (locationList), mFile0 , Severity::information,
10541054 (headerType==SystemHeader) ?
10551055 " Include file: <" + header + " > not found. Please note: Standard library headers do not need to be provided to get proper results." :
10561056 " Include file: \" " + header + " \" not found." ,
10571057 (headerType==SystemHeader) ? " missingIncludeSystem" : " missingInclude" ,
10581058 Certainty::normal);
1059- mErrorLogger . reportErr (errmsg);
1059+ mErrorLogger -> reportErr (errmsg);
10601060}
10611061
10621062void Preprocessor::invalidSuppression (const simplecpp::Location& loc, const std::string &msg)
@@ -1092,10 +1092,10 @@ void Preprocessor::dump(std::ostream &out) const
10921092 for (const simplecpp::MacroUsage ¯oUsage: mMacroUsage ) {
10931093 out << " <macro"
10941094 << " name=\" " << macroUsage.macroName << " \" "
1095- << " file=\" " << ErrorLogger::toxml (mTokens . file (macroUsage.macroLocation )) << " \" "
1095+ << " file=\" " << ErrorLogger::toxml (mTokens -> file (macroUsage.macroLocation )) << " \" "
10961096 << " line=\" " << macroUsage.macroLocation .line << " \" "
10971097 << " column=\" " << macroUsage.macroLocation .col << " \" "
1098- << " usefile=\" " << ErrorLogger::toxml (mTokens . file (macroUsage.useLocation )) << " \" "
1098+ << " usefile=\" " << ErrorLogger::toxml (mTokens -> file (macroUsage.useLocation )) << " \" "
10991099 << " useline=\" " << macroUsage.useLocation .line << " \" "
11001100 << " usecolumn=\" " << macroUsage.useLocation .col << " \" "
11011101 << " is-known-value=\" " << bool_to_string (macroUsage.macroValueKnown ) << " \" "
@@ -1108,7 +1108,7 @@ void Preprocessor::dump(std::ostream &out) const
11081108 out << " <simplecpp-if-cond>" << std::endl;
11091109 for (const simplecpp::IfCond &ifCond: mIfCond ) {
11101110 out << " <if-cond"
1111- << " file=\" " << ErrorLogger::toxml (mTokens . file (ifCond.location )) << " \" "
1111+ << " file=\" " << ErrorLogger::toxml (mTokens -> file (ifCond.location )) << " \" "
11121112 << " line=\" " << ifCond.location .line << " \" "
11131113 << " column=\" " << ifCond.location .col << " \" "
11141114 << " E=\" " << ErrorLogger::toxml (ifCond.E ) << " \" "
@@ -1122,7 +1122,7 @@ void Preprocessor::dump(std::ostream &out) const
11221122std::size_t Preprocessor::calculateHash (const std::string &toolinfo) const
11231123{
11241124 std::string hashData = toolinfo;
1125- for (const simplecpp::Token *tok = mTokens . cfront (); tok; tok = tok->next ) {
1125+ for (const simplecpp::Token *tok = mTokens -> cfront (); tok; tok = tok->next ) {
11261126 if (!tok->comment ) {
11271127 hashData += tok->str ();
11281128 hashData += static_cast <char >(tok->location .line );
0 commit comments