@@ -253,12 +253,12 @@ class simplecpp::TokenList::Stream {
253253 virtual bool good () = 0;
254254
255255 unsigned char readChar () {
256- unsigned char ch = static_cast <unsigned char >(get ());
256+ auto ch = static_cast <unsigned char >(get ());
257257
258258 // For UTF-16 encoded files the BOM is 0xfeff/0xfffe. If the
259259 // character is non-ASCII character then replace it with 0xff
260260 if (isUtf16) {
261- const unsigned char ch2 = static_cast <unsigned char >(get ());
261+ const auto ch2 = static_cast <unsigned char >(get ());
262262 const int ch16 = makeUtf16Char (ch, ch2);
263263 ch = static_cast <unsigned char >(((ch16 >= 0x80 ) ? 0xff : ch16));
264264 }
@@ -281,13 +281,13 @@ class simplecpp::TokenList::Stream {
281281 }
282282
283283 unsigned char peekChar () {
284- unsigned char ch = static_cast <unsigned char >(peek ());
284+ auto ch = static_cast <unsigned char >(peek ());
285285
286286 // For UTF-16 encoded files the BOM is 0xfeff/0xfffe. If the
287287 // character is non-ASCII character then replace it with 0xff
288288 if (isUtf16) {
289289 (void )get ();
290- const unsigned char ch2 = static_cast <unsigned char >(peek ());
290+ const auto ch2 = static_cast <unsigned char >(peek ());
291291 unget ();
292292 const int ch16 = makeUtf16Char (ch, ch2);
293293 ch = static_cast <unsigned char >(((ch16 >= 0x80 ) ? 0xff : ch16));
@@ -1705,7 +1705,7 @@ namespace simplecpp {
17051705 private:
17061706 /* * Create new token where Token::macro is set for replaced tokens */
17071707 Token *newMacroToken (const TokenString &str, const Location &loc, bool replaced, const Token *expandedFromToken=nullptr ) const {
1708- Token *tok = new Token (str,loc);
1708+ auto *tok = new Token (str,loc);
17091709 if (replaced)
17101710 tok->macro = nameTokDef->str ();
17111711 if (expandedFromToken)
@@ -2365,11 +2365,11 @@ namespace simplecpp {
23652365
23662366 static bool isReplaced (const std::set<std::string> &expandedmacros) {
23672367 // return true if size > 1
2368- std::set<std::string>::const_iterator it = expandedmacros.begin ();
2369- if (it == expandedmacros.end ())
2368+ auto it = expandedmacros.cbegin ();
2369+ if (it == expandedmacros.cend ())
23702370 return false ;
23712371 ++it;
2372- return (it != expandedmacros.end ());
2372+ return (it != expandedmacros.cend ());
23732373 }
23742374
23752375 /* * name token in definition */
@@ -3060,7 +3060,7 @@ std::pair<simplecpp::FileData *, bool> simplecpp::FileDataCache::tryload(FileDat
30603060 return {id_it->second , false };
30613061 }
30623062
3063- FileData *const data = new FileData {path, TokenList (path, filenames, outputList)};
3063+ auto *const data = new FileData {path, TokenList (path, filenames, outputList)};
30643064
30653065 if (dui.removeComments )
30663066 data->tokens .removeComments ();
@@ -3154,7 +3154,7 @@ simplecpp::FileDataCache simplecpp::load(const simplecpp::TokenList &rawtokens,
31543154 std::list<const Token *> filelist;
31553155
31563156 // -include files
3157- for (std::list<std::string>::const_iterator it = dui.includes .begin (); it != dui.includes .end (); ++it) {
3157+ for (auto it = dui.includes .cbegin (); it != dui.includes .cend (); ++it) {
31583158 const std::string &filename = *it;
31593159
31603160 const auto loadResult = cache.get (" " , filename, dui, false , filenames, outputList);
@@ -3316,7 +3316,7 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
33163316 const bool hasInclude = isCpp17OrLater (dui) || isGnu (dui);
33173317 MacroMap macros;
33183318 bool strictAnsiDefined = false ;
3319- for (std::list<std::string>::const_iterator it = dui.defines .begin (); it != dui.defines .end (); ++it) {
3319+ for (auto it = dui.defines .cbegin (); it != dui.defines .cend (); ++it) {
33203320 const std::string ¯ostr = *it;
33213321 const std::string::size_type eq = macrostr.find (' =' );
33223322 const std::string::size_type par = macrostr.find (' (' );
@@ -3382,7 +3382,7 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
33823382 std::set<std::string> pragmaOnce;
33833383
33843384 includetokenstack.push (rawtokens.cfront ());
3385- for (std::list<std::string>::const_iterator it = dui.includes .begin (); it != dui.includes .end (); ++it) {
3385+ for (auto it = dui.includes .cbegin (); it != dui.includes .cend (); ++it) {
33863386 const FileData *const filedata = cache.get (" " , *it, dui, false , files, outputList).first ;
33873387 if (filedata != nullptr && filedata->tokens .cfront () != nullptr )
33883388 includetokenstack.push (filedata->tokens .cfront ());
0 commit comments