Skip to content

Commit c3dff6a

Browse files
committed
Optimize load
1 parent 1678b7d commit c3dff6a

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

simplecpp.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3173,15 +3173,20 @@ simplecpp::FileDataCache simplecpp::load(const simplecpp::TokenList &rawtokens,
31733173
const bool systemheader = (htok->str()[0] == '<');
31743174
const std::string header(htok->str().substr(1U, htok->str().size() - 2U));
31753175

3176-
FileData *const filedata = cache.get(sourcefile, header, dui, systemheader, filenames, outputList).first;
3177-
if (!filedata)
3176+
const auto loadResult = cache.get(sourcefile, header, dui, systemheader, filenames, outputList);
3177+
const bool loaded = loadResult.second;
3178+
FileData *const filedata = loadResult.first;
3179+
3180+
if (!loaded)
3181+
continue;
3182+
3183+
if (!filedata->tokens.front())
31783184
continue;
31793185

31803186
if (dui.removeComments)
31813187
filedata->tokens.removeComments();
31823188

3183-
if (filedata->tokens.front())
3184-
filelist.push_back(filedata->tokens.front());
3189+
filelist.push_back(filedata->tokens.front());
31853190
}
31863191

31873192
return cache;

0 commit comments

Comments
 (0)